This class holds information about bulk composition, molalities, activities, activity coefficients, etc of the user-defined geochemical system in PertinentGeochemicalSystem. More...
#include <GeochemicalSystem.h>
Public Types | |
enum | ConstraintMeaningEnum { ConstraintMeaningEnum::MOLES_BULK_WATER, ConstraintMeaningEnum::KG_SOLVENT_WATER, ConstraintMeaningEnum::MOLES_BULK_SPECIES, ConstraintMeaningEnum::FREE_MOLALITY, ConstraintMeaningEnum::FREE_MOLES_MINERAL_SPECIES, ConstraintMeaningEnum::FUGACITY, ConstraintMeaningEnum::ACTIVITY } |
Each basis species has one of the following constraints. More... | |
enum | ConstraintUserMeaningEnum { ConstraintUserMeaningEnum::KG_SOLVENT_WATER, ConstraintUserMeaningEnum::BULK_COMPOSITION, ConstraintUserMeaningEnum::BULK_COMPOSITION_WITH_KINETIC, ConstraintUserMeaningEnum::FREE_CONCENTRATION, ConstraintUserMeaningEnum::FREE_MINERAL, ConstraintUserMeaningEnum::ACTIVITY, ConstraintUserMeaningEnum::LOG10ACTIVITY, ConstraintUserMeaningEnum::FUGACITY, ConstraintUserMeaningEnum::LOG10FUGACITY } |
Each basis species must be provided with a constraint, that is chosen by the user from the following enum. More... | |
Public Member Functions | |
GeochemicalSystem (ModelGeochemicalDatabase &mgd, GeochemistryActivityCoefficients &gac, GeochemistryIonicStrength &is, GeochemistrySpeciesSwapper &swapper, const std::vector< std::string > &swap_out_of_basis, const std::vector< std::string > &swap_into_basis, const std::string &charge_balance_species, const std::vector< std::string > &constrained_species, const std::vector< Real > &constraint_value, const MultiMooseEnum &constraint_unit, const MultiMooseEnum &constraint_user_meaning, Real initial_temperature, unsigned iters_to_make_consistent, Real min_initial_molality, const std::vector< std::string > &kin_name, const std::vector< Real > &kin_initial_moles, const MultiMooseEnum &kin_unit) | |
Construct the geochemical system, check consistency of the constructor's arguments, and initialize all internal variables (molalities, bulk compositions, equilibrium constants, activities, activity coefficients, surface potentials and kinetic mole numbers) and set up the algebraic system More... | |
GeochemicalSystem (ModelGeochemicalDatabase &mgd, GeochemistryActivityCoefficients &gac, GeochemistryIonicStrength &is, GeochemistrySpeciesSwapper &swapper, const std::vector< std::string > &swap_out_of_basis, const std::vector< std::string > &swap_into_basis, const std::string &charge_balance_species, const std::vector< std::string > &constrained_species, const std::vector< Real > &constraint_value, const std::vector< GeochemistryUnitConverter::GeochemistryUnit > &constraint_unit, const std::vector< ConstraintUserMeaningEnum > &constraint_user_meaning, Real initial_temperature, unsigned iters_to_make_consistent, Real min_initial_molality, const std::vector< std::string > &kin_name, const std::vector< Real > &kin_initial, const std::vector< GeochemistryUnitConverter::GeochemistryUnit > &kin_unit) | |
GeochemicalSystem & | operator= (const GeochemicalSystem &src) |
Copy assignment operator. More... | |
GeochemicalSystem (const GeochemicalSystem &src)=default | |
Copy constructor. More... | |
bool | operator== (const GeochemicalSystem &rhs) const |
unsigned | getNumInBasis () const |
returns the number of species in the basis More... | |
unsigned | getNumInEquilibrium () const |
returns the number of species in equilibrium with the basis components More... | |
unsigned | getNumKinetic () const |
returns the number of kinetic species More... | |
void | initialize () |
initialize all variables, ready for a Newton solve of the algebraic system More... | |
unsigned | getChargeBalanceBasisIndex () const |
return the index of the charge-balance species in the basis list More... | |
bool | alterChargeBalanceSpecies (Real threshold_molality) |
If the molality of the charge-balance basis species is less than threshold molality, then attempt to change the charge-balance species, preferably to another component with opposite charge and big molality. More... | |
Real | getLog10K (unsigned j) const |
unsigned | getNumRedox () const |
Real | getRedoxLog10K (unsigned red) const |
Real | log10RedoxActivityProduct (unsigned red) const |
Real | getKineticLog10K (unsigned kin) const |
const std::vector< Real > & | getKineticLog10K () const |
Real | log10KineticActivityProduct (unsigned kin) const |
Real | getKineticMoles (unsigned kin) const |
void | setKineticMoles (unsigned kin, Real moles) |
Sets the current AND old mole number for a kinetic species. More... | |
const std::vector< Real > & | getKineticMoles () const |
void | updateOldWithCurrent (const DenseVector< Real > &mole_additions) |
Usually used at the end of a solve, to provide correct initial conditions to the next time-step, this method: More... | |
unsigned | getNumInAlgebraicSystem () const |
unsigned | getNumBasisInAlgebraicSystem () const |
return the number of basis species in the algebraic system More... | |
unsigned | getNumSurfacePotentials () const |
return the number of surface potentials More... | |
const std::vector< bool > & | getInAlgebraicSystem () const |
const std::vector< unsigned > & | getBasisIndexOfAlgebraicSystem () const |
More... | |
const std::vector< unsigned > & | getAlgebraicIndexOfBasisSystem () const |
std::vector< Real > | getAlgebraicVariableValues () const |
std::vector< Real > | getAlgebraicBasisValues () const |
DenseVector< Real > | getAlgebraicVariableDenseValues () const |
Real | getSolventWaterMass () const |
Returns the mass of solvent water. More... | |
const std::vector< Real > & | getBulkMolesOld () const |
DenseVector< Real > | getBulkOldInOriginalBasis () const |
DenseVector< Real > | getTransportedBulkInOriginalBasis () const |
void | computeTransportedBulkFromMolalities (std::vector< Real > &transported_bulk) const |
Computes the value of transported bulk moles for all basis species using the existing molalities. More... | |
const std::vector< Real > & | getSolventMassAndFreeMolalityAndMineralMoles () const |
const std::vector< bool > & | getBasisActivityKnown () const |
Real | getBasisActivity (unsigned i) const |
const std::vector< Real > & | getBasisActivity () const |
Real | getEquilibriumMolality (unsigned j) const |
const std::vector< Real > & | getEquilibriumMolality () const |
Real | getBasisActivityCoefficient (unsigned i) const |
const std::vector< Real > & | getBasisActivityCoefficient () const |
Real | getEquilibriumActivityCoefficient (unsigned j) const |
const std::vector< Real > & | getEquilibriumActivityCoefficient () const |
Real | getTotalChargeOld () const |
Real | getResidualComponent (unsigned algebraic_ind, const DenseVector< Real > &mole_additions) const |
Return the residual of the algebraic system for the given algebraic index. More... | |
const ModelGeochemicalDatabase & | getModelGeochemicalDatabase () const |
void | setModelGeochemicalDatabase (const ModelGeochemicalDatabase &mgd) |
Copies a ModelGeochemicalDatabase into our _mgd structure. More... | |
void | computeJacobian (const DenseVector< Real > &res, DenseMatrix< Real > &jac, const DenseVector< Real > &mole_additions, const DenseMatrix< Real > &dmole_additions) const |
Compute the Jacobian for the algebraic system and put it in jac. More... | |
void | setAlgebraicVariables (const DenseVector< Real > &algebraic_var) |
Set the variables in the algebraic system (molalities and potentially the mass of solvent water, and surface potentials, and kinetic mole numbers if any) to algebraic_var. More... | |
void | enforceChargeBalance () |
Enforces charge balance by altering the constraint_value and bulk_moles_old of the charge-balance species. More... | |
bool | revertToOriginalChargeBalanceSpecies () |
Changes the charge-balance species to the original that is specified in the constructor (this might not be possible since the original charge-balance species might have been swapped out) More... | |
std::vector< Real > | getSaturationIndices () const |
void | performSwap (unsigned swap_out_of_basis, unsigned swap_into_basis) |
Perform the basis swap, and ensure that the resulting system is consistent. More... | |
Real | getIonicStrength () const |
Get the ionic strength. More... | |
Real | getStoichiometricIonicStrength () const |
Get the stoichiometric ionic strength. More... | |
Real | getSurfacePotential (unsigned sp) const |
Real | getSurfaceCharge (unsigned sp) const |
const std::vector< Real > & | getSorbingSurfaceArea () const |
Real | getTemperature () const |
void | setTemperature (Real temperature) |
Sets the temperature to the given quantity. More... | |
void | setSolventMassAndFreeMolalityAndMineralMolesAndSurfacePotsAndKineticMoles (const std::vector< std::string > &names, const std::vector< Real > &values, const std::vector< bool > &constraints_from_molalities) |
Sets: More... | |
const std::vector< GeochemicalSystem::ConstraintMeaningEnum > & | getConstraintMeaning () const |
void | closeSystem () |
Changes a KG_SOLVENT_WATER constraint to MOLES_BULK_WATER (if there is such a constraint) and all FREE_MOLALITY and FREE_MOLES_MINERAL_SPECIES to MOLES_BULK_SPECIES using the current values of _bulk_moles_old. More... | |
void | changeConstraintToBulk (unsigned basis_ind) |
Changes the constraint to MOLES_BULK_SPECIES (or MOLES_BULK_WATER if basis_ind = 0) for the basis index. More... | |
void | changeConstraintToBulk (unsigned basis_ind, Real value) |
Changes the constraint to MOLES_BULK_SPECIES (or MOLES_BULK_WATER if basis_ind = 0) for the basis index. More... | |
void | addToBulkMoles (unsigned basis_ind, Real value) |
Add to the MOLES_BULK_SPECIES (or MOLES_BULK_WATER if basis_ind = 0) for the basis species. More... | |
void | setConstraintValue (unsigned basis_ind, Real value) |
Set the constraint value for the basis species. More... | |
void | computeConsistentConfiguration () |
Compute a reasonably consistent configuration that can be used as an initial condition in a Newton process to solve the algebraic system. More... | |
const std::string & | getOriginalRedoxLHS () const |
void | performSwapNoCheck (unsigned swap_out_of_basis, unsigned swap_into_basis) |
Perform the basis swap, and ensure that the resulting system is consistent. More... | |
const GeochemistrySpeciesSwapper & | getSwapper () const |
void | setMineralRelatedFreeMoles (Real value) |
Set the free mole number of mineral-related species to the value provided. More... | |
const std::vector< Real > & | computeAndGetEquilibriumActivity () |
Computes activity for all equilibrium species (_eqm_activity) and returns a reference to the vector. More... | |
Real | getEquilibriumActivity (unsigned eqm_ind) const |
Returns the value of activity for the equilibrium species with index eqm_index. More... | |
void | addKineticRates (Real dt, DenseVector< Real > &mole_additions, DenseMatrix< Real > &dmole_additions) |
Computes the kinetic rates and their derivatives based on the current values of molality, mole number, etc, and then, using dt, calculates the appropriate mole_additions and dmole_additions. More... | |
Private Member Functions | |
void | buildTemperatureDependentQuantities (Real temperature) |
Using the provided value of temperature, build _eqm_log10K for each eqm species and redox species. More... | |
void | buildAlgebraicInfo (std::vector< bool > &in_algebraic_system, unsigned &num_basis_in_algebraic_system, unsigned &num_in_algebraic_system, std::vector< unsigned > &algebraic_index, std::vector< unsigned > &basis_index) const |
Builds in_algebraic_system, algebraic_index and basis_index, and sets num_basis_in_algebraic_system appropriately. More... | |
void | initBulkAndFree (std::vector< Real > &bulk_moles_old, std::vector< Real > &basis_molality) const |
based on _constrained_value and _constraint_meaning, populate nw, bulk_moles_old and basis_molality with reasonable initial conditions that may be used during the Newton solve of the algebraic system More... | |
void | buildKnownBasisActivities (std::vector< bool > &basis_activity_known, std::vector< Real > &basis_activity) const |
Fully populates basis_activity_known, which is true if activity has been set by the user, or the fugacity has been set by the user, or the basis species is a mineral. More... | |
void | computeRemainingBasisActivities (std::vector< Real > &basis_activity) const |
Compute the activity of water and put in basis_activity[0], and use the _basis_activity_coef and _basis_molality to compute the remaining basis activities (for those that are not minerals, gases or aqueous species provided with an activity) More... | |
void | updateBasisMolalityForKnownActivity (std::vector< Real > &basis_molality) const |
For basis aqueous species (not water, minerals or gases) with activity set by the user, set basis_molality = activity / activity_coefficient. More... | |
Real | log10ActivityProduct (unsigned eqm_j) const |
void | computeEqmMolalities (std::vector< Real > &eqm_molality) const |
compute the equilibrium molalities (not for minerals or gases) More... | |
void | enforceChargeBalanceIfSimple (std::vector< Real > &constraint_value, std::vector< Real > &bulk_moles_old) const |
If all non-charged basis species are provided with a bulk number of moles, alter the bulk number of moles (old) of the charge_balance_species so that charges are balanced. More... | |
void | computeBulk (std::vector< Real > &bulk_moles_old) const |
Computes the value of bulk_moles_old for all basis species. More... | |
void | enforceChargeBalance (std::vector< Real > &constraint_value, std::vector< Real > &bulk_moles_old) const |
Enforces charge balance by altering the constraint_value and bulk_moles_old of the charge-balance species. More... | |
void | computeFreeMineralMoles (std::vector< Real > &basis_molality) const |
Compute the free mineral moles (ie, basis_molality for basis species that are minerals), using the bulk_moles_old. More... | |
void | checkAndInitialize (const std::vector< std::string > &kin_name, const std::vector< Real > &kin_initial, const std::vector< GeochemistryUnitConverter::GeochemistryUnit > &kin_unit) |
Used during construction: checks for sane inputs and initializes molalities, etc, using the initialize() method. More... | |
void | setChargeBalanceSpecies (unsigned new_charge_balance_index) |
Set the charge-balance species to the basis index provided. More... | |
Real | surfaceSorptionModifier (unsigned eqm_j) const |
Real | surfacePotPrefactor (unsigned sp) const |
void | computeSorbingSurfaceArea (std::vector< Real > &sorbing_surface_area) const |
Compute sorbing_surface_area depending on the current molality of the sorbing minerals. More... | |
Real | computeBulkFromMolalities (unsigned basis_ind) const |
void | alterSystemBecauseBulkChanged () |
Alter the GeochemicalSystem to reflect changes in bulk composition constraints that occur through, for instance, setConstraintValue or addToBulkMoles or changeConstraintToBulk (the latter because charge neutrality might be easily enforced, changing constraints and hence bulk moles). More... | |
Private Attributes | |
ModelGeochemicalDatabase & | _mgd |
The minimal geochemical database. More... | |
const unsigned | _num_basis |
number of basis species More... | |
const unsigned | _num_eqm |
number of equilibrium species More... | |
const unsigned | _num_redox |
number of redox species More... | |
const unsigned | _num_surface_pot |
number of surface potentials More... | |
const unsigned | _num_kin |
number of kinetic species More... | |
GeochemistrySpeciesSwapper & | _swapper |
swapper that can swap species into and out of the basis More... | |
const std::vector< std::string > | _swap_out |
Species to immediately remove from the basis in favor of _swap_in. More... | |
const std::vector< std::string > | _swap_in |
Species to immediately add to the basis in favor of _swap_out. More... | |
GeochemistryActivityCoefficients & | _gac |
Object to compute the activity coefficients and activity of water. More... | |
GeochemistryIonicStrength & | _is |
Object that provides the ionic strengths. More... | |
std::string | _charge_balance_species |
The species used to enforce charge balance. More... | |
const std::string | _original_charge_balance_species |
The species used to enforce charge balance, as provided in the constructor. More... | |
unsigned | _charge_balance_basis_index |
The index in the list of basis species corresponding to the charge-balance species. This gets altered as the simulation progresses, due to swaps, and alterChargeBalanceSpecies. More... | |
std::vector< std::string > | _constrained_species |
Names of the species in that have their values fixed to _constraint_value with meanings _constraint_meaning. In the constructor, this is ordered to have the same ordering as the basis species. More... | |
std::vector< Real > | _constraint_value |
Numerical values of the constraints on _constraint_species. In the constructor, this is ordered to have the same ordering as the basis species. More... | |
std::vector< Real > | _original_constraint_value |
Numerical values of the constraints on _constraint_species. In the constructor, this is ordered to have the same ordering as the basis species. Since values can change due to charge-balance, this holds the original values set by the user. More... | |
std::vector< GeochemistryUnitConverter::GeochemistryUnit > | _constraint_unit |
Units of the _constraint_value when the GeochemicalSystem is constructed. This is used during the constructor to convert the constraint_values into mole units. More... | |
std::vector< ConstraintUserMeaningEnum > | _constraint_user_meaning |
The user-defined meaning of the values in _constraint_value. In the constructor, this is ordered to have the same ordering as the basis species. During the process of unit conversion, from the user-supplied _constraint_unit, to mole-based units, _constraint_user_meaning is used to populate _constraint_meaning, and henceforth usually only _constraint_meaning is used in the code. More... | |
std::vector< ConstraintMeaningEnum > | _constraint_meaning |
The meaning of the values in _constraint_value. In the constructor, this is ordered to have the same ordering as the basis species. More... | |
std::vector< Real > | _eqm_log10K |
equilibrium constant of the equilibrium species More... | |
std::vector< Real > | _redox_log10K |
equilibrium constant of the redox species More... | |
std::vector< Real > | _kin_log10K |
equilibrium constant of the kinetic species More... | |
unsigned | _num_basis_in_algebraic_system |
number of unknown molalities in the algebraic system. Note: surface potentials (if any) are extra quantities in the algebraic system More... | |
unsigned | _num_in_algebraic_system |
number of unknowns in the algebraic system (includes molalities and surface potentials) More... | |
std::vector< bool > | _in_algebraic_system |
if _in_algebraic_system[i] == true then we need to solve for the i^th basis-species molality More... | |
std::vector< unsigned > | _algebraic_index |
_algebraic_index[i] = index in the algebraic system of the basis species i. _basis_index[_algebraic_index[i]] = i More... | |
std::vector< unsigned > | _basis_index |
_basis_index[i] = index in the basis of the algebraic system species i, for i<num_basis_in_algebraic_system. _basis_index[_algebraic_index[i]] == i More... | |
std::vector< Real > | _bulk_moles_old |
Number of bulk moles of basis species (this includes contributions from kinetic species, in contrast to Bethke) More... | |
std::vector< Real > | _basis_molality |
IMPORTANT: this is. More... | |
std::vector< bool > | _basis_activity_known |
whether basis_activity[i] is fixed by the user More... | |
std::vector< Real > | _basis_activity |
values of activity (for water, minerals and aqueous basis species) or fugacity (for gases) More... | |
std::vector< Real > | _eqm_molality |
molality of equilibrium species More... | |
std::vector< Real > | _basis_activity_coef |
basis activity coefficients More... | |
std::vector< Real > | _eqm_activity_coef |
equilibrium activity coefficients More... | |
std::vector< Real > | _eqm_activity |
equilibrium activities. More... | |
std::vector< Real > | _surface_pot_expr |
surface potential expressions. More... | |
std::vector< Real > | _sorbing_surface_area |
surface areas of the sorbing minerals More... | |
std::vector< Real > | _kin_moles |
mole number of kinetic species More... | |
std::vector< Real > | _kin_moles_old |
old mole number of kinetic species More... | |
unsigned | _iters_to_make_consistent |
Iterations to make the initial configuration consistent. More... | |
Real | _temperature |
The temperature in degC. More... | |
Real | _min_initial_molality |
Minimum molality ever used in an initial guess. More... | |
std::string | _original_redox_lhs |
The left-hand-side of the redox equations in _mgd after initial swaps. More... | |
This class holds information about bulk composition, molalities, activities, activity coefficients, etc of the user-defined geochemical system in PertinentGeochemicalSystem.
Hence, it extends the generic information in PertinentGeochemicalSystem to a system that is specific to one spatio-temporal location. It offers methods to manipulate these molalities, bulk compositions, etc, as well as performing basis swaps.
Related to this, this class also builds the so-called "algebraic system" which is the nonlinear system of algebraic equations for the unknown basis molalities, surface potentials and mole number of kinetic species, and computes the residual vector and jacobian of this algebraic system. This class initialises the algebraic variables (the unknown molalities, surface potentials and kinetic moles) to reaponable values, but it does not solve the algebraic system: instead, it has a "setter" method, setAlgebraicValues that can be used to set the unknowns, hence another class can use whatever method it desires to solve the system.
WARNING: because GeochemicalSystem performs swaps, it will change the ModelGeochemicalDatabase object. WARNING: because GeochemicalSystem sets internal parameters in the activity-coefficient object, it will change the GeochemistryActivityCoefficient object.
Definition at line 39 of file GeochemicalSystem.h.
|
strong |
Each basis species has one of the following constraints.
During the process of units conversion (from user-prescribed units to mole-based units) each ConstraintMeaningUserEnum supplied by the user is translated to the appropriate ConstraintMeaningEnum
Enumerator | |
---|---|
MOLES_BULK_WATER | |
KG_SOLVENT_WATER | |
MOLES_BULK_SPECIES | |
FREE_MOLALITY | |
FREE_MOLES_MINERAL_SPECIES | |
FUGACITY | |
ACTIVITY |
Definition at line 47 of file GeochemicalSystem.h.
|
strong |
Each basis species must be provided with a constraint, that is chosen by the user from the following enum.
Enumerator | |
---|---|
KG_SOLVENT_WATER | |
BULK_COMPOSITION | |
BULK_COMPOSITION_WITH_KINETIC | |
FREE_CONCENTRATION | |
FREE_MINERAL | |
ACTIVITY | |
LOG10ACTIVITY | |
FUGACITY | |
LOG10FUGACITY |
Definition at line 59 of file GeochemicalSystem.h.
GeochemicalSystem::GeochemicalSystem | ( | ModelGeochemicalDatabase & | mgd, |
GeochemistryActivityCoefficients & | gac, | ||
GeochemistryIonicStrength & | is, | ||
GeochemistrySpeciesSwapper & | swapper, | ||
const std::vector< std::string > & | swap_out_of_basis, | ||
const std::vector< std::string > & | swap_into_basis, | ||
const std::string & | charge_balance_species, | ||
const std::vector< std::string > & | constrained_species, | ||
const std::vector< Real > & | constraint_value, | ||
const MultiMooseEnum & | constraint_unit, | ||
const MultiMooseEnum & | constraint_user_meaning, | ||
Real | initial_temperature, | ||
unsigned | iters_to_make_consistent, | ||
Real | min_initial_molality, | ||
const std::vector< std::string > & | kin_name, | ||
const std::vector< Real > & | kin_initial_moles, | ||
const MultiMooseEnum & | kin_unit | ||
) |
Construct the geochemical system, check consistency of the constructor's arguments, and initialize all internal variables (molalities, bulk compositions, equilibrium constants, activities, activity coefficients, surface potentials and kinetic mole numbers) and set up the algebraic system
mgd | the model's geochemical database, which is a model-specific version of the full geochemical database. WARNING: because GeochemicalSystem performs swaps, it will change mgd |
gac | the object that computes activity coefficients. WARNING: because GeochemicalSystem sets internal parameters in gac, it will change it. |
is | object to compute ionic strengths |
swapper | object to perform swaps on mgd |
swap_out_of_basis | A list of basis species that should be swapped out of the basis and replaced with swap_into_basis, prior to any other computations |
swap_into_basis | A list of equilibrium species that should be swapped into the basis in place of swap_out_of_basis |
charge_balance_species | The charge-balance species, which must be a basis species after the swaps are performed |
constrained_species | A list of the basis species after the swaps have been performed |
constraint_values | Numerical values of the constraints placed on the basis species. Each basis species must have exactly one constraint |
constraint_unit | Units of the constraint_values. Each constraint_value must have exactly one constraint_unit. This is only used during construction, to convert the constraint_values to mole units |
constraint_user_meaning | A list the provides physical meaning to the constraint_values |
initial_temperature | Initial temperature |
iters_to_make_consistent | The initial equilibrium molalities depend on the activity coefficients, which depend on the basis and equilibrium molalities. This circular dependence means it is usually impossible to define an exactly consistent initial configuration for molalities. An iterative process is used to approach the consistent initial configuration, using iters_to_make_consistent iterations. Usually iters_to_make_consistent=0 is reasonable, because there are so many approximations used in the solution process that a slightly inconsistent initial configuration is fine |
min_initial_molality | Minimum value of equilibrium molality used in the initial condition |
kin_name | Names of the kinetic species that are provided with initial conditions in kin_initial_moles. All kinetic species must be provided with an initial condition |
kin_initial | Values of the initial mole number or mass or volume (depending on kin_unit) for the kinetic species |
kin_unit | The units of the numbers given in kin_initial |
Definition at line 15 of file GeochemicalSystem.C.
GeochemicalSystem::GeochemicalSystem | ( | ModelGeochemicalDatabase & | mgd, |
GeochemistryActivityCoefficients & | gac, | ||
GeochemistryIonicStrength & | is, | ||
GeochemistrySpeciesSwapper & | swapper, | ||
const std::vector< std::string > & | swap_out_of_basis, | ||
const std::vector< std::string > & | swap_into_basis, | ||
const std::string & | charge_balance_species, | ||
const std::vector< std::string > & | constrained_species, | ||
const std::vector< Real > & | constraint_value, | ||
const std::vector< GeochemistryUnitConverter::GeochemistryUnit > & | constraint_unit, | ||
const std::vector< ConstraintUserMeaningEnum > & | constraint_user_meaning, | ||
Real | initial_temperature, | ||
unsigned | iters_to_make_consistent, | ||
Real | min_initial_molality, | ||
const std::vector< std::string > & | kin_name, | ||
const std::vector< Real > & | kin_initial, | ||
const std::vector< GeochemistryUnitConverter::GeochemistryUnit > & | kin_unit | ||
) |
Definition at line 90 of file GeochemicalSystem.C.
|
default |
Copy constructor.
void GeochemicalSystem::addKineticRates | ( | Real | dt, |
DenseVector< Real > & | mole_additions, | ||
DenseMatrix< Real > & | dmole_additions | ||
) |
Computes the kinetic rates and their derivatives based on the current values of molality, mole number, etc, and then, using dt, calculates the appropriate mole_additions and dmole_additions.
NOTE: this adds the kinetic contributes to mole_additions and dmole_additions. This method is not const because it modifies _eqm_activity for equilibrium gases and eqm species H+ and OH- (if there are any).
dt | time-step size |
mole_additions | The kinetic rates multiplied by dt get placed in the last num_kin slots |
dmole_additions | d(mole_additions)/d(molality or kinetic_moles) |
Definition at line 2383 of file GeochemicalSystem.C.
Referenced by GeochemicalSolver::reduceInitialResidual(), GeochemicalSolver::solveSystem(), and TEST_F().
Add to the MOLES_BULK_SPECIES (or MOLES_BULK_WATER if basis_ind = 0) for the basis species.
Note that if the constraint on the basis species is not MOLES_BULK_SPECIES (or MOLES_BULK_WATER) then this will have no impact. Note that charge-balance is performed if all constraints are BULK-type.
basis_ind | the index of the basis species |
value | the value to add to the bulk number of moles |
Definition at line 2182 of file GeochemicalSystem.C.
Referenced by GeochemistryTimeDependentReactor::postSolveFlowThrough(), GeochemistryTimeDependentReactor::preSolveDump(), GeochemicalSolver::solveSystem(), TEST_F(), and updateOldWithCurrent().
bool GeochemicalSystem::alterChargeBalanceSpecies | ( | Real | threshold_molality | ) |
If the molality of the charge-balance basis species is less than threshold molality, then attempt to change the charge-balance species, preferably to another component with opposite charge and big molality.
threshold_molality | if the charge-balance basis species has molality greater than this, this routine does nothing |
Definition at line 1720 of file GeochemicalSystem.C.
Referenced by GeochemicalSolver::solveSystem().
|
private |
Alter the GeochemicalSystem to reflect changes in bulk composition constraints that occur through, for instance, setConstraintValue or addToBulkMoles or changeConstraintToBulk (the latter because charge neutrality might be easily enforced, changing constraints and hence bulk moles).
This method enforces charge neutrality if simple (ie, all constraints are BULK-type), then sets _bulk_moles_old, and free mineral moles appropriately
Definition at line 2246 of file GeochemicalSystem.C.
Referenced by setConstraintValue().
|
private |
Builds in_algebraic_system, algebraic_index and basis_index, and sets num_basis_in_algebraic_system appropriately.
Definition at line 609 of file GeochemicalSystem.C.
Referenced by changeConstraintToBulk(), initialize(), and performSwapNoCheck().
|
private |
Fully populates basis_activity_known, which is true if activity has been set by the user, or the fugacity has been set by the user, or the basis species is a mineral.
Populates only those slots in basis_activity for which basis_activity_known == true
Definition at line 837 of file GeochemicalSystem.C.
Referenced by changeConstraintToBulk(), initialize(), performSwapNoCheck(), and setSolventMassAndFreeMolalityAndMineralMolesAndSurfacePotsAndKineticMoles().
Using the provided value of temperature, build _eqm_log10K for each eqm species and redox species.
Definition at line 579 of file GeochemicalSystem.C.
Referenced by initialize(), performSwapNoCheck(), and setTemperature().
void GeochemicalSystem::changeConstraintToBulk | ( | unsigned | basis_ind | ) |
Changes the constraint to MOLES_BULK_SPECIES (or MOLES_BULK_WATER if basis_ind = 0) for the basis index.
The constraint value (the bulk number of moles of the species) is computed from the current molality values. Note that if basis_ind corresponds to a gas, then changing the constraint involves performing a basis swap with a non-gaseous equilibrium species (eg O2(g) is removed from the basis and O2(aq) enters in its place). If, after performing the change to MOLES_BULK_SPECIES, all constraints are MOLES_BULK_WATER or MOLES_BULK_SPECIES then charge-balance is performed by altering the bulk_moles_old for the charge-balance species.
basis_ind | the index of the basis species |
Definition at line 2110 of file GeochemicalSystem.C.
Referenced by closeSystem(), GeochemistryTimeDependentReactor::execute(), and TEST_F().
Changes the constraint to MOLES_BULK_SPECIES (or MOLES_BULK_WATER if basis_ind = 0) for the basis index.
The constraint value (the bulk number of moles of the species) is set to value. It is an error to call this function when basis_ind corresponds to a gas, because changing the constraint involves performing a basis swap with a non-gaseous equilibrium species (eg O2(g) is removed from the basis and O2(aq) enters in its place), so the bulk number of moles will be computed by the swapper: use changeConstraintToBulk(basis_ind) instead. If, after performing the change to MOLES_BULK_SPECIES, all constraints are MOLES_BULK_WATER or MOLES_BULK_SPECIES then charge-balance is performed by altering the bulk_moles_old for the charge-balance species.
basis_ind | the index of the basis species |
value | the value to set the bulk number of moles to |
Definition at line 2151 of file GeochemicalSystem.C.
|
private |
Used during construction: checks for sane inputs and initializes molalities, etc, using the initialize() method.
kin_name | names of kinetic species |
kin_initial | initial mole numbers (or mass or volume, depending on kin_unit) of the species named in kin_name |
kin_unit | units of the numbers provided in kin_initial |
Definition at line 157 of file GeochemicalSystem.C.
Referenced by GeochemicalSystem().
void GeochemicalSystem::closeSystem | ( | ) |
Changes a KG_SOLVENT_WATER constraint to MOLES_BULK_WATER (if there is such a constraint) and all FREE_MOLALITY and FREE_MOLES_MINERAL_SPECIES to MOLES_BULK_SPECIES using the current values of _bulk_moles_old.
If, after performing these changes, all constraints are MOLES_BULK_WATER or MOLES_BULK_SPECIES then charge-balance is performed by altering the bulk_moles_old for the charge-balance species.
Definition at line 2100 of file GeochemicalSystem.C.
Referenced by GeochemistryTimeDependentReactor::execute(), TEST(), and TEST_F().
const std::vector< Real > & GeochemicalSystem::computeAndGetEquilibriumActivity | ( | ) |
Computes activity for all equilibrium species (_eqm_activity) and returns a reference to the vector.
The vector _eqm_activity is only used for output purposes (such as recording the fugacity of equilibrium gases) so it is only computed by this method and not internally during computeConsistentConfiguration.
Definition at line 2342 of file GeochemicalSystem.C.
Referenced by TEST_F().
Computes the value of bulk_moles_old for all basis species.
For species with BULK-type constraints bulk_moles_old gets set to the constraint value, while for other species bulk_moles_old is computed from the molalities, and, in contrast to Bethke, the kinetic species
Definition at line 1105 of file GeochemicalSystem.C.
Referenced by computeConsistentConfiguration(), setSolventMassAndFreeMolalityAndMineralMolesAndSurfacePotsAndKineticMoles(), and updateOldWithCurrent().
|
private |
basis_ind | the index of the basis species in mgd |
Definition at line 1133 of file GeochemicalSystem.C.
Referenced by changeConstraintToBulk(), computeBulk(), getResidualComponent(), and setSolventMassAndFreeMolalityAndMineralMolesAndSurfacePotsAndKineticMoles().
void GeochemicalSystem::computeConsistentConfiguration | ( | ) |
Compute a reasonably consistent configuration that can be used as an initial condition in a Newton process to solve the algebraic system.
Note that unless _iters_to_make_consistent is very large, the resulting configuration will not be completely consistent, but this is conventional in geochemical modelling: there are so many unknowns and approximations used in the Newton process, that starting from a completely consistent configuration is unimportant.
Before entering this method, it is assumed that::
This method computes:
It does not compute activity for equilibrium species: use computeAndGetEquilibriumActivity for that
Definition at line 464 of file GeochemicalSystem.C.
Referenced by GeochemistryTimeDependentReactor::execute(), initialize(), performSwapNoCheck(), GeochemistryTimeDependentReactor::postSolveExchanger(), setAlgebraicVariables(), and setConstraintValue().
compute the equilibrium molalities (not for minerals or gases)
Definition at line 1007 of file GeochemicalSystem.C.
Referenced by computeConsistentConfiguration().
|
private |
Compute the free mineral moles (ie, basis_molality for basis species that are minerals), using the bulk_moles_old.
Note that usually computeBulk should have been called immediately preceding this in order to correctly set bulk_moles_old.
Definition at line 1577 of file GeochemicalSystem.C.
Referenced by alterSystemBecauseBulkChanged(), and computeConsistentConfiguration().
void GeochemicalSystem::computeJacobian | ( | const DenseVector< Real > & | res, |
DenseMatrix< Real > & | jac, | ||
const DenseVector< Real > & | mole_additions, | ||
const DenseMatrix< Real > & | dmole_additions | ||
) | const |
Compute the Jacobian for the algebraic system and put it in jac.
res | The residual of the algebraic system. This is used to speed up computations of the jacobian |
jac | The jacobian entries are placed here |
mole_additions | The molar additions to the basis species and the kinetic species |
dmole_additions | d(mole_additions)/d(molality or kinetic_moles) |
Definition at line 1287 of file GeochemicalSystem.C.
Referenced by GeochemicalSolver::solveSystem().
|
private |
Compute the activity of water and put in basis_activity[0], and use the _basis_activity_coef and _basis_molality to compute the remaining basis activities (for those that are not minerals, gases or aqueous species provided with an activity)
Definition at line 939 of file GeochemicalSystem.C.
Referenced by computeConsistentConfiguration(), and setSolventMassAndFreeMolalityAndMineralMolesAndSurfacePotsAndKineticMoles().
|
private |
Compute sorbing_surface_area depending on the current molality of the sorbing minerals.
Definition at line 1842 of file GeochemicalSystem.C.
Referenced by computeConsistentConfiguration(), and setSolventMassAndFreeMolalityAndMineralMolesAndSurfacePotsAndKineticMoles().
void GeochemicalSystem::computeTransportedBulkFromMolalities | ( | std::vector< Real > & | transported_bulk | ) | const |
Computes the value of transported bulk moles for all basis species using the existing molalities.
Note that this is probably gives rubbish results unless the system is consistent (eg, the solve has converged). Also note that this does not include contributions from kinetic species
Definition at line 1152 of file GeochemicalSystem.C.
Referenced by getTransportedBulkInOriginalBasis().
void GeochemicalSystem::enforceChargeBalance | ( | ) |
Enforces charge balance by altering the constraint_value and bulk_moles_old of the charge-balance species.
Use with caution, since this overwrites the constraint values provided in the constructor, and also changes bulk_moles_old which is usually the value of bulk moles from the previous time-step
Definition at line 1069 of file GeochemicalSystem.C.
Referenced by GeochemicalSolver::solveSystem(), and TEST_F().
|
private |
Enforces charge balance by altering the constraint_value and bulk_moles_old of the charge-balance species.
Note that this changes the important constraint_value and the old bulk_moles_old (usually from the previous time-step) so should be used with caution.
Definition at line 1075 of file GeochemicalSystem.C.
|
private |
If all non-charged basis species are provided with a bulk number of moles, alter the bulk number of moles (old) of the charge_balance_species so that charges are balanced.
constraint_value | the values of the constraints provided by the user |
bulk_moles_old | the old values of bulk moles (from previous time-step) |
Definition at line 1036 of file GeochemicalSystem.C.
Referenced by alterSystemBecauseBulkChanged(), initialize(), performSwapNoCheck(), setChargeBalanceSpecies(), and setSolventMassAndFreeMolalityAndMineralMolesAndSurfacePotsAndKineticMoles().
std::vector< Real > GeochemicalSystem::getAlgebraicBasisValues | ( | ) | const |
Definition at line 696 of file GeochemicalSystem.C.
Referenced by GeochemicalSolver::reduceInitialResidual().
const std::vector< unsigned > & GeochemicalSystem::getAlgebraicIndexOfBasisSystem | ( | ) | const |
Definition at line 677 of file GeochemicalSystem.C.
DenseVector< Real > GeochemicalSystem::getAlgebraicVariableDenseValues | ( | ) | const |
Definition at line 705 of file GeochemicalSystem.C.
std::vector< Real > GeochemicalSystem::getAlgebraicVariableValues | ( | ) | const |
Definition at line 683 of file GeochemicalSystem.C.
Referenced by GeochemicalSolver::reduceInitialResidual(), and GeochemicalSolver::solveAndUnderrelax().
Real GeochemicalSystem::getBasisActivity | ( | unsigned | i | ) | const |
Definition at line 870 of file GeochemicalSystem.C.
Referenced by GeochemistryQuantityAux::computeValue(), GeochemistryConsoleOutput::output(), and TEST_F().
const std::vector< Real > & GeochemicalSystem::getBasisActivity | ( | ) | const |
Definition at line 882 of file GeochemicalSystem.C.
Real GeochemicalSystem::getBasisActivityCoefficient | ( | unsigned | i | ) | const |
Definition at line 968 of file GeochemicalSystem.C.
Referenced by GeochemistryConsoleOutput::output().
const std::vector< Real > & GeochemicalSystem::getBasisActivityCoefficient | ( | ) | const |
Definition at line 980 of file GeochemicalSystem.C.
const std::vector< bool > & GeochemicalSystem::getBasisActivityKnown | ( | ) | const |
Definition at line 864 of file GeochemicalSystem.C.
Referenced by GeochemicalSolver::swapNeeded().
const std::vector< unsigned > & GeochemicalSystem::getBasisIndexOfAlgebraicSystem | ( | ) | const |
Definition at line 671 of file GeochemicalSystem.C.
const std::vector< Real > & GeochemicalSystem::getBulkMolesOld | ( | ) | const |
Definition at line 803 of file GeochemicalSystem.C.
Referenced by GeochemistryQuantityAux::computeValue(), GeochemistryTimeDependentReactor::newTemperature(), GeochemistryConsoleOutput::output(), GeochemistryTimeDependentReactor::preSolveFlush(), GeochemistryTimeDependentReactor::removeCurrentSpecies(), and TEST_F().
DenseVector< Real > GeochemicalSystem::getBulkOldInOriginalBasis | ( | ) | const |
Definition at line 809 of file GeochemicalSystem.C.
Referenced by GeochemistryConsoleOutput::output().
unsigned GeochemicalSystem::getChargeBalanceBasisIndex | ( | ) | const |
return the index of the charge-balance species in the basis list
Definition at line 489 of file GeochemicalSystem.C.
Referenced by GeochemistryConsoleOutput::output(), GeochemicalSolver::solveSystem(), and GeochemicalSolver::swapNeeded().
const std::vector< GeochemicalSystem::ConstraintMeaningEnum > & GeochemicalSystem::getConstraintMeaning | ( | ) | const |
Definition at line 2094 of file GeochemicalSystem.C.
Referenced by GeochemistryTimeDependentReactor::execute(), and GeochemistryTimeDependentReactor::GeochemistryTimeDependentReactor().
Real GeochemicalSystem::getEquilibriumActivity | ( | unsigned | eqm_ind | ) | const |
Returns the value of activity for the equilibrium species with index eqm_index.
eqm_index | the index in mgd for the equilibrium species of interest |
Definition at line 2319 of file GeochemicalSystem.C.
Referenced by addKineticRates(), computeAndGetEquilibriumActivity(), GeochemistryQuantityAux::computeValue(), and TEST_F().
Real GeochemicalSystem::getEquilibriumActivityCoefficient | ( | unsigned | j | ) | const |
Definition at line 950 of file GeochemicalSystem.C.
Referenced by GeochemistryConsoleOutput::output(), and TEST_F().
const std::vector< Real > & GeochemicalSystem::getEquilibriumActivityCoefficient | ( | ) | const |
Definition at line 962 of file GeochemicalSystem.C.
Real GeochemicalSystem::getEquilibriumMolality | ( | unsigned | j | ) | const |
Definition at line 888 of file GeochemicalSystem.C.
Referenced by GeochemistryQuantityAux::computeValue(), GeochemistryConsoleOutput::output(), GeochemistryTimeDependentReactor::preSolveDump(), GeochemicalSolver::swapNeeded(), and TEST_F().
const std::vector< Real > & GeochemicalSystem::getEquilibriumMolality | ( | ) | const |
Definition at line 900 of file GeochemicalSystem.C.
const std::vector< bool > & GeochemicalSystem::getInAlgebraicSystem | ( | ) | const |
Definition at line 665 of file GeochemicalSystem.C.
Referenced by GeochemicalSolver::swapNeeded().
Real GeochemicalSystem::getIonicStrength | ( | ) | const |
Get the ionic strength.
Definition at line 1789 of file GeochemicalSystem.C.
Referenced by GeochemistryConsoleOutput::output().
Real GeochemicalSystem::getKineticLog10K | ( | unsigned | kin | ) | const |
kin | the index of the kinetic species (must be < _num_kin) |
Definition at line 546 of file GeochemicalSystem.C.
Referenced by GeochemistryConsoleOutput::output().
const std::vector< Real > & GeochemicalSystem::getKineticLog10K | ( | ) | const |
Definition at line 558 of file GeochemicalSystem.C.
Real GeochemicalSystem::getKineticMoles | ( | unsigned | kin | ) | const |
kin | the index of the kinetic species (must be < _num_kin) |
Definition at line 906 of file GeochemicalSystem.C.
Referenced by GeochemistryQuantityAux::computeValue(), GeochemistryConsoleOutput::output(), GeochemistryTimeDependentReactor::postSolveFlowThrough(), GeochemistryTimeDependentReactor::preSolveFlush(), and GeochemistryTimeDependentReactor::removeCurrentSpecies().
const std::vector< Real > & GeochemicalSystem::getKineticMoles | ( | ) | const |
Definition at line 933 of file GeochemicalSystem.C.
Real GeochemicalSystem::getLog10K | ( | unsigned | j | ) | const |
j | the index of the equilibrium species |
Definition at line 495 of file GeochemicalSystem.C.
Referenced by getEquilibriumActivity(), GeochemistryConsoleOutput::output(), and TEST_F().
const ModelGeochemicalDatabase & GeochemicalSystem::getModelGeochemicalDatabase | ( | ) | const |
Definition at line 1571 of file GeochemicalSystem.C.
Referenced by GeochemistryQuantityAux::computeValue(), GeochemistryConsoleOutput::output(), GeochemistryConsoleOutput::outputNernstInfo(), GeochemicalSolver::solveSystem(), GeochemicalSolver::swapNeeded(), and TEST_F().
unsigned GeochemicalSystem::getNumBasisInAlgebraicSystem | ( | ) | const |
return the number of basis species in the algebraic system
Definition at line 653 of file GeochemicalSystem.C.
Referenced by GeochemicalSolver::solveSystem().
unsigned GeochemicalSystem::getNumInAlgebraicSystem | ( | ) | const |
Definition at line 647 of file GeochemicalSystem.C.
Referenced by GeochemicalSolver::solveSystem().
unsigned GeochemicalSystem::getNumInBasis | ( | ) | const |
returns the number of species in the basis
Definition at line 1693 of file GeochemicalSystem.C.
Referenced by GeochemistryQuantityAux::computeValue(), GeochemistryConsoleOutput::output(), and TEST_F().
unsigned GeochemicalSystem::getNumInEquilibrium | ( | ) | const |
returns the number of species in equilibrium with the basis components
Definition at line 1699 of file GeochemicalSystem.C.
Referenced by GeochemistryConsoleOutput::output(), and TEST_F().
unsigned GeochemicalSystem::getNumKinetic | ( | ) | const |
returns the number of kinetic species
Definition at line 540 of file GeochemicalSystem.C.
Referenced by GeochemistryConsoleOutput::output().
unsigned GeochemicalSystem::getNumRedox | ( | ) | const |
Definition at line 507 of file GeochemicalSystem.C.
unsigned GeochemicalSystem::getNumSurfacePotentials | ( | ) | const |
return the number of surface potentials
Definition at line 659 of file GeochemicalSystem.C.
Referenced by GeochemistryConsoleOutput::output().
const std::string & GeochemicalSystem::getOriginalRedoxLHS | ( | ) | const |
Definition at line 2265 of file GeochemicalSystem.C.
Referenced by GeochemistryConsoleOutput::outputNernstInfo().
Real GeochemicalSystem::getRedoxLog10K | ( | unsigned | red | ) | const |
red | the index of the redox species in disequilibrium (red < _num_redox) |
Definition at line 513 of file GeochemicalSystem.C.
Referenced by GeochemistryConsoleOutput::output(), and GeochemistryConsoleOutput::outputNernstInfo().
Real GeochemicalSystem::getResidualComponent | ( | unsigned | algebraic_ind, |
const DenseVector< Real > & | mole_additions | ||
) | const |
Return the residual of the algebraic system for the given algebraic index.
algebraic_ind | the algebraic index |
mole_additions | the increment of mole number of each basis species and kinetic species since the last timestep. This must have size _num_basis + _num_kin. For the basis species, this is the amount of each species being injected into the system over the timestep. For the kinetic species, this is -dt*reaction_rate. Please note: do not decompose the kinetic-species additions into basis components and add them to the first slots of mole_additions! This method does that decomposition automatically. The first _num_basis slots of mole_additions contain kinetic-independent additions, while the last _num_kin slots contain kinetic-rate contributions. |
Definition at line 1178 of file GeochemicalSystem.C.
Referenced by GeochemicalSolver::computeResidual().
std::vector< Real > GeochemicalSystem::getSaturationIndices | ( | ) | const |
Definition at line 1598 of file GeochemicalSystem.C.
Referenced by GeochemistryConsoleOutput::output(), GeochemicalSolver::swapNeeded(), and TEST_F().
const std::vector< Real > & GeochemicalSystem::getSolventMassAndFreeMolalityAndMineralMoles | ( | ) | const |
Definition at line 831 of file GeochemicalSystem.C.
Referenced by GeochemistryQuantityAux::computeValue(), GeochemistryConsoleOutput::output(), GeochemistryTimeDependentReactor::postSolveFlowThrough(), GeochemistryTimeDependentReactor::preSolveDump(), GeochemistryTimeDependentReactor::preSolveFlush(), GeochemicalSolver::swapNeeded(), and TEST_F().
Real GeochemicalSystem::getSolventWaterMass | ( | ) | const |
Returns the mass of solvent water.
Definition at line 797 of file GeochemicalSystem.C.
const std::vector< Real > & GeochemicalSystem::getSorbingSurfaceArea | ( | ) | const |
Definition at line 1858 of file GeochemicalSystem.C.
Referenced by GeochemistryConsoleOutput::output().
Real GeochemicalSystem::getStoichiometricIonicStrength | ( | ) | const |
Get the stoichiometric ionic strength.
Definition at line 1795 of file GeochemicalSystem.C.
Referenced by GeochemistryConsoleOutput::output().
Real GeochemicalSystem::getSurfaceCharge | ( | unsigned | sp | ) | const |
sp | surface number of interest. sp < _num_surface_pot |
Definition at line 1827 of file GeochemicalSystem.C.
Referenced by GeochemistryQuantityAux::computeValue(), and GeochemistryConsoleOutput::output().
Real GeochemicalSystem::getSurfacePotential | ( | unsigned | sp | ) | const |
sp | surface number of interest. sp < _num_surface_pot |
Definition at line 1813 of file GeochemicalSystem.C.
Referenced by GeochemistryQuantityAux::computeValue(), and GeochemistryConsoleOutput::output().
const GeochemistrySpeciesSwapper & GeochemicalSystem::getSwapper | ( | ) | const |
Definition at line 2277 of file GeochemicalSystem.C.
Referenced by GeochemistryTimeDependentReactor::preSolveDump(), and GeochemicalSolver::swapNeeded().
Real GeochemicalSystem::getTemperature | ( | ) | const |
Definition at line 1864 of file GeochemicalSystem.C.
Referenced by GeochemistryQuantityAux::computeValue(), GeochemistryConsoleOutput::output(), GeochemistryConsoleOutput::outputNernstInfo(), and TEST_F().
Real GeochemicalSystem::getTotalChargeOld | ( | ) | const |
Definition at line 1059 of file GeochemicalSystem.C.
Referenced by enforceChargeBalance(), GeochemistryConsoleOutput::output(), and TEST_F().
DenseVector< Real > GeochemicalSystem::getTransportedBulkInOriginalBasis | ( | ) | const |
Definition at line 819 of file GeochemicalSystem.C.
Referenced by GeochemistryQuantityAux::computeValue(), and GeochemistryConsoleOutput::output().
|
private |
based on _constrained_value and _constraint_meaning, populate nw, bulk_moles_old and basis_molality with reasonable initial conditions that may be used during the Newton solve of the algebraic system
bulk_moles_old | bulk composition number of moles of the basis species |
basis_molality | zeroth component is mass of solvent water, other components are either molality of the basis aqueous species or number of moles of basis mineral, whichever is appropriate |
Definition at line 718 of file GeochemicalSystem.C.
Referenced by initialize().
void GeochemicalSystem::initialize | ( | ) |
initialize all variables, ready for a Newton solve of the algebraic system
Definition at line 445 of file GeochemicalSystem.C.
Referenced by checkAndInitialize().
|
private |
Definition at line 998 of file GeochemicalSystem.C.
Referenced by computeEqmMolalities(), and getSaturationIndices().
Real GeochemicalSystem::log10KineticActivityProduct | ( | unsigned | kin | ) | const |
kin | the index of the kinetic species (must be < _num_kin) |
Definition at line 564 of file GeochemicalSystem.C.
Referenced by addKineticRates(), and GeochemistryConsoleOutput::output().
Real GeochemicalSystem::log10RedoxActivityProduct | ( | unsigned | red | ) | const |
red | the index of the redox species in disequilibrium (red < _num_redox) |
Definition at line 525 of file GeochemicalSystem.C.
Referenced by GeochemistryConsoleOutput::output(), and GeochemistryConsoleOutput::outputNernstInfo().
|
inline |
Copy assignment operator.
Almost all of the following is trivial. The most important non-trivial feature is copying src._mgd into our _mgd. Note this method gets called when dest = src and dest is already constructed. (Code such as GeochemicalSystem dest = src uses the copy constructor which simply sets the _mgd reference in dest equal to the _mgd reference in src, and does not make a copy of the data within src._mgd)
Definition at line 157 of file GeochemicalSystem.h.
|
inline |
Definition at line 213 of file GeochemicalSystem.h.
void GeochemicalSystem::performSwap | ( | unsigned | swap_out_of_basis, |
unsigned | swap_into_basis | ||
) |
Perform the basis swap, and ensure that the resulting system is consistent.
Note that this alters the bulk_moles_old of species. If you are confident that your configuration is reasonably correct, you should therefore ensure bulk_moles_old is set to the actual bulk_moles in your system prior to calling performSwap. Alternatively, if you are unsure of the correctness, just let performSwap use bulk_moles_old to set the bulk moles of your new basis.
swap_out_of_basis | index of basis species to remove from basis |
swap_into_basis | index of equilibrium species to add to basis |
Definition at line 1610 of file GeochemicalSystem.C.
Referenced by GeochemistryTimeDependentReactor::preSolveDump(), GeochemicalSolver::solveSystem(), and TEST_F().
void GeochemicalSystem::performSwapNoCheck | ( | unsigned | swap_out_of_basis, |
unsigned | swap_into_basis | ||
) |
Perform the basis swap, and ensure that the resulting system is consistent.
Note: no sanity-checks regarding swapping out the charge-balance species, etc, are made. Note that this alters the bulk_moles_old of species. If you are confident that your configuration is reasonably correct, you should therefore ensure bulk_moles_old is set to the actual bulk_moles in your system prior to calling performSwap. Alternatively, if you are unsure of the correctness, just let performSwap use bulk_moles_old to set the bulk moles of your new basis.
swap_out_of_basis | index of basis species to remove from basis |
swap_into_basis | index of equilibrium species to add to basis |
Definition at line 1630 of file GeochemicalSystem.C.
Referenced by changeConstraintToBulk(), GeochemistryConsoleOutput::outputNernstInfo(), and performSwap().
bool GeochemicalSystem::revertToOriginalChargeBalanceSpecies | ( | ) |
Changes the charge-balance species to the original that is specified in the constructor (this might not be possible since the original charge-balance species might have been swapped out)
Definition at line 1776 of file GeochemicalSystem.C.
Set the variables in the algebraic system (molalities and potentially the mass of solvent water, and surface potentials, and kinetic mole numbers if any) to algebraic_var.
All elements of this vector must be postivie. This function also calls computeConsistentConfiguration.
algebraic_var | the values to set the algebraic variables to |
Definition at line 1085 of file GeochemicalSystem.C.
Referenced by GeochemicalSolver::reduceInitialResidual(), and GeochemicalSolver::solveSystem().
|
private |
Set the charge-balance species to the basis index provided.
No checks are made on the sanity of the desired change. Before setting, the _constraint_value mole number of the old charge-balance species is set to the value provided in the constructor. Then _charge_balance_basis_index and _charge_balance_species is set appropriately
Definition at line 1705 of file GeochemicalSystem.C.
Referenced by alterChargeBalanceSpecies(), and revertToOriginalChargeBalanceSpecies().
Set the constraint value for the basis species.
If molalities or activities are changed, this method uses computeConsistentConfiguration to result in a consistent configuration, while if bulk composition is altered it uses alterSystemBecauseBulkChanged to result in a consistent configuration (charge-balance is performed if all constraints are BULK-type)
basis_ind | the index of the basis species |
value | the value to set the constraint to |
Definition at line 2199 of file GeochemicalSystem.C.
Referenced by addToBulkMoles(), changeConstraintToBulk(), GeochemistryTimeDependentReactor::execute(), and TEST_F().
Sets the current AND old mole number for a kinetic species.
Note: this does not compute a consistent configuration (viz, the bulk mole composition is not updated): use computeConsistentConfiguration if you need to.
kin | the index of the kinetic species (must be < _num_kin) |
moles | the number of moles |
Definition at line 918 of file GeochemicalSystem.C.
Referenced by checkAndInitialize(), GeochemistryTimeDependentReactor::postSolveFlowThrough(), setSolventMassAndFreeMolalityAndMineralMolesAndSurfacePotsAndKineticMoles(), and TEST_F().
Set the free mole number of mineral-related species to the value provided.
This sets the mole number of basis minerals, the molality of unoccupied sorption sites (whether in the basis or not), and the molality of sorbed species to the value provided. It does not set the molality of equilibrium minerals, which is always zero. NOTE: calling this method can easily result in a completely inconsistent GeochemicalSystem because no computeConsistentConfiguration() is called. If you need a consistent configuration, please call that method after calling this one
value | the mole number (or molality, for sorption-related species) |
Definition at line 2283 of file GeochemicalSystem.C.
Referenced by GeochemistryTimeDependentReactor::postSolveFlowThrough(), and GeochemistryTimeDependentReactor::preSolveDump().
void GeochemicalSystem::setModelGeochemicalDatabase | ( | const ModelGeochemicalDatabase & | mgd | ) |
Copies a ModelGeochemicalDatabase into our _mgd structure.
mgd | reference to the ModelGeochemicalDatabase that will be copied into _mgd |
Definition at line 2271 of file GeochemicalSystem.C.
Referenced by GeochemistryConsoleOutput::outputNernstInfo(), and TEST_F().
void GeochemicalSystem::setSolventMassAndFreeMolalityAndMineralMolesAndSurfacePotsAndKineticMoles | ( | const std::vector< std::string > & | names, |
const std::vector< Real > & | values, | ||
const std::vector< bool > & | constraints_from_molalities | ||
) |
Sets:
This method is designed to be run at the start of a simulation, or during a "recover" operator.
names | the names of all the basis species, equilibrium species, surface-sorption minerals and kinetic species that are in the system. Note, there must be exactly num_basis + num_eqm + num_surface_pot + num_kin of these, ie, all species must be provided with a value |
values | the values of the molalities (or solvent water mass for water, or free number of moles for minerals/kinetics, or surface_potential_expr for surface-sorption sites). There must be an equal number of these as "names". |
contraints_from_molalities | whether the constraints initial provided to the GeochemicalSystem should be updated by the values provided. This must have size num_basis. |
This method is reasonably nontrivial:
Definition at line 1878 of file GeochemicalSystem.C.
Referenced by TEST_F().
Sets the temperature to the given quantity.
This also:
temperature | the temperature in degC |
Definition at line 1870 of file GeochemicalSystem.C.
Referenced by GeochemistryTimeDependentReactor::execute(), GeochemistryTimeDependentReactor::postSolveExchanger(), and TEST_F().
|
private |
sp | Surface potential number. sp < _num_surface_pot |
Definition at line 1801 of file GeochemicalSystem.C.
Referenced by computeJacobian(), getResidualComponent(), and getSurfaceCharge().
|
private |
eqm_j | the index of the equilibrium species |
Definition at line 1025 of file GeochemicalSystem.C.
Referenced by computeEqmMolalities().
|
private |
For basis aqueous species (not water, minerals or gases) with activity set by the user, set basis_molality = activity / activity_coefficient.
Definition at line 986 of file GeochemicalSystem.C.
Referenced by computeConsistentConfiguration(), and setSolventMassAndFreeMolalityAndMineralMolesAndSurfacePotsAndKineticMoles().
Usually used at the end of a solve, to provide correct initial conditions to the next time-step, this method:
mole_additions | the increment of mole number of each basis species and kinetic species since the last timestep. This must have size _num_basis + _num_kin. Only the first _num_basis of these are used. |
Definition at line 2350 of file GeochemicalSystem.C.
Referenced by GeochemicalSolver::solveSystem(), and TEST_F().
|
private |
_algebraic_index[i] = index in the algebraic system of the basis species i. _basis_index[_algebraic_index[i]] = i
Definition at line 890 of file GeochemicalSystem.h.
Referenced by changeConstraintToBulk(), getAlgebraicIndexOfBasisSystem(), initialize(), operator=(), operator==(), and performSwapNoCheck().
|
private |
values of activity (for water, minerals and aqueous basis species) or fugacity (for gases)
Definition at line 905 of file GeochemicalSystem.h.
Referenced by addKineticRates(), changeConstraintToBulk(), computeConsistentConfiguration(), getBasisActivity(), getEquilibriumActivity(), initialize(), log10ActivityProduct(), log10KineticActivityProduct(), log10RedoxActivityProduct(), operator=(), operator==(), performSwapNoCheck(), setConstraintValue(), setSolventMassAndFreeMolalityAndMineralMolesAndSurfacePotsAndKineticMoles(), and updateBasisMolalityForKnownActivity().
|
private |
basis activity coefficients
Definition at line 909 of file GeochemicalSystem.h.
Referenced by computeConsistentConfiguration(), computeRemainingBasisActivities(), getBasisActivityCoefficient(), operator=(), operator==(), setConstraintValue(), setSolventMassAndFreeMolalityAndMineralMolesAndSurfacePotsAndKineticMoles(), and updateBasisMolalityForKnownActivity().
|
private |
whether basis_activity[i] is fixed by the user
Definition at line 903 of file GeochemicalSystem.h.
Referenced by addKineticRates(), changeConstraintToBulk(), computeRemainingBasisActivities(), getBasisActivityKnown(), initialize(), operator=(), operator==(), performSwapNoCheck(), setSolventMassAndFreeMolalityAndMineralMolesAndSurfacePotsAndKineticMoles(), and updateBasisMolalityForKnownActivity().
|
private |
_basis_index[i] = index in the basis of the algebraic system species i, for i<num_basis_in_algebraic_system. _basis_index[_algebraic_index[i]] == i
Definition at line 892 of file GeochemicalSystem.h.
Referenced by changeConstraintToBulk(), computeJacobian(), getAlgebraicBasisValues(), getAlgebraicVariableDenseValues(), getAlgebraicVariableValues(), getBasisIndexOfAlgebraicSystem(), getResidualComponent(), initialize(), operator=(), operator==(), performSwapNoCheck(), and setAlgebraicVariables().
|
private |
IMPORTANT: this is.
Definition at line 901 of file GeochemicalSystem.h.
Referenced by addKineticRates(), alterChargeBalanceSpecies(), alterSystemBecauseBulkChanged(), computeBulkFromMolalities(), computeConsistentConfiguration(), computeFreeMineralMoles(), computeJacobian(), computeRemainingBasisActivities(), computeSorbingSurfaceArea(), computeTransportedBulkFromMolalities(), getAlgebraicBasisValues(), getAlgebraicVariableDenseValues(), getAlgebraicVariableValues(), getIonicStrength(), getResidualComponent(), getSolventMassAndFreeMolalityAndMineralMoles(), getSolventWaterMass(), getStoichiometricIonicStrength(), initialize(), operator=(), operator==(), performSwapNoCheck(), setAlgebraicVariables(), setConstraintValue(), setMineralRelatedFreeMoles(), setSolventMassAndFreeMolalityAndMineralMolesAndSurfacePotsAndKineticMoles(), setTemperature(), and surfacePotPrefactor().
|
private |
Number of bulk moles of basis species (this includes contributions from kinetic species, in contrast to Bethke)
Definition at line 894 of file GeochemicalSystem.h.
Referenced by alterSystemBecauseBulkChanged(), computeConsistentConfiguration(), computeFreeMineralMoles(), computeJacobian(), enforceChargeBalance(), getBulkMolesOld(), getBulkOldInOriginalBasis(), getResidualComponent(), getTotalChargeOld(), initialize(), operator=(), operator==(), performSwapNoCheck(), setChargeBalanceSpecies(), setSolventMassAndFreeMolalityAndMineralMolesAndSurfacePotsAndKineticMoles(), and updateOldWithCurrent().
|
private |
The index in the list of basis species corresponding to the charge-balance species. This gets altered as the simulation progresses, due to swaps, and alterChargeBalanceSpecies.
Definition at line 864 of file GeochemicalSystem.h.
Referenced by alterChargeBalanceSpecies(), checkAndInitialize(), computeJacobian(), enforceChargeBalance(), enforceChargeBalanceIfSimple(), getChargeBalanceBasisIndex(), getResidualComponent(), operator=(), operator==(), performSwap(), performSwapNoCheck(), revertToOriginalChargeBalanceSpecies(), and setChargeBalanceSpecies().
|
private |
The species used to enforce charge balance.
Definition at line 860 of file GeochemicalSystem.h.
Referenced by checkAndInitialize(), operator=(), operator==(), performSwapNoCheck(), and setChargeBalanceSpecies().
|
private |
Names of the species in that have their values fixed to _constraint_value with meanings _constraint_meaning. In the constructor, this is ordered to have the same ordering as the basis species.
Definition at line 866 of file GeochemicalSystem.h.
Referenced by checkAndInitialize(), operator=(), and operator==().
|
private |
The meaning of the values in _constraint_value. In the constructor, this is ordered to have the same ordering as the basis species.
Definition at line 876 of file GeochemicalSystem.h.
Referenced by addToBulkMoles(), alterChargeBalanceSpecies(), alterSystemBecauseBulkChanged(), buildAlgebraicInfo(), buildKnownBasisActivities(), changeConstraintToBulk(), checkAndInitialize(), closeSystem(), computeBulk(), computeFreeMineralMoles(), computeJacobian(), enforceChargeBalanceIfSimple(), getConstraintMeaning(), getResidualComponent(), initBulkAndFree(), operator=(), operator==(), performSwapNoCheck(), setConstraintValue(), and setSolventMassAndFreeMolalityAndMineralMolesAndSurfacePotsAndKineticMoles().
|
private |
Units of the _constraint_value when the GeochemicalSystem is constructed. This is used during the constructor to convert the constraint_values into mole units.
Definition at line 872 of file GeochemicalSystem.h.
Referenced by checkAndInitialize(), GeochemicalSystem(), operator=(), and operator==().
|
private |
The user-defined meaning of the values in _constraint_value. In the constructor, this is ordered to have the same ordering as the basis species. During the process of unit conversion, from the user-supplied _constraint_unit, to mole-based units, _constraint_user_meaning is used to populate _constraint_meaning, and henceforth usually only _constraint_meaning is used in the code.
Definition at line 874 of file GeochemicalSystem.h.
Referenced by checkAndInitialize(), GeochemicalSystem(), operator=(), and operator==().
|
private |
Numerical values of the constraints on _constraint_species. In the constructor, this is ordered to have the same ordering as the basis species.
Definition at line 868 of file GeochemicalSystem.h.
Referenced by addToBulkMoles(), alterSystemBecauseBulkChanged(), buildKnownBasisActivities(), checkAndInitialize(), computeBulk(), computeFreeMineralMoles(), enforceChargeBalance(), initBulkAndFree(), initialize(), operator=(), operator==(), performSwapNoCheck(), setChargeBalanceSpecies(), setConstraintValue(), and setSolventMassAndFreeMolalityAndMineralMolesAndSurfacePotsAndKineticMoles().
|
private |
equilibrium activities.
NOTE: for computational efficiency, these are not computed until computeAndGetEqmActivity is called, and they are currently only ever used for output purposes and computing kinetic rates
Definition at line 917 of file GeochemicalSystem.h.
Referenced by addKineticRates(), computeAndGetEquilibriumActivity(), operator=(), and operator==().
|
private |
equilibrium activity coefficients
Definition at line 911 of file GeochemicalSystem.h.
Referenced by computeConsistentConfiguration(), computeEqmMolalities(), getEquilibriumActivity(), getEquilibriumActivityCoefficient(), operator=(), operator==(), and setSolventMassAndFreeMolalityAndMineralMolesAndSurfacePotsAndKineticMoles().
|
private |
equilibrium constant of the equilibrium species
Definition at line 878 of file GeochemicalSystem.h.
Referenced by buildTemperatureDependentQuantities(), computeEqmMolalities(), getLog10K(), getSaturationIndices(), operator=(), and operator==().
|
private |
molality of equilibrium species
Definition at line 907 of file GeochemicalSystem.h.
Referenced by addKineticRates(), computeBulkFromMolalities(), computeConsistentConfiguration(), computeFreeMineralMoles(), computeJacobian(), computeTransportedBulkFromMolalities(), getEquilibriumActivity(), getEquilibriumMolality(), getIonicStrength(), getResidualComponent(), getStoichiometricIonicStrength(), initialize(), operator=(), operator==(), performSwapNoCheck(), setMineralRelatedFreeMoles(), setSolventMassAndFreeMolalityAndMineralMolesAndSurfacePotsAndKineticMoles(), setTemperature(), and surfacePotPrefactor().
|
private |
Object to compute the activity coefficients and activity of water.
Definition at line 856 of file GeochemicalSystem.h.
Referenced by computeConsistentConfiguration(), computeRemainingBasisActivities(), operator=(), operator==(), setSolventMassAndFreeMolalityAndMineralMolesAndSurfacePotsAndKineticMoles(), and setTemperature().
|
private |
if _in_algebraic_system[i] == true then we need to solve for the i^th basis-species molality
Definition at line 888 of file GeochemicalSystem.h.
Referenced by changeConstraintToBulk(), getInAlgebraicSystem(), initialize(), operator=(), operator==(), and performSwapNoCheck().
|
private |
Object that provides the ionic strengths.
Definition at line 858 of file GeochemicalSystem.h.
Referenced by getIonicStrength(), getStoichiometricIonicStrength(), operator=(), operator==(), and surfacePotPrefactor().
|
private |
Iterations to make the initial configuration consistent.
Note that because equilibrium molality depends on activity and activity coefficients, and water activity and activity coefficients depend on molality, it is a nontrivial task to compute all these so that the algorithm starts with a consistent initial condition from which to solve the algebraic system. Usually the algorithm doesn't even attempt to make a consistent initial condition (a suitable default is iters_to_make_consistent=0), because solving the algebraic system includes so many approximations anyway.
Definition at line 940 of file GeochemicalSystem.h.
Referenced by computeConsistentConfiguration(), operator=(), and operator==().
|
private |
equilibrium constant of the kinetic species
Definition at line 882 of file GeochemicalSystem.h.
Referenced by addKineticRates(), buildTemperatureDependentQuantities(), getKineticLog10K(), operator=(), and operator==().
|
private |
mole number of kinetic species
Definition at line 928 of file GeochemicalSystem.h.
Referenced by addKineticRates(), checkAndInitialize(), computeBulkFromMolalities(), computeConsistentConfiguration(), computeFreeMineralMoles(), computeJacobian(), getAlgebraicVariableDenseValues(), getAlgebraicVariableValues(), getIonicStrength(), getKineticMoles(), getResidualComponent(), getStoichiometricIonicStrength(), operator=(), operator==(), setAlgebraicVariables(), setKineticMoles(), setMineralRelatedFreeMoles(), setSolventMassAndFreeMolalityAndMineralMolesAndSurfacePotsAndKineticMoles(), setTemperature(), surfacePotPrefactor(), and updateOldWithCurrent().
|
private |
old mole number of kinetic species
Definition at line 930 of file GeochemicalSystem.h.
Referenced by getResidualComponent(), operator=(), operator==(), setKineticMoles(), and updateOldWithCurrent().
|
private |
The minimal geochemical database.
Definition at line 838 of file GeochemicalSystem.h.
Referenced by addKineticRates(), alterChargeBalanceSpecies(), buildAlgebraicInfo(), buildKnownBasisActivities(), buildTemperatureDependentQuantities(), changeConstraintToBulk(), checkAndInitialize(), computeBulkFromMolalities(), computeConsistentConfiguration(), computeEqmMolalities(), computeFreeMineralMoles(), computeJacobian(), computeSorbingSurfaceArea(), computeTransportedBulkFromMolalities(), enforceChargeBalance(), enforceChargeBalanceIfSimple(), getBulkOldInOriginalBasis(), getEquilibriumActivity(), getIonicStrength(), getModelGeochemicalDatabase(), getResidualComponent(), getSaturationIndices(), getStoichiometricIonicStrength(), getTotalChargeOld(), getTransportedBulkInOriginalBasis(), log10ActivityProduct(), log10KineticActivityProduct(), log10RedoxActivityProduct(), operator=(), operator==(), performSwap(), performSwapNoCheck(), revertToOriginalChargeBalanceSpecies(), setChargeBalanceSpecies(), setMineralRelatedFreeMoles(), setModelGeochemicalDatabase(), setSolventMassAndFreeMolalityAndMineralMolesAndSurfacePotsAndKineticMoles(), setTemperature(), surfacePotPrefactor(), surfaceSorptionModifier(), and updateBasisMolalityForKnownActivity().
|
private |
Minimum molality ever used in an initial guess.
Definition at line 944 of file GeochemicalSystem.h.
Referenced by initBulkAndFree(), operator=(), operator==(), and performSwapNoCheck().
|
private |
number of basis species
Definition at line 840 of file GeochemicalSystem.h.
Referenced by addKineticRates(), addToBulkMoles(), alterChargeBalanceSpecies(), alterSystemBecauseBulkChanged(), buildAlgebraicInfo(), buildKnownBasisActivities(), changeConstraintToBulk(), checkAndInitialize(), closeSystem(), computeBulk(), computeFreeMineralMoles(), computeJacobian(), computeRemainingBasisActivities(), computeTransportedBulkFromMolalities(), enforceChargeBalanceIfSimple(), getBasisActivity(), getBasisActivityCoefficient(), getEquilibriumActivity(), getNumInBasis(), getResidualComponent(), getTotalChargeOld(), initBulkAndFree(), log10ActivityProduct(), log10KineticActivityProduct(), log10RedoxActivityProduct(), operator=(), operator==(), performSwapNoCheck(), setConstraintValue(), setMineralRelatedFreeMoles(), setSolventMassAndFreeMolalityAndMineralMolesAndSurfacePotsAndKineticMoles(), updateBasisMolalityForKnownActivity(), and updateOldWithCurrent().
|
private |
number of unknown molalities in the algebraic system. Note: surface potentials (if any) are extra quantities in the algebraic system
Definition at line 884 of file GeochemicalSystem.h.
Referenced by buildAlgebraicInfo(), changeConstraintToBulk(), computeJacobian(), getAlgebraicBasisValues(), getAlgebraicVariableDenseValues(), getAlgebraicVariableValues(), getNumBasisInAlgebraicSystem(), getResidualComponent(), initialize(), operator=(), operator==(), performSwapNoCheck(), and setAlgebraicVariables().
|
private |
number of equilibrium species
Definition at line 842 of file GeochemicalSystem.h.
Referenced by addKineticRates(), buildTemperatureDependentQuantities(), changeConstraintToBulk(), computeAndGetEquilibriumActivity(), computeBulkFromMolalities(), computeEqmMolalities(), computeFreeMineralMoles(), computeJacobian(), computeTransportedBulkFromMolalities(), getEquilibriumActivity(), getEquilibriumActivityCoefficient(), getEquilibriumMolality(), getLog10K(), getNumInEquilibrium(), getResidualComponent(), getSaturationIndices(), initialize(), operator=(), operator==(), setMineralRelatedFreeMoles(), setSolventMassAndFreeMolalityAndMineralMolesAndSurfacePotsAndKineticMoles(), and surfaceSorptionModifier().
|
private |
number of unknowns in the algebraic system (includes molalities and surface potentials)
Definition at line 886 of file GeochemicalSystem.h.
Referenced by changeConstraintToBulk(), computeJacobian(), getAlgebraicVariableDenseValues(), getNumInAlgebraicSystem(), getResidualComponent(), initialize(), operator=(), operator==(), performSwapNoCheck(), and setAlgebraicVariables().
|
private |
number of kinetic species
Definition at line 848 of file GeochemicalSystem.h.
Referenced by addKineticRates(), buildAlgebraicInfo(), buildTemperatureDependentQuantities(), checkAndInitialize(), computeBulkFromMolalities(), computeFreeMineralMoles(), computeJacobian(), getAlgebraicVariableDenseValues(), getAlgebraicVariableValues(), getKineticLog10K(), getKineticMoles(), getNumKinetic(), getResidualComponent(), log10KineticActivityProduct(), operator=(), operator==(), setAlgebraicVariables(), setKineticMoles(), setMineralRelatedFreeMoles(), setSolventMassAndFreeMolalityAndMineralMolesAndSurfacePotsAndKineticMoles(), and updateOldWithCurrent().
|
private |
number of redox species
Definition at line 844 of file GeochemicalSystem.h.
Referenced by buildTemperatureDependentQuantities(), getNumRedox(), getRedoxLog10K(), log10RedoxActivityProduct(), operator=(), and operator==().
|
private |
number of surface potentials
Definition at line 846 of file GeochemicalSystem.h.
Referenced by buildAlgebraicInfo(), computeJacobian(), computeSorbingSurfaceArea(), getAlgebraicVariableDenseValues(), getAlgebraicVariableValues(), getNumSurfacePotentials(), getResidualComponent(), getSurfaceCharge(), getSurfacePotential(), initialize(), operator=(), operator==(), setAlgebraicVariables(), and setSolventMassAndFreeMolalityAndMineralMolesAndSurfacePotsAndKineticMoles().
|
private |
The species used to enforce charge balance, as provided in the constructor.
Definition at line 862 of file GeochemicalSystem.h.
Referenced by operator=(), operator==(), and revertToOriginalChargeBalanceSpecies().
|
private |
Numerical values of the constraints on _constraint_species. In the constructor, this is ordered to have the same ordering as the basis species. Since values can change due to charge-balance, this holds the original values set by the user.
Definition at line 870 of file GeochemicalSystem.h.
Referenced by checkAndInitialize(), operator=(), operator==(), performSwapNoCheck(), setChargeBalanceSpecies(), setConstraintValue(), and setSolventMassAndFreeMolalityAndMineralMolesAndSurfacePotsAndKineticMoles().
|
private |
The left-hand-side of the redox equations in _mgd after initial swaps.
Definition at line 946 of file GeochemicalSystem.h.
Referenced by checkAndInitialize(), getOriginalRedoxLHS(), operator=(), and operator==().
|
private |
equilibrium constant of the redox species
Definition at line 880 of file GeochemicalSystem.h.
Referenced by buildTemperatureDependentQuantities(), getRedoxLog10K(), operator=(), and operator==().
|
private |
surface areas of the sorbing minerals
Definition at line 926 of file GeochemicalSystem.h.
Referenced by computeConsistentConfiguration(), getSorbingSurfaceArea(), getSurfaceCharge(), operator=(), operator==(), setSolventMassAndFreeMolalityAndMineralMolesAndSurfacePotsAndKineticMoles(), and surfacePotPrefactor().
|
private |
surface potential expressions.
These are not the surface potentials themselves. Instead they are exp(-surface_potential * Faraday / 2 / R / T_k). Hence _surface_pot_expr >= 0 (like molalities) and the surface-potential residual is close to linear in _surface_pot_expr if equilibrium molalities are large
Definition at line 924 of file GeochemicalSystem.h.
Referenced by computeJacobian(), getAlgebraicVariableDenseValues(), getAlgebraicVariableValues(), getResidualComponent(), getSurfaceCharge(), getSurfacePotential(), initialize(), operator=(), operator==(), setAlgebraicVariables(), setSolventMassAndFreeMolalityAndMineralMolesAndSurfacePotsAndKineticMoles(), and surfaceSorptionModifier().
|
private |
Species to immediately add to the basis in favor of _swap_out.
Definition at line 854 of file GeochemicalSystem.h.
Referenced by checkAndInitialize(), and operator==().
|
private |
Species to immediately remove from the basis in favor of _swap_in.
Definition at line 852 of file GeochemicalSystem.h.
Referenced by checkAndInitialize(), and operator==().
|
private |
swapper that can swap species into and out of the basis
Definition at line 850 of file GeochemicalSystem.h.
Referenced by checkAndInitialize(), getSwapper(), operator=(), operator==(), and performSwapNoCheck().
|
private |
The temperature in degC.
Definition at line 942 of file GeochemicalSystem.h.
Referenced by addKineticRates(), computeConsistentConfiguration(), getSurfacePotential(), getTemperature(), initialize(), operator=(), operator==(), performSwapNoCheck(), setSolventMassAndFreeMolalityAndMineralMolesAndSurfacePotsAndKineticMoles(), setTemperature(), and surfacePotPrefactor().