diff --git a/Applications/ApplicationsLib/ProjectData.cpp b/Applications/ApplicationsLib/ProjectData.cpp index 271658f238767fc5f606089acfc4fa4b89c5d59f..adc6a899d39aead84dfca142457510ab74906bb0 100644 --- a/Applications/ApplicationsLib/ProjectData.cpp +++ b/Applications/ApplicationsLib/ProjectData.cpp @@ -48,9 +48,6 @@ #ifdef OGS_BUILD_PROCESS_COMPONENTTRANSPORT #include "ChemistryLib/CreateChemicalSolverInterface.h" -// The ComponenTransportProcess is needed for the instantiation of the chemical -// solver. -#include "ProcessLib/ComponentTransport/ComponentTransportProcess.h" #include "ProcessLib/ComponentTransport/CreateComponentTransportProcess.h" #endif #ifdef OGS_BUILD_PROCESS_STEADYSTATEDIFFUSION @@ -331,6 +328,11 @@ ProjectData::ProjectData(BaseLib::ConfigTree const& project_config, //! \ogs_file_param{prj__media} parseMedia(project_config.getConfigSubtreeOptional("media")); + parseChemicalSolverInterface( + //! \ogs_file_param{prj__chemical_system} + project_config.getConfigSubtreeOptional("chemical_system"), + output_directory); + //! \ogs_file_param{prj__processes} parseProcesses(project_config.getConfigSubtree("processes"), project_directory, output_directory); @@ -341,11 +343,6 @@ ProjectData::ProjectData(BaseLib::ConfigTree const& project_config, //! \ogs_file_param{prj__nonlinear_solvers} parseNonlinearSolvers(project_config.getConfigSubtree("nonlinear_solvers")); - parseChemicalSolverInterface( - //! \ogs_file_param{prj__chemical_system} - project_config.getConfigSubtreeOptional("chemical_system"), - output_directory); - //! \ogs_file_param{prj__time_loop} parseTimeLoop(project_config.getConfigSubtree("time_loop"), output_directory); @@ -503,6 +500,59 @@ void ProjectData::parseMedia( } } +void ProjectData::parseChemicalSolverInterface( + boost::optional<BaseLib::ConfigTree> const& config, + std::string const& output_directory) +{ + if (!config) + { + return; + } + +#ifdef OGS_BUILD_PROCESS_COMPONENTTRANSPORT + INFO( + "Ready for initializing interface to a chemical solver for water " + "chemistry calculation."); + + auto const chemical_solver = + //! \ogs_file_attr{prj__chemical_system__chemical_solver} + config->getConfigAttribute<std::string>("chemical_solver"); + + if (boost::iequals(chemical_solver, "Phreeqc")) + { + INFO( + "Configuring phreeqc interface for water chemistry " + "calculation using file-based approach."); + + _chemical_solver_interface = + ChemistryLib::createChemicalSolverInterface< + ChemistryLib::ChemicalSolver::Phreeqc>(_mesh_vec, *config, + output_directory); + } + else if (boost::iequals(chemical_solver, "PhreeqcKernel")) + { + OGS_FATAL( + "The chemical solver option of PhreeqcKernel is not accessible " + "for the time being. Please set 'Phreeqc'' as the chemical " + "solver for reactive transport modeling."); + } + else + { + OGS_FATAL( + "Unknown chemical solver. Please specify either Phreeqc or " + "PhreeqcKernel as the solver for water chemistry calculation " + "instead."); + } +#else + (void)output_directory; + + OGS_FATAL( + "The specified type of the process to be solved is not component " + "transport process so that water chemistry calculation could not " + "be activated."); +#endif +} + void ProjectData::parseProcesses(BaseLib::ConfigTree const& processes_config, std::string const& project_directory, std::string const& output_directory) @@ -1048,67 +1098,3 @@ void ProjectData::parseCurves( "The curve name is not unique."); } } - -void ProjectData::parseChemicalSolverInterface( - boost::optional<BaseLib::ConfigTree> const& config, - std::string const& output_directory) -{ - if (!config) - { - return; - } - -#ifdef OGS_BUILD_PROCESS_COMPONENTTRANSPORT - INFO( - "Ready for initializing interface to a chemical solver for water " - "chemistry calculation."); - - if (auto const* component_transport_process = dynamic_cast< - ProcessLib::ComponentTransport::ComponentTransportProcess const*>( - _processes[0].get())) - { - auto const& process_id_to_component_name_map = - component_transport_process->getProcessIDToComponentNameMap(); - - auto const chemical_solver = - //! \ogs_file_attr{prj__chemical_system__chemical_solver} - config->getConfigAttribute<std::string>("chemical_solver"); - - if (boost::iequals(chemical_solver, "Phreeqc")) - { - INFO( - "Configuring phreeqc interface for water chemistry " - "calculation using file-based approach."); - - _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")) - { - OGS_FATAL( - "The chemical solver option of PhreeqcKernel is not accessible " - "for the time being. Please set 'Phreeqc'' as the chemical " - "solver for reactive transport modeling."); - } - else - { - OGS_FATAL( - "Unknown chemical solver. Please specify either Phreeqc or " - "PhreeqcKernel as the solver for water chemistry calculation " - "instead."); - } - } - else -#endif - { - (void)output_directory; - - OGS_FATAL( - "The specified type of the process to be solved is not component " - "transport process so that water chemistry calculation could not " - "be activated."); - } -}