Reaktoro  v2.11.0
A unified framework for modeling chemically reactive systems
PhreeqcUtils.hpp
1 // Reaktoro is a unified framework for modeling chemically reactive systems.
2 //
3 // Copyright © 2014-2024 Allan Leal
4 //
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
9 //
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library. If not, see <http://www.gnu.org/licenses/>.
17 
18 #pragma once
19 
20 // Reaktoro includes
21 #include <Reaktoro/Common/Matrix.hpp>
22 #include <Reaktoro/Common/Types.hpp>
23 #include <Reaktoro/Core/AggregateState.hpp>
24 
25 // Phreeqc includes
26 #include <Reaktoro/Extensions/Phreeqc/PhreeqcLegacy.hpp>
27 
28 //==================================================
29 // WARNING WARNING WARNING WARNING WARNING WARNING
30 //==================================================
31 // This header file must not be included by another
32 // header file that will be exposed to users.
33 // If so, this propagates the need for phreeqc
34 // header files to available in the user system.
35 //==================================================
36 
37 namespace Reaktoro {
38 namespace PhreeqcUtils {
39 
44 auto load(PHREEQC& phreeqc, String database) -> void;
45 
51 auto execute(PHREEQC& phreeqc, String input, String output) -> void;
52 
57 auto findElement(const PHREEQC& phreeqc, String name) -> PhreeqcElement*;
58 
63 auto findSpecies(const PHREEQC& phreeqc, String name) -> PhreeqcSpecies*;
64 
69 auto findPhase(const PHREEQC& phreeqc, String name) -> PhreeqcPhase*;
70 
72 auto isAqueousSpecies(const PhreeqcSpecies* species) -> bool;
73 
75 auto isGaseousSpecies(const PhreeqcPhase* phase) -> bool;
76 
78 auto isMineralSpecies(const PhreeqcPhase* phase) -> bool;
79 
81 auto isExchangeSpecies(const PhreeqcSpecies* species) -> bool;
82 
84 auto isSurfaceSpecies(const PhreeqcSpecies* species) -> bool;
85 
88 auto symbol(const PhreeqcElement* species) -> String;
89 
92 auto name(const PhreeqcElement* species) -> String;
93 
96 auto molarMass(const PhreeqcElement* species) -> double;
97 
100 auto name(const PhreeqcPhase* phase) -> String;
101 
104 auto name(const PhreeqcSpecies* species) -> String;
105 
108 auto name(const PhreeqcPhase* phase) -> String;
109 
112 auto formula(const PhreeqcSpecies* species) -> String;
113 
116 auto formula(const PhreeqcPhase* phase) -> String;
117 
120 auto elements(const PhreeqcSpecies* species) -> Map<PhreeqcElement*, double>;
121 
124 auto elements(const PhreeqcPhase* phase) -> Map<PhreeqcElement*, double>;
125 
128 auto charge(const PhreeqcSpecies* species) -> double;
129 
132 auto charge(const PhreeqcPhase* phase) -> double;
133 
136 auto aggregateState(const PhreeqcSpecies* species) -> AggregateState;
137 
140 auto aggregateState(const PhreeqcPhase* phase) -> AggregateState;
141 
145 auto stoichiometry(const PhreeqcSpecies* species, String name) -> double;
146 
150 auto stoichiometry(const PhreeqcPhase* phase, String name) -> double;
151 
156 auto reactionEquation(const PhreeqcSpecies* species) -> Pairs<String, double>;
157 
161 auto reactionEquation(const PhreeqcPhase* phase) -> Pairs<String, double>;
162 
168 auto reactants(const PhreeqcSpecies* species) -> Pairs<PhreeqcSpecies*, double>;
169 
175 auto reactants(const PhreeqcPhase* phase) -> Pairs<PhreeqcSpecies*, double>;
176 
179 auto isMasterSpecies(const PhreeqcSpecies* species) -> bool;
180 
183 auto isMasterSpecies(const PhreeqcPhase* phase) -> bool;
184 
188 auto index(String name, const Vec<PhreeqcSpecies*>& species) -> std::size_t;
189 
193 auto index(String name, const Vec<PhreeqcPhase*>& phases) -> std::size_t;
194 
197 auto activeAqueousSpecies(const PHREEQC& phreeqc) -> Vec<PhreeqcSpecies*>;
198 
200 auto activeExchangeSpecies(const PHREEQC& phreeqc) -> Vec<PhreeqcSpecies*>;
201 
205 auto activeProductSpecies(const PHREEQC& phreeqc) -> Vec<PhreeqcSpecies*>;
206 
209 auto activeGaseousSpecies(const PHREEQC& phreeqc) -> Vec<PhreeqcPhase*>;
210 
213 auto activePhasesInEquilibriumPhases(const PHREEQC& phreeqc) -> Vec<PhreeqcPhase*>;
214 
217 auto activePhasesInSaturationList(const PHREEQC& phreeqc) -> Vec<PhreeqcPhase*>;
218 
222 auto speciesAmounts(const PHREEQC& phreeqc, const Vec<PhreeqcSpecies*>& species) -> ArrayXd;
223 
227 auto speciesAmounts(const PHREEQC& phreeqc, const Vec<PhreeqcPhase*>& phases) -> ArrayXd;
228 
229 } // namespace PhreeqcUtils
230 } // namespace Reaktoro
The namespace containing all components of the Reaktoro library.
Definition: Algorithms.hpp:29
AggregateState
The aggregate states of substances according to IUPAC.
Definition: AggregateState.hpp:32
std::string String
Convenient alias for std::string.
Definition: Types.hpp:52
auto index(const Container &c, const T &x) -> std::size_t
Return the index of item x in container c or the number of items if not found.
Definition: Algorithms.hpp:37
Eigen::ArrayXd ArrayXd
Convenient alias to Eigen type.
Definition: Matrix.hpp:103