diff --git a/ChemistryLib/PhreeqcIOData/AqueousSolution.h b/ChemistryLib/PhreeqcIOData/AqueousSolution.h index b802479b1c00c2bc9f4ca0b0bdcbefdc2e59b125..0bca4401782bac6bdbb157830f5bac2c799fe6e3 100644 --- a/ChemistryLib/PhreeqcIOData/AqueousSolution.h +++ b/ChemistryLib/PhreeqcIOData/AqueousSolution.h @@ -32,9 +32,13 @@ namespace PhreeqcIOData { struct Component { - explicit Component(std::string name_) : name(std::move(name_)) {} + explicit Component(std::string name_, std::string chemical_formula_) + : name(std::move(name_)), chemical_formula(std::move(chemical_formula_)) + { + } std::string const name; + std::string const chemical_formula; std::unique_ptr<GlobalVector> amount; static const ItemType item_type = ItemType::Component; }; diff --git a/ChemistryLib/PhreeqcIOData/CreateSolutionComponent.cpp b/ChemistryLib/PhreeqcIOData/CreateSolutionComponent.cpp index 44c0fce8422b462bcd12a88f9489c4d39f877ce5..b417c69166bc4e61ff76e1b4a20a27732b4f753c 100644 --- a/ChemistryLib/PhreeqcIOData/CreateSolutionComponent.cpp +++ b/ChemistryLib/PhreeqcIOData/CreateSolutionComponent.cpp @@ -21,13 +21,18 @@ std::vector<Component> createSolutionComponents( { std::vector<Component> components; //! \ogs_file_param{prj__chemical_system__solution__components} - auto comp_config = config.getConfigSubtree("components"); + auto components_config = config.getConfigSubtree("components"); + for ( - auto const& component_name : + auto const& comp_config : //! \ogs_file_param{prj__chemical_system__solution__components__component} - comp_config.getConfigParameterList<std::string>("component")) + components_config.getConfigSubtreeList("component")) { - components.emplace_back(component_name); + auto const component_name = comp_config.getValue<std::string>(); + auto const chemical_formula = + //! \ogs_file_attr{prj__chemical_system__solution__components__component__chemical_formula} + comp_config.getConfigAttribute<std::string>("chemical_formula", ""); + components.emplace_back(component_name, chemical_formula); } return components; diff --git a/Documentation/ProjectFile/prj/chemical_system/solution/components/component/a_chemical_formula.md b/Documentation/ProjectFile/prj/chemical_system/solution/components/component/a_chemical_formula.md new file mode 100644 index 0000000000000000000000000000000000000000..f22938a71a3b7384426d512da2624c5e6a91f54c --- /dev/null +++ b/Documentation/ProjectFile/prj/chemical_system/solution/components/component/a_chemical_formula.md @@ -0,0 +1 @@ +chemical formula alternative to a component when defining water composition. diff --git a/Documentation/ProjectFile/prj/chemical_system/solution/components/component/i_component.md b/Documentation/ProjectFile/prj/chemical_system/solution/components/component/i_component.md new file mode 100644 index 0000000000000000000000000000000000000000..4475bbb6eadb52f54cabd788d51a0661717253a4 --- /dev/null +++ b/Documentation/ProjectFile/prj/chemical_system/solution/components/component/i_component.md @@ -0,0 +1 @@ +define the element in the aqueous solution. diff --git a/Documentation/ProjectFile/prj/chemical_system/solution/components/i_components.md b/Documentation/ProjectFile/prj/chemical_system/solution/components/i_components.md index 0064008382be384c73f27e9adcfb2ec2056f7583..2399ff634d29b238e494d1f68572ca90158fa493 100644 --- a/Documentation/ProjectFile/prj/chemical_system/solution/components/i_components.md +++ b/Documentation/ProjectFile/prj/chemical_system/solution/components/i_components.md @@ -1 +1 @@ -define a list of elements in the initial solution. +define a list of elements in the aqueous solution.