16 _numT(
db.getTemperatures().size()),
17 _database_dh_params(
db.getDebyeHuckel()),
18 _database_dh_water((
db.getNeutralSpeciesActivity().
count(
"h2o") == 1)
19 ?
db.getNeutralSpeciesActivity().at(
"h2o")
21 _database_dh_neutral((
db.getNeutralSpeciesActivity().
count(
"co2") == 1)
22 ?
db.getNeutralSpeciesActivity().at(
"co2")
24 _is_calculator(is_calculator),
26 _sqrt_ionic_strength(1.0),
27 _stoichiometric_ionic_strength(1.0),
31 _interp_A(
db.getTemperatures(),
32 (_database_dh_params.adh.size() == _numT) ? _database_dh_params.adh
33 :
std::vector<Real>(_numT, 0.0),
35 _interp_B(
db.getTemperatures(),
36 (_database_dh_params.bdh.size() == _numT) ? _database_dh_params.bdh
37 :
std::vector<Real>(_numT, 0.0),
39 _interp_Bdot(
db.getTemperatures(),
40 (_database_dh_params.bdot.size() == _numT) ? _database_dh_params.bdot
41 :
std::vector<Real>(_numT, 0.0),
43 _interp_a_water(
db.getTemperatures(),
44 (_database_dh_water.
a.size() == _numT) ? _database_dh_water.
a
45 :
std::vector<Real>(_numT, 0.0),
47 _interp_b_water(
db.getTemperatures(),
48 (_database_dh_water.
b.size() == _numT) ? _database_dh_water.
b
49 :
std::vector<Real>(_numT, 0.0),
51 _interp_c_water(
db.getTemperatures(),
52 (_database_dh_water.
c.size() == _numT) ? _database_dh_water.
c
53 :
std::vector<Real>(_numT, 0.0),
55 _interp_d_water(
db.getTemperatures(),
56 (_database_dh_water.
d.size() == _numT) ? _database_dh_water.
d
57 :
std::vector<Real>(_numT, 0.0),
59 _interp_a_neutral(
db.getTemperatures(),
60 (_database_dh_neutral.
a.size() == _numT) ? _database_dh_neutral.
a
61 :
std::vector<Real>(_numT, 0.0),
63 _interp_b_neutral(
db.getTemperatures(),
64 (_database_dh_neutral.
b.size() == _numT) ? _database_dh_neutral.
b
65 :
std::vector<Real>(_numT, 0.0),
67 _interp_c_neutral(
db.getTemperatures(),
68 (_database_dh_neutral.
c.size() == _numT) ? _database_dh_neutral.
c
69 :
std::vector<Real>(_numT, 0.0),
71 _interp_d_neutral(
db.getTemperatures(),
72 (_database_dh_neutral.
d.size() == _numT) ? _database_dh_neutral.
d
73 :
std::vector<Real>(_numT, 0.0),
93 const std::vector<Real> & basis_species_molality,
94 const std::vector<Real> & eqm_species_molality,
95 const std::vector<Real> & kin_species_molality)
98 mgd, basis_species_molality, eqm_species_molality, kin_species_molality);
101 mgd, basis_species_molality, eqm_species_molality, kin_species_molality);
136 std::vector<Real> & basis_activity_coef,
137 std::vector<Real> & eqm_activity_coef)
const
142 for (
unsigned basis_i = 1; basis_i <
_num_basis; ++basis_i)
147 basis_activity_coef[basis_i] = std::pow(
154 basis_activity_coef[basis_i] =
161 basis_activity_coef[basis_i] = 1.0;
165 basis_activity_coef[basis_i] = 1.0;
169 basis_activity_coef[basis_i] = std::pow(
179 for (
unsigned eqm_j = 0; eqm_j <
_num_eqm; ++eqm_j)
184 eqm_activity_coef[eqm_j] = std::pow(
191 eqm_activity_coef[eqm_j] =
198 eqm_activity_coef[eqm_j] = 1.0;
202 eqm_activity_coef[eqm_j] = 1.0;
206 eqm_activity_coef[eqm_j] = std::pow(
const ModelGeochemicalDatabase mgd
const GeochemicalDatabaseReader db("database/moose_testdb.json", true, true, false)
virtual Real sample(Real T) override
Class for reading geochemical reactions from a MOOSE geochemical database.
unsigned _num_basis
number of basis species
Real _sqrt_ionic_strength
current value of sqrt(ionic strength)
EquilibriumConstantInterpolator _interp_b_neutral
Interpolator object for the Debye-Huckel parameter b_neutral.
Real _ionic_strength
current value of ionic strength
const GeochemistryIonicStrength & _is_calculator
ionic-strength calculator
const DebyeHuckelParameters & getDebyeHuckel() const
EquilibriumConstantInterpolator _interp_d_water
Interpolator object for the Debye-Huckel parameter d_water.
EquilibriumConstantInterpolator _interp_Bdot
Interpolator object for the Debye-Huckel parameter Bdot.
EquilibriumConstantInterpolator _interp_a_neutral
Interpolator object for the Debye-Huckel parameter a_neutral.
EquilibriumConstantInterpolator _interp_b_water
Interpolator object for the Debye-Huckel parameter b_water.
EquilibriumConstantInterpolator _interp_c_neutral
Interpolator object for the Debye-Huckel parameter c_neutral.
EquilibriumConstantInterpolator _interp_d_neutral
Interpolator object for the Debye-Huckel parameter d_neutral.
Real getStoichiometricIonicStrength() const
Return the current value of stoichiometric ionic strength.
EquilibriumConstantInterpolator _interp_B
Interpolator object for the Debye-Huckel parameter B.
void setInternalParameters(Real temperature, const ModelGeochemicalDatabase &mgd, const std::vector< Real > &basis_species_molality, const std::vector< Real > &eqm_species_molality, const std::vector< Real > &kin_species_molality) override
Sets internal parameters, such as the ionic strength and Debye-Huckel parameters, prior to computing ...
DebyeHuckelParameters _dh
Debye-Huckel parameters.
Real _stoichiometric_ionic_strength
current value of stoichiometric ionic strength
EquilibriumConstantInterpolator _interp_A
Interpolator object for the Debye-Huckel parameter A.
unsigned _num_eqm
number of equilibrium species
void buildActivityCoefficients(const ModelGeochemicalDatabase &mgd, std::vector< Real > &basis_activity_coef, std::vector< Real > &eqm_activity_coef) const override
Compute the activity coefficients and store them in basis_activity_coef and eqm_activity_coef Note:
EquilibriumConstantInterpolator _interp_c_water
Interpolator object for the Debye-Huckel parameter c_water.
Real getIonicStrength() const
Return the current value of ionic strength.
GeochemistryActivityCoefficientsDebyeHuckel(const GeochemistryIonicStrength &is_calculator, const GeochemicalDatabaseReader &db)
Real waterActivity() const override
Computes and returns the activity of water.
EquilibriumConstantInterpolator _interp_a_water
Interpolator object for the Debye-Huckel parameter a_water.
Base class to compute activity coefficients for non-minerals and non-gases (since these species do no...
Calculators to compute ionic strength and stoichiometric 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.
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 log10ActCoeffDHBdot(Real charge, Real ion_size, Real sqrt_ionic_strength, Real A, Real B, Real Bdot)
log10(activity coefficient) according to the Debye-Huckel B-dot model
Real log10ActCoeffDHBdotAlternative(Real ionic_strength, Real Bdot)
log10(activity coefficient) alternative expression that is sometimes used in conjunction with the Deb...
Real log10ActCoeffDHBdotNeutral(Real ionic_strength, Real a, Real b, Real c, Real d)
log10(activity coefficient) for neutral species according to the Debye-Huckel B-dot model
Real lnActivityDHBdotWater(Real stoichiometric_ionic_strength, Real A, Real atilde, Real btilde, Real ctilde, Real dtilde)
ln(activity of water) according to the Debye-Huckel B-dot model
Data structure for neutral species activity coefficients.
Data structure to hold all relevant information from the database file.
std::vector< bool > eqm_species_mineral
eqm_species_mineral[i] = true iff the i^th equilibrium species is a mineral
std::vector< Real > eqm_species_radius
all quantities have an ionic radius (Angstrom) for computing activity (mineral radius = 0,...
std::vector< Real > basis_species_radius
all quantities have an ionic radius (Angstrom) for computing activity (mineral radius = 0,...
std::vector< Real > basis_species_charge
all quantities have a charge (mineral charge = 0, gas charge = 0, oxide charge = 0)
std::vector< bool > basis_species_mineral
basis_species_mineral[j] = true iff the j^th basis species is a mineral
std::unordered_map< std::string, unsigned > eqm_species_index
eqm_species_index[name] = index of the equilibrium species (secondary aqueous species,...
std::unordered_map< std::string, unsigned > basis_species_index
basis_species_index[name] = index of the basis species, within all ModelGeochemicalDatabase internal ...
std::vector< bool > basis_species_gas
basis_species_gas[j] = true iff the j^th basis species is a gas
std::vector< Real > eqm_species_charge
all quantities have a charge (mineral charge = 0, gas charge = 0, oxide charge = 0)
std::vector< bool > eqm_species_gas
eqm_species_gas[i] = true iff the i^th equilibrium species is a gas