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];
std::vector< bool > surface_sorption_related
surface_sorption_related[j] = true iff the j^th equilibrium species is involved in surface sorption ...
Real getMaxStoichiometricIonicStrength() const
Return the value of maximum stoichiometric ionic strength.
std::vector< Real > kin_species_charge
all kinetic quantities have a charge (mineral charge = 0)
GeochemistryIonicStrength(Real max_ionic_strength, Real max_stoichiometric_ionic_strength, bool use_only_basis_molality, bool use_only_Cl_molality)
Real getUseOnlyBasisMolality() const
Return the value of use_only_basis_molality.
Real getUseOnlyClMolality() const
Return the value of use_only_Cl_molality.
Real _max_ionic_strength
maximum ionic strength
void mooseError(Args &&... args)
std::unordered_map< std::string, unsigned > basis_species_index
basis_species_index[name] = index of the basis species, within all ModelGeochemicalDatabase internal ...
const ModelGeochemicalDatabase mgd
void setMaxIonicStrength(Real max_ionic_strength)
Set the maximum ionic strength.
std::unordered_map< std::string, unsigned > eqm_species_index
eqm_species_index[name] = index of the equilibrium species (secondary aqueous species, redox couples in equilibrium with the aqueous solution, minerals in equilibrium with the aqueous solution, gases in equilibrium with the aqueous solution) within all ModelGeochemicalDatabase internal datastrcutres, with given name
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.
std::unordered_map< std::string, unsigned > kin_species_index
kin_species_index[name] = index of the kinetic species, within all ModelGeochemicalDatabase internal ...
void setUseOnlyBasisMolality(bool use_only_basis_molality)
Set the value of use_only_basis_molality.
DenseMatrix< Real > eqm_stoichiometry
eqm_stoichiometry(i, j) = stoichiometric coefficient for equilibrium species "i" in terms of the basi...
void setUseOnlyClMolality(bool use_only_Cl_molality)
Set the value of use_only_Cl_molality.
Real getMaxIonicStrength() const
Return the value of maximum ionic strength.
Real _max_stoichiometric_ionic_strength
maximum stoichiometric ionic strength
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void setMaxStoichiometricIonicStrength(Real max_stoichiometric_ionic_strength)
Set the maximum stoichiometric ionic strength.
std::vector< Real > basis_species_charge
all quantities have a charge (mineral charge = 0, gas charge = 0, oxide charge = 0) ...
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.
bool _use_only_basis_molality
use only basis molality in the ionic strength calculations
std::vector< Real > eqm_species_charge
all quantities have a charge (mineral charge = 0, gas charge = 0, oxide charge = 0) ...
Data structure to hold all relevant information from the database file.
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
bool _use_only_Cl_molality
set the stoichiometric ionic strength to the Cl- molality