11#include "libmesh/utility.h"
14 Real max_stoichiometric_ionic_strength,
15 bool use_only_basis_molality,
16 bool use_only_Cl_molality)
17 : _max_ionic_strength(max_ionic_strength),
18 _max_stoichiometric_ionic_strength(max_stoichiometric_ionic_strength),
19 _use_only_basis_molality(use_only_basis_molality),
20 _use_only_Cl_molality(use_only_Cl_molality)
26 const std::vector<Real> & basis_species_molality,
27 const std::vector<Real> & eqm_species_molality,
28 const std::vector<Real> & kin_species_molality)
const
33 if (num_basis != basis_species_molality.size())
34 mooseError(
"Ionic strength calculation: Number of basis species in mgd not equal to the size "
35 "of basis_species_molality");
36 if (num_eqm != eqm_species_molality.size())
37 mooseError(
"Ionic strength calculation: Number of equilibrium species in mgd not equal to the "
38 "size of eqm_species_molality");
39 if (num_kin != kin_species_molality.size())
40 mooseError(
"Ionic strength calculation: Number of kinetic species in mgd not equal to the size "
41 "of kin_species_molality");
43 Real ionic_strength = 0.0;
44 for (
unsigned i = 0; i < num_basis; ++i)
48 for (
unsigned i = 0; i < num_eqm; ++i)
51 for (
unsigned i = 0; i < num_kin; ++i)
53 basis_species_molality[0];
63 const std::vector<Real> & basis_species_molality,
64 const std::vector<Real> & eqm_species_molality,
65 const std::vector<Real> & kin_species_molality)
const
70 if (num_basis != basis_species_molality.size())
71 mooseError(
"Stoichiometric ionic strength calculation: Number of basis species in mgd not "
72 "equal to the size of basis_species_molality");
73 if (num_eqm != eqm_species_molality.size())
74 mooseError(
"Stoichiometric ionic strength calculation: Number of equilibrium species in mgd "
75 "not equal to the size of eqm_species_molality");
76 if (num_kin != kin_species_molality.size())
77 mooseError(
"Stoichiometric ionic strength calculation: Number of kinetic species in mgd not "
78 "equal to the size of kin_species_molality");
80 Real ionic_strength = 0.0;
90 mooseError(
"GeochemistryIonicStrength: attempting to compute stoichiometric ionic strength "
91 "using only the Cl- molality, but Cl- does not appear in the geochemical system");
95 for (
unsigned i = 0; i < num_basis; ++i)
99 for (
unsigned i = 0; i < num_eqm; ++i)
107 for (
unsigned j = 0; j < num_basis; ++j)
112 for (
unsigned i = 0; i < num_kin;
116 basis_species_molality[0];
const ModelGeochemicalDatabase mgd
void mooseError(Args &&... args)
Real _max_ionic_strength
maximum ionic strength
Real stoichiometricIonicStrength(const ModelGeochemicalDatabase &mgd, const std::vector< Real > &basis_species_molality, const std::vector< Real > &eqm_species_molality, const std::vector< Real > &kin_species_molality) const
Compute stoichiometric ionic strength.
void setUseOnlyBasisMolality(bool use_only_basis_molality)
Set the value of use_only_basis_molality.
Real getMaxIonicStrength() const
Return the value of maximum ionic strength.
Real getMaxStoichiometricIonicStrength() const
Return the value of maximum stoichiometric ionic strength.
bool _use_only_basis_molality
use only basis molality in the ionic strength calculations
Real ionicStrength(const ModelGeochemicalDatabase &mgd, const std::vector< Real > &basis_species_molality, const std::vector< Real > &eqm_species_molality, const std::vector< Real > &kin_species_molality) const
Compute ionic strength.
Real getUseOnlyClMolality() const
Return the value of use_only_Cl_molality.
void setUseOnlyClMolality(bool use_only_Cl_molality)
Set the value of use_only_Cl_molality.
void setMaxStoichiometricIonicStrength(Real max_stoichiometric_ionic_strength)
Set the maximum stoichiometric ionic strength.
Real getUseOnlyBasisMolality() const
Return the value of use_only_basis_molality.
void setMaxIonicStrength(Real max_ionic_strength)
Set the maximum ionic strength.
bool _use_only_Cl_molality
set the stoichiometric ionic strength to the Cl- molality
Real _max_stoichiometric_ionic_strength
maximum stoichiometric ionic strength
GeochemistryIonicStrength(Real max_ionic_strength, Real max_stoichiometric_ionic_strength, bool use_only_basis_molality, bool use_only_Cl_molality)
Data structure to hold all relevant information from the database file.
DenseMatrix< Real > eqm_stoichiometry
eqm_stoichiometry(i, j) = stoichiometric coefficient for equilibrium species "i" in terms of the basi...
std::vector< Real > basis_species_charge
all quantities have a charge (mineral charge = 0, gas charge = 0, oxide charge = 0)
std::vector< bool > surface_sorption_related
surface_sorption_related[j] = true iff the j^th equilibrium species is involved in surface sorption
std::unordered_map< std::string, unsigned > eqm_species_index
eqm_species_index[name] = index of the equilibrium species (secondary aqueous species,...
std::vector< Real > kin_species_charge
all kinetic quantities have a charge (mineral charge = 0)
std::unordered_map< std::string, unsigned > basis_species_index
basis_species_index[name] = index of the basis species, within all ModelGeochemicalDatabase internal ...
std::unordered_map< std::string, unsigned > kin_species_index
kin_species_index[name] = index of the kinetic species, within all ModelGeochemicalDatabase internal ...
std::vector< Real > eqm_species_charge
all quantities have a charge (mineral charge = 0, gas charge = 0, oxide charge = 0)