From 041b36f0e044c8ff9d37a88adfefa1e630cc2725 Mon Sep 17 00:00:00 2001 From: renchao_lu <renchao.lu@gmail.com> Date: Fri, 29 May 2020 11:16:01 +0200 Subject: [PATCH] [CL] Fix inconsistent parameter name. --- Applications/ApplicationsLib/ProjectData.cpp | 19 ++++++------- Applications/ApplicationsLib/ProjectData.h | 10 ++++--- ProcessLib/CreateTimeLoop.cpp | 7 ++--- ProcessLib/CreateTimeLoop.h | 3 ++- ProcessLib/TimeLoop.cpp | 28 +++++++++++--------- ProcessLib/TimeLoop.h | 3 ++- 6 files changed, 39 insertions(+), 31 deletions(-) diff --git a/Applications/ApplicationsLib/ProjectData.cpp b/Applications/ApplicationsLib/ProjectData.cpp index 361c0eef88e..271658f2387 100644 --- a/Applications/ApplicationsLib/ProjectData.cpp +++ b/Applications/ApplicationsLib/ProjectData.cpp @@ -341,7 +341,7 @@ ProjectData::ProjectData(BaseLib::ConfigTree const& project_config, //! \ogs_file_param{prj__nonlinear_solvers} parseNonlinearSolvers(project_config.getConfigSubtree("nonlinear_solvers")); - parseChemicalSystem( + parseChemicalSolverInterface( //! \ogs_file_param{prj__chemical_system} project_config.getConfigSubtreeOptional("chemical_system"), output_directory); @@ -974,9 +974,9 @@ void ProjectData::parseTimeLoop(BaseLib::ConfigTree const& config, { DBUG("Reading time loop configuration."); - _time_loop = ProcessLib::createTimeLoop(config, output_directory, - _processes, _nonlinear_solvers, - _mesh_vec, _chemical_system); + _time_loop = ProcessLib::createTimeLoop( + config, output_directory, _processes, _nonlinear_solvers, _mesh_vec, + _chemical_solver_interface); if (!_time_loop) { @@ -1049,7 +1049,7 @@ void ProjectData::parseCurves( } } -void ProjectData::parseChemicalSystem( +void ProjectData::parseChemicalSolverInterface( boost::optional<BaseLib::ConfigTree> const& config, std::string const& output_directory) { @@ -1080,10 +1080,11 @@ void ProjectData::parseChemicalSystem( "Configuring phreeqc interface for water chemistry " "calculation using file-based approach."); - _chemical_system = ChemistryLib::createChemicalSolverInterface< - ChemistryLib::ChemicalSolver::Phreeqc>( - _mesh_vec, process_id_to_component_name_map, *config, - output_directory); + _chemical_solver_interface = + ChemistryLib::createChemicalSolverInterface< + ChemistryLib::ChemicalSolver::Phreeqc>( + _mesh_vec, process_id_to_component_name_map, *config, + output_directory); } else if (boost::iequals(chemical_solver, "PhreeqcKernel")) { diff --git a/Applications/ApplicationsLib/ProjectData.h b/Applications/ApplicationsLib/ProjectData.h index e1593be124c..19b94b239f1 100644 --- a/Applications/ApplicationsLib/ProjectData.h +++ b/Applications/ApplicationsLib/ProjectData.h @@ -21,7 +21,7 @@ #include "MaterialLib/MPL/Medium.h" #include "MathLib/InterpolationAlgorithms/PiecewiseLinearInterpolation.h" -#include "ChemistryLib/PhreeqcIO.h" +#include "ChemistryLib/ChemicalSolverInterface.h" #include "ParameterLib/CoordinateSystem.h" #include "ParameterLib/Parameter.h" #include "ProcessLib/Process.h" @@ -113,8 +113,9 @@ private: void parseCurves(boost::optional<BaseLib::ConfigTree> const& config); - void parseChemicalSystem(boost::optional<BaseLib::ConfigTree> const& config, - const std::string& output_directory); + void parseChemicalSolverInterface( + boost::optional<BaseLib::ConfigTree> const& config, + const std::string& output_directory); std::vector<std::unique_ptr<MeshLib::Mesh>> _mesh_vec; std::vector<std::unique_ptr<ProcessLib::Process>> _processes; @@ -138,5 +139,6 @@ private: std::unique_ptr<MathLib::PiecewiseLinearInterpolation>> _curves; - std::unique_ptr<ChemistryLib::ChemicalSolverInterface> _chemical_system; + std::unique_ptr<ChemistryLib::ChemicalSolverInterface> + _chemical_solver_interface; }; diff --git a/ProcessLib/CreateTimeLoop.cpp b/ProcessLib/CreateTimeLoop.cpp index 9417fc7315e..19cb21a6399 100644 --- a/ProcessLib/CreateTimeLoop.cpp +++ b/ProcessLib/CreateTimeLoop.cpp @@ -25,7 +25,8 @@ std::unique_ptr<TimeLoop> createTimeLoop( const std::map<std::string, std::unique_ptr<NumLib::NonlinearSolverBase>>& nonlinear_solvers, std::vector<std::unique_ptr<MeshLib::Mesh>> const& meshes, - std::unique_ptr<ChemistryLib::ChemicalSolverInterface>& phreeqc_io) + std::unique_ptr<ChemistryLib::ChemicalSolverInterface>& + chemical_solver_interface) { auto const& coupling_config //! \ogs_file_param{prj__time_loop__global_process_coupling} @@ -93,7 +94,7 @@ std::unique_ptr<TimeLoop> createTimeLoop( return std::make_unique<TimeLoop>( std::move(output), std::move(per_process_data), max_coupling_iterations, - std::move(global_coupling_conv_criteria), std::move(phreeqc_io), - start_time, end_time); + std::move(global_coupling_conv_criteria), + std::move(chemical_solver_interface), start_time, end_time); } } // namespace ProcessLib diff --git a/ProcessLib/CreateTimeLoop.h b/ProcessLib/CreateTimeLoop.h index d0468da6569..a6000261acc 100644 --- a/ProcessLib/CreateTimeLoop.h +++ b/ProcessLib/CreateTimeLoop.h @@ -50,6 +50,7 @@ std::unique_ptr<TimeLoop> createTimeLoop( std::map<std::string, std::unique_ptr<NumLib::NonlinearSolverBase>> const& nonlinear_solvers, std::vector<std::unique_ptr<MeshLib::Mesh>> const& meshes, - std::unique_ptr<ChemistryLib::ChemicalSolverInterface>& phreeqc_io); + std::unique_ptr<ChemistryLib::ChemicalSolverInterface>& + chemical_solver_interface); } // namespace ProcessLib diff --git a/ProcessLib/TimeLoop.cpp b/ProcessLib/TimeLoop.cpp index d8d1d70a18c..9adf4f53a87 100644 --- a/ProcessLib/TimeLoop.cpp +++ b/ProcessLib/TimeLoop.cpp @@ -224,21 +224,21 @@ NumLib::NonlinearSolverStatus solveOneTimeStepOneProcess( return nonlinear_solver_status; } -TimeLoop::TimeLoop( - std::unique_ptr<Output>&& output, - std::vector<std::unique_ptr<ProcessData>>&& per_process_data, - const int global_coupling_max_iterations, - std::vector<std::unique_ptr<NumLib::ConvergenceCriterion>>&& - global_coupling_conv_crit, - std::unique_ptr<ChemistryLib::ChemicalSolverInterface>&& chemical_system, - const double start_time, const double end_time) +TimeLoop::TimeLoop(std::unique_ptr<Output>&& output, + std::vector<std::unique_ptr<ProcessData>>&& per_process_data, + const int global_coupling_max_iterations, + std::vector<std::unique_ptr<NumLib::ConvergenceCriterion>>&& + global_coupling_conv_crit, + std::unique_ptr<ChemistryLib::ChemicalSolverInterface>&& + chemical_solver_interface, + const double start_time, const double end_time) : _output(std::move(output)), _per_process_data(std::move(per_process_data)), _start_time(start_time), _end_time(end_time), _global_coupling_max_iterations(global_coupling_max_iterations), _global_coupling_conv_crit(std::move(global_coupling_conv_crit)), - _chemical_system(std::move(chemical_system)) + _chemical_solver_interface(std::move(chemical_solver_interface)) { } @@ -444,11 +444,12 @@ void TimeLoop::initialize() std::tie(_process_solutions, _process_solutions_prev) = setInitialConditions(_start_time, _per_process_data); - if (_chemical_system != nullptr) + if (_chemical_solver_interface) { BaseLib::RunTime time_phreeqc; time_phreeqc.start(); - _chemical_system->executeInitialCalculation(_process_solutions); + _chemical_solver_interface->executeInitialCalculation( + _process_solutions); INFO("[time] Phreeqc took {:g} s.", time_phreeqc.elapsed()); } @@ -800,7 +801,7 @@ TimeLoop::solveCoupledEquationSystemsByStaggeredScheme( timestep_id, t); } - if (_chemical_system != nullptr) + if (_chemical_solver_interface) { // Sequential non-iterative approach applied here to perform water // chemistry calculation followed by resolving component transport @@ -809,7 +810,8 @@ TimeLoop::solveCoupledEquationSystemsByStaggeredScheme( // space and localized chemical equilibrium between solutes. BaseLib::RunTime time_phreeqc; time_phreeqc.start(); - _chemical_system->doWaterChemistryCalculation(_process_solutions, dt); + _chemical_solver_interface->doWaterChemistryCalculation( + _process_solutions, dt); INFO("[time] Phreeqc took {:g} s.", time_phreeqc.elapsed()); } diff --git a/ProcessLib/TimeLoop.h b/ProcessLib/TimeLoop.h index a555112d361..7e2e5f5b20d 100644 --- a/ProcessLib/TimeLoop.h +++ b/ProcessLib/TimeLoop.h @@ -125,7 +125,8 @@ private: std::vector<std::unique_ptr<NumLib::ConvergenceCriterion>> _global_coupling_conv_crit; - std::unique_ptr<ChemistryLib::ChemicalSolverInterface> _chemical_system; + std::unique_ptr<ChemistryLib::ChemicalSolverInterface> + _chemical_solver_interface; /// Solutions of the previous coupling iteration for the convergence /// criteria of the coupling iteration. -- GitLab