diff --git a/ChemistryLib/ChemicalSolverInterface.h b/ChemistryLib/ChemicalSolverInterface.h index 729ff2b1500f628b8548dc3b26f85dec55c6450c..e821496003a08fb17a86b5820ec4f5552e4abce6 100644 --- a/ChemistryLib/ChemicalSolverInterface.h +++ b/ChemistryLib/ChemicalSolverInterface.h @@ -25,6 +25,8 @@ public: virtual void doWaterChemistryCalculation( std::vector<GlobalVector*>& process_solutions, double const dt) = 0; + virtual std::vector<GlobalVector*> getIntPtProcessSolutions() const = 0; + virtual std::vector<std::string> const getComponentList() const { return {}; diff --git a/ChemistryLib/PhreeqcIO.cpp b/ChemistryLib/PhreeqcIO.cpp index fdda6e0de58082dbde9e551f1bdb96068b1d6ed1..b9f08563af3f00142454ed109fc0f91b10ff8161 100644 --- a/ChemistryLib/PhreeqcIO.cpp +++ b/ChemistryLib/PhreeqcIO.cpp @@ -124,9 +124,22 @@ void PhreeqcIO::executeInitialCalculation( execute(); readOutputsFromFile(); +} - setAqueousSolutionsOrUpdateProcessSolutions( - process_solutions, Status::UpdatingProcessSolutions); +std::vector<GlobalVector*> PhreeqcIO::getIntPtProcessSolutions() const +{ + auto const& aqueous_solution = _chemical_system->aqueous_solution; + std::vector<GlobalVector*> int_pt_process_solutions; + int_pt_process_solutions.reserve(aqueous_solution->components.size() + 1); + + std::transform(aqueous_solution->components.begin(), + aqueous_solution->components.end(), + std::back_inserter(int_pt_process_solutions), + [](auto const& c) { return c.amount.get(); }); + + int_pt_process_solutions.push_back(aqueous_solution->pH.get()); + + return int_pt_process_solutions; } void PhreeqcIO::doWaterChemistryCalculation( diff --git a/ChemistryLib/PhreeqcIO.h b/ChemistryLib/PhreeqcIO.h index e2625497a858043546d4d97ece3e8cebc3ab434b..38a1bfa79e853778bd735d3741bf7325b69b1f49 100644 --- a/ChemistryLib/PhreeqcIO.h +++ b/ChemistryLib/PhreeqcIO.h @@ -63,6 +63,8 @@ public: void readOutputsFromFile(); + std::vector<GlobalVector*> getIntPtProcessSolutions() const override; + friend std::ostream& operator<<(std::ostream& os, PhreeqcIO const& phreeqc_io); diff --git a/ChemistryLib/PhreeqcKernel.h b/ChemistryLib/PhreeqcKernel.h index 85004f3c32dd6644504fc66700cd0d4907924872..565725cd9fc9a21b96c06e87b026ad0eea1fb7dd 100644 --- a/ChemistryLib/PhreeqcKernel.h +++ b/ChemistryLib/PhreeqcKernel.h @@ -53,6 +53,11 @@ public: void execute(std::vector<GlobalVector*>& process_solutions); + std::vector<GlobalVector*> getIntPtProcessSolutions() const override + { + return {}; + } + void updateNodalProcessSolutions( std::vector<GlobalVector*> const& process_solutions, std::size_t const node_id); diff --git a/ProcessLib/TimeLoop.cpp b/ProcessLib/TimeLoop.cpp index af09a73f3443170dcfe40d28f27a82af16de1fa0..41abad0cdfe293edf91cd9f9fbf84acaf384b1b5 100644 --- a/ProcessLib/TimeLoop.cpp +++ b/ProcessLib/TimeLoop.cpp @@ -455,11 +455,8 @@ void TimeLoop::initialize() time_phreeqc.start(); auto& pcs = _per_process_data[0]->process; - auto const interpolated_process_solutions = - pcs.interpolateNodalValuesToIntegrationPoints(_process_solutions); - _chemical_solver_interface->executeInitialCalculation( - interpolated_process_solutions); + pcs.interpolateNodalValuesToIntegrationPoints(_process_solutions)); INFO("[time] Phreeqc took {:g} s.", time_phreeqc.elapsed()); } @@ -823,11 +820,9 @@ TimeLoop::solveCoupledEquationSystemsByStaggeredScheme( time_phreeqc.start(); auto& pcs = _per_process_data[0]->process; - auto const interpolated_process_solutions = - pcs.interpolateNodalValuesToIntegrationPoints(_process_solutions); - _chemical_solver_interface->doWaterChemistryCalculation( - interpolated_process_solutions, dt); + pcs.interpolateNodalValuesToIntegrationPoints(_process_solutions), + dt); INFO("[time] Phreeqc took {:g} s.", time_phreeqc.elapsed()); }