OGS
CreateChemicalReactionData.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
5
6#include <boost/algorithm/string/predicate.hpp>
7
9#include "ChemicalReaction.h"
10
11namespace ChemistryLib
12{
14{
15std::vector<std::unique_ptr<ChemicalReaction>> createChemicalReactionData(
16 BaseLib::ConfigTree const& config)
17{
18 std::vector<std::unique_ptr<ChemicalReaction>> chemical_reactions;
19
20 for (
21 auto const& reaction_config :
23 config.getConfigSubtreeList("chemical_reaction"))
24 {
25 auto const stoichiometric_vector =
27 reaction_config.getConfigParameter<std::vector<double>>(
28 "stoichiometric_coefficients");
29
30 auto const reaction_type =
32 reaction_config.getConfigParameter<std::string>("reaction_type");
33 if (boost::iequals(reaction_type, "FirstOrderReaction"))
34 {
35 chemical_reactions.emplace_back(std::make_unique<
37 stoichiometric_vector,
39 reaction_config.getConfigParameter<double>(
40 "first_order_rate_constant")));
41 }
42 }
43
44 return chemical_reactions;
45}
46} // namespace SelfContainedSolverData
47} // namespace ChemistryLib
Range< SubtreeIterator > getConfigSubtreeList(std::string const &root) const
std::vector< std::unique_ptr< ChemicalReaction > > createChemicalReactionData(BaseLib::ConfigTree const &config)