https://mooseframework.inl.gov
GeochemicalSystem.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #pragma once
11 
12 #include "MultiMooseEnum.h"
16 #include "GeochemistryConstants.h"
18 
40 {
41 public:
48  {
54  FUGACITY,
55  ACTIVITY
56  };
57 
60  {
66  ACTIVITY,
68  FUGACITY,
70  };
71 
115  GeochemistrySpeciesSwapper & swapper,
116  const std::vector<std::string> & swap_out_of_basis,
117  const std::vector<std::string> & swap_into_basis,
118  const std::string & charge_balance_species,
119  const std::vector<std::string> & constrained_species,
120  const std::vector<Real> & constraint_value,
121  const MultiMooseEnum & constraint_unit,
122  const MultiMooseEnum & constraint_user_meaning,
123  Real initial_temperature,
124  unsigned iters_to_make_consistent,
125  Real min_initial_molality,
126  const std::vector<std::string> & kin_name,
127  const std::vector<Real> & kin_initial_moles,
128  const MultiMooseEnum & kin_unit);
129 
134  GeochemistrySpeciesSwapper & swapper,
135  const std::vector<std::string> & swap_out_of_basis,
136  const std::vector<std::string> & swap_into_basis,
137  const std::string & charge_balance_species,
138  const std::vector<std::string> & constrained_species,
139  const std::vector<Real> & constraint_value,
140  const std::vector<GeochemistryUnitConverter::GeochemistryUnit> & constraint_unit,
141  const std::vector<ConstraintUserMeaningEnum> & constraint_user_meaning,
142  Real initial_temperature,
143  unsigned iters_to_make_consistent,
144  Real min_initial_molality,
145  const std::vector<std::string> & kin_name,
146  const std::vector<Real> & kin_initial,
147  const std::vector<GeochemistryUnitConverter::GeochemistryUnit> & kin_unit);
148 
158  {
159  if (this == &src) // trivial a=a situation
160  return *this;
161  // check for bad assignment situations. Other "const" things that
162  // needn't be the same (but probably actually are) include: _swap_out and _swap_in
163  if (_num_basis != src._num_basis || _num_eqm != src._num_eqm || _num_redox != src._num_redox ||
166  mooseError("GeochemicalSystem: copy assigment operator called with inconsistent fundamental "
167  "properties");
168  // actually do the copying
169  _mgd = src._mgd;
170  _swapper = src._swapper;
171  _gac = src._gac;
172  _is = src._is;
181  _eqm_log10K = src._eqm_log10K;
183  _kin_log10K = src._kin_log10K;
199  _kin_moles = src._kin_moles;
205  return *this;
206  };
207 
211  GeochemicalSystem(const GeochemicalSystem & src) = default;
212 
213  bool operator==(const GeochemicalSystem & rhs) const
214  {
215  return (_mgd == rhs._mgd) && (_num_basis == rhs._num_basis) && (_num_eqm == rhs._num_eqm) &&
217  (_num_kin == rhs._num_kin) && (_swapper == rhs._swapper) &&
218  (_swap_out == rhs._swap_out) && (_swap_in == rhs._swap_in) && (_gac == rhs._gac) &&
228  (_redox_log10K == rhs._redox_log10K) && (_kin_log10K == rhs._kin_log10K) &&
240  (_kin_moles_old == rhs._kin_moles_old) &&
242  (_temperature == rhs._temperature) &&
245  }
246 
248  unsigned getNumInBasis() const;
249 
251  unsigned getNumInEquilibrium() const;
252 
254  unsigned getNumKinetic() const;
255 
257  void initialize();
258 
260  unsigned getChargeBalanceBasisIndex() const;
261 
270  bool alterChargeBalanceSpecies(Real threshold_molality);
271 
276  Real getLog10K(unsigned j) const;
277 
281  unsigned getNumRedox() const;
282 
287  Real getRedoxLog10K(unsigned red) const;
288 
293  Real log10RedoxActivityProduct(unsigned red) const;
294 
299  Real getKineticLog10K(unsigned kin) const;
300 
304  const std::vector<Real> & getKineticLog10K() const;
305 
310  Real log10KineticActivityProduct(unsigned kin) const;
311 
316  Real getKineticMoles(unsigned kin) const;
317 
325  void setKineticMoles(unsigned kin, Real moles);
326 
330  const std::vector<Real> & getKineticMoles() const;
331 
347  void updateOldWithCurrent(const DenseVector<Real> & mole_additions);
348 
353  unsigned getNumInAlgebraicSystem() const;
354 
356  unsigned getNumBasisInAlgebraicSystem() const;
357 
359  unsigned getNumSurfacePotentials() const;
360 
365  const std::vector<bool> & getInAlgebraicSystem() const;
366 
372  const std::vector<unsigned> & getBasisIndexOfAlgebraicSystem() const;
373 
379  const std::vector<unsigned> & getAlgebraicIndexOfBasisSystem() const;
380 
385  std::vector<Real> getAlgebraicVariableValues() const;
386 
392  std::vector<Real> getAlgebraicBasisValues() const;
393 
398  DenseVector<Real> getAlgebraicVariableDenseValues() const;
399 
401  Real getSolventWaterMass() const;
402 
409  const std::vector<Real> & getBulkMolesOld() const;
410 
417  DenseVector<Real> getBulkOldInOriginalBasis() const;
418 
425  DenseVector<Real> getTransportedBulkInOriginalBasis() const;
426 
433  void computeTransportedBulkFromMolalities(std::vector<Real> & transported_bulk) const;
434 
439  const std::vector<Real> & getSolventMassAndFreeMolalityAndMineralMoles() const;
440 
446  const std::vector<bool> & getBasisActivityKnown() const;
447 
451  Real getBasisActivity(unsigned i) const;
452 
456  const std::vector<Real> & getBasisActivity() const;
457 
462  Real getEquilibriumMolality(unsigned j) const;
463 
468  const std::vector<Real> & getEquilibriumMolality() const;
469 
474  Real getBasisActivityCoefficient(unsigned i) const;
475 
480  const std::vector<Real> & getBasisActivityCoefficient() const;
481 
486  Real getEquilibriumActivityCoefficient(unsigned j) const;
487 
492  const std::vector<Real> & getEquilibriumActivityCoefficient() const;
493 
499  Real getTotalChargeOld() const;
500 
513  Real getResidualComponent(unsigned algebraic_ind, const DenseVector<Real> & mole_additions) const;
514 
519 
525 
534  void computeJacobian(const DenseVector<Real> & res,
535  DenseMatrix<Real> & jac,
536  const DenseVector<Real> & mole_additions,
537  const DenseMatrix<Real> & dmole_additions) const;
538 
545  void setAlgebraicVariables(const DenseVector<Real> & algebraic_var);
546 
553  void enforceChargeBalance();
554 
561 
566  std::vector<Real> getSaturationIndices() const;
567 
577  void performSwap(unsigned swap_out_of_basis, unsigned swap_into_basis);
578 
580  Real getIonicStrength() const;
581 
584 
589  Real getSurfacePotential(unsigned sp) const;
590 
595  Real getSurfaceCharge(unsigned sp) const;
596 
600  const std::vector<Real> & getSorbingSurfaceArea() const;
601 
605  Real getTemperature() const;
606 
619  void setTemperature(Real temperature);
620 
672  const std::vector<std::string> & names,
673  const std::vector<Real> & values,
674  const std::vector<bool> & constraints_from_molalities);
675 
679  const std::vector<GeochemicalSystem::ConstraintMeaningEnum> & getConstraintMeaning() const;
680 
688  void closeSystem();
689 
700  void changeConstraintToBulk(unsigned basis_ind);
701 
714  void changeConstraintToBulk(unsigned basis_ind, Real value);
715 
724  void addToBulkMoles(unsigned basis_ind, Real value);
725 
734  void setConstraintValue(unsigned basis_ind, Real value);
735 
771 
775  const std::string & getOriginalRedoxLHS() const;
776 
788  void performSwapNoCheck(unsigned swap_out_of_basis, unsigned swap_into_basis);
789 
793  const GeochemistrySpeciesSwapper & getSwapper() const;
794 
806  void setMineralRelatedFreeMoles(Real value);
807 
815  const std::vector<Real> & computeAndGetEquilibriumActivity();
816 
821  Real getEquilibriumActivity(unsigned eqm_ind) const;
822 
833  void
834  addKineticRates(Real dt, DenseVector<Real> & mole_additions, DenseMatrix<Real> & dmole_additions);
835 
836 private:
840  const unsigned _num_basis;
842  const unsigned _num_eqm;
844  const unsigned _num_redox;
846  const unsigned _num_surface_pot;
848  const unsigned _num_kin;
852  const std::vector<std::string> _swap_out;
854  const std::vector<std::string> _swap_in;
866  std::vector<std::string> _constrained_species;
868  std::vector<Real> _constraint_value;
870  std::vector<Real> _original_constraint_value;
872  std::vector<GeochemistryUnitConverter::GeochemistryUnit> _constraint_unit;
874  std::vector<ConstraintUserMeaningEnum> _constraint_user_meaning;
876  std::vector<ConstraintMeaningEnum> _constraint_meaning;
878  std::vector<Real> _eqm_log10K;
880  std::vector<Real> _redox_log10K;
882  std::vector<Real> _kin_log10K;
888  std::vector<bool> _in_algebraic_system;
890  std::vector<unsigned> _algebraic_index;
892  std::vector<unsigned> _basis_index;
894  std::vector<Real> _bulk_moles_old;
901  std::vector<Real> _basis_molality;
903  std::vector<bool> _basis_activity_known;
905  std::vector<Real> _basis_activity;
907  std::vector<Real> _eqm_molality;
909  std::vector<Real> _basis_activity_coef;
911  std::vector<Real> _eqm_activity_coef;
917  std::vector<Real> _eqm_activity;
924  std::vector<Real> _surface_pot_expr;
926  std::vector<Real> _sorbing_surface_area;
928  std::vector<Real> _kin_moles;
930  std::vector<Real> _kin_moles_old;
946  std::string _original_redox_lhs;
947 
953 
955  void buildAlgebraicInfo(std::vector<bool> & in_algebraic_system,
956  unsigned & num_basis_in_algebraic_system,
957  unsigned & num_in_algebraic_system,
958  std::vector<unsigned> & algebraic_index,
959  std::vector<unsigned> & basis_index) const;
960 
970  void initBulkAndFree(std::vector<Real> & bulk_moles_old,
971  std::vector<Real> & basis_molality) const;
972 
978  void buildKnownBasisActivities(std::vector<bool> & basis_activity_known,
979  std::vector<Real> & basis_activity) const;
980 
986  void computeRemainingBasisActivities(std::vector<Real> & basis_activity) const;
987 
992  void updateBasisMolalityForKnownActivity(std::vector<Real> & basis_molality) const;
993 
997  Real log10ActivityProduct(unsigned eqm_j) const;
998 
1002  void computeEqmMolalities(std::vector<Real> & eqm_molality) const;
1003 
1010  void enforceChargeBalanceIfSimple(std::vector<Real> & constraint_value,
1011  std::vector<Real> & bulk_moles_old) const;
1012 
1018  void computeBulk(std::vector<Real> & bulk_moles_old) const;
1019 
1025  void enforceChargeBalance(std::vector<Real> & constraint_value,
1026  std::vector<Real> & bulk_moles_old) const;
1027 
1033  void computeFreeMineralMoles(std::vector<Real> & basis_molality) const;
1034 
1043  void
1044  checkAndInitialize(const std::vector<std::string> & kin_name,
1045  const std::vector<Real> & kin_initial,
1046  const std::vector<GeochemistryUnitConverter::GeochemistryUnit> & kin_unit);
1047 
1054  void setChargeBalanceSpecies(unsigned new_charge_balance_index);
1055 
1064  Real surfaceSorptionModifier(unsigned eqm_j) const;
1065 
1071  Real surfacePotPrefactor(unsigned sp) const;
1072 
1074  void computeSorbingSurfaceArea(std::vector<Real> & sorbing_surface_area) const;
1075 
1083  Real computeBulkFromMolalities(unsigned basis_ind) const;
1084 
1093 };
void initialize()
initialize all variables, ready for a Newton solve of the algebraic system
void computeConsistentConfiguration()
Compute a reasonably consistent configuration that can be used as an initial condition in a Newton pr...
std::vector< Real > getAlgebraicBasisValues() const
Real getTemperature() const
const unsigned _num_kin
number of kinetic species
ConstraintUserMeaningEnum
Each basis species must be provided with a constraint, that is chosen by the user from the following ...
DenseVector< Real > getBulkOldInOriginalBasis() const
std::vector< bool > _basis_activity_known
whether basis_activity[i] is fixed by the user
Real surfaceSorptionModifier(unsigned eqm_j) const
const std::vector< Real > & getKineticMoles() const
Real getIonicStrength() const
Get the ionic strength.
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 w...
const std::vector< Real > & getBasisActivity() const
const std::vector< std::string > _swap_in
Species to immediately add to the basis in favor of _swap_out.
void changeConstraintToBulk(unsigned basis_ind)
Changes the constraint to MOLES_BULK_SPECIES (or MOLES_BULK_WATER if basis_ind = 0) for the basis ind...
const unsigned _num_basis
number of basis species
std::vector< Real > _basis_molality
IMPORTANT: this is.
std::vector< Real > _kin_log10K
equilibrium constant of the kinetic species
const std::vector< Real > & getBulkMolesOld() const
std::string _original_redox_lhs
The left-hand-side of the redox equations in _mgd after initial swaps.
std::vector< unsigned > _algebraic_index
_algebraic_index[i] = index in the algebraic system of the basis species i. _basis_index[_algebraic_i...
void setChargeBalanceSpecies(unsigned new_charge_balance_index)
Set the charge-balance species to the basis index provided.
GeochemistryActivityCoefficients & _gac
Object to compute the activity coefficients and activity of water.
void mooseError(Args &&... args)
Real _min_initial_molality
Minimum molality ever used in an initial guess.
std::vector< Real > _basis_activity_coef
basis activity coefficients
std::vector< Real > _eqm_activity
equilibrium activities.
Real log10ActivityProduct(unsigned eqm_j) const
bool operator==(const GeochemicalSystem &rhs) const
const ModelGeochemicalDatabase mgd
void alterSystemBecauseBulkChanged()
Alter the GeochemicalSystem to reflect changes in bulk composition constraints that occur through...
void computeTransportedBulkFromMolalities(std::vector< Real > &transported_bulk) const
Computes the value of transported bulk moles for all basis species using the existing molalities...
std::vector< Real > _kin_moles_old
old mole number of kinetic species
std::vector< ConstraintUserMeaningEnum > _constraint_user_meaning
The user-defined meaning of the values in _constraint_value. In the constructor, this is ordered to h...
Real _temperature
The temperature in degC.
const unsigned _num_redox
number of redox species
std::vector< bool > _in_algebraic_system
if _in_algebraic_system[i] == true then we need to solve for the i^th basis-species molality ...
Real surfacePotPrefactor(unsigned sp) const
Real log10KineticActivityProduct(unsigned kin) const
void computeBulk(std::vector< Real > &bulk_moles_old) const
Computes the value of bulk_moles_old for all basis species.
unsigned getChargeBalanceBasisIndex() const
return the index of the charge-balance species in the basis list
std::vector< Real > _basis_activity
values of activity (for water, minerals and aqueous basis species) or fugacity (for gases) ...
static const std::string temperature
Definition: NS.h:59
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...
void buildTemperatureDependentQuantities(Real temperature)
Using the provided value of temperature, build _eqm_log10K for each eqm species and redox species...
GeochemicalSystem & operator=(const GeochemicalSystem &src)
Copy assignment operator.
unsigned getNumKinetic() const
returns the number of kinetic species
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.
void computeSorbingSurfaceArea(std::vector< Real > &sorbing_surface_area) const
Compute sorbing_surface_area depending on the current molality of the sorbing minerals.
std::vector< std::string > _constrained_species
Names of the species in that have their values fixed to _constraint_value with meanings _constraint_m...
const std::vector< Real > & computeAndGetEquilibriumActivity()
Computes activity for all equilibrium species (_eqm_activity) and returns a reference to the vector...
std::vector< Real > _redox_log10K
equilibrium constant of the redox species
unsigned getNumInBasis() const
returns the number of species in the basis
const std::vector< Real > & getKineticLog10K() const
std::vector< Real > _sorbing_surface_area
surface areas of the sorbing minerals
GeochemistryIonicStrength & _is
Object that provides the ionic strengths.
std::vector< Real > _constraint_value
Numerical values of the constraints on _constraint_species. In the constructor, this is ordered to ha...
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.
unsigned _iters_to_make_consistent
Iterations to make the initial configuration consistent.
ConstraintMeaningEnum
Each basis species has one of the following constraints.
std::vector< Real > _bulk_moles_old
Number of bulk moles of basis species (this includes contributions from kinetic species, in contrast to Bethke)
Real getTotalChargeOld() const
void setKineticMoles(unsigned kin, Real moles)
Sets the current AND old mole number for a kinetic species.
Class to swap basis species with equilibrium species.
std::vector< Real > _kin_moles
mole number of kinetic species
const std::vector< Real > & getEquilibriumActivityCoefficient() const
GeochemistrySpeciesSwapper & _swapper
swapper that can swap species into and out of the basis
Real getEquilibriumActivity(unsigned eqm_ind) const
Returns the value of activity for the equilibrium species with index eqm_index.
std::string _charge_balance_species
The species used to enforce charge balance.
Real getStoichiometricIonicStrength() const
Get the stoichiometric ionic strength.
unsigned getNumInAlgebraicSystem() const
std::vector< Real > _original_constraint_value
Numerical values of the constraints on _constraint_species. In the constructor, this is ordered to ha...
std::vector< Real > _surface_pot_expr
surface potential expressions.
const std::string _original_charge_balance_species
The species used to enforce charge balance, as provided in the constructor.
const std::vector< Real > & getSorbingSurfaceArea() const
const std::vector< Real > & getBasisActivityCoefficient() const
Calculators to compute ionic strength and stoichiometric ionic strength.
Base class to compute activity coefficients for non-minerals and non-gases (since these species do no...
const ModelGeochemicalDatabase & getModelGeochemicalDatabase() const
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.
std::vector< GeochemistryUnitConverter::GeochemistryUnit > _constraint_unit
Units of the _constraint_value when the GeochemicalSystem is constructed. This is used during the con...
Real computeBulkFromMolalities(unsigned basis_ind) const
std::vector< ConstraintMeaningEnum > _constraint_meaning
The meaning of the values in _constraint_value. In the constructor, this is ordered to have the same ...
void enforceChargeBalance()
Enforces charge balance by altering the constraint_value and bulk_moles_old of the charge-balance spe...
const std::vector< unsigned > & getAlgebraicIndexOfBasisSystem() const
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 m...
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...
Real getRedoxLog10K(unsigned red) const
bool revertToOriginalChargeBalanceSpecies()
Changes the charge-balance species to the original that is specified in the constructor (this might n...
std::vector< unsigned > _basis_index
_basis_index[i] = index in the basis of the algebraic system species i, for i<num_basis_in_algebraic_...
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.
void setModelGeochemicalDatabase(const ModelGeochemicalDatabase &mgd)
Copies a ModelGeochemicalDatabase into our _mgd structure.
unsigned getNumRedox() const
void computeEqmMolalities(std::vector< Real > &eqm_molality) const
compute the equilibrium molalities (not for minerals or gases)
unsigned _num_in_algebraic_system
number of unknowns in the algebraic system (includes molalities and surface potentials) ...
Real getLog10K(unsigned j) const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const unsigned _num_surface_pot
number of surface potentials
Real getSurfacePotential(unsigned sp) const
std::vector< Real > getAlgebraicVariableValues() const
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 initializ...
void updateBasisMolalityForKnownActivity(std::vector< Real > &basis_molality) const
For basis aqueous species (not water, minerals or gases) with activity set by the user...
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 a...
unsigned getNumSurfacePotentials() const
return the number of surface potentials
void setTemperature(Real temperature)
Sets the temperature to the given quantity.
const unsigned _num_eqm
number of equilibrium species
std::vector< Real > _eqm_molality
molality of equilibrium species
This class holds information about bulk composition, molalities, activities, activity coefficients...
Real getResidualComponent(unsigned algebraic_ind, const DenseVector< Real > &mole_additions) const
Return the residual of the algebraic system for the given algebraic index.
Real log10RedoxActivityProduct(unsigned red) const
std::vector< Real > _eqm_log10K
equilibrium constant of the equilibrium species
ModelGeochemicalDatabase & _mgd
The minimal geochemical database.
void setSolventMassAndFreeMolalityAndMineralMolesAndSurfacePotsAndKineticMoles(const std::vector< std::string > &names, const std::vector< Real > &values, const std::vector< bool > &constraints_from_molalities)
Sets:
void setAlgebraicVariables(const DenseVector< Real > &algebraic_var)
Set the variables in the algebraic system (molalities and potentially the mass of solvent water...
Data structure to hold all relevant information from the database file.
std::vector< Real > _eqm_activity_coef
equilibrium activity coefficients
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
void performSwapNoCheck(unsigned swap_out_of_basis, unsigned swap_into_basis)
Perform the basis swap, and ensure that the resulting system is consistent.
const std::vector< Real > & getSolventMassAndFreeMolalityAndMineralMoles() const
Real getSolventWaterMass() const
Returns the mass of solvent water.
DenseVector< Real > getTransportedBulkInOriginalBasis() const
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.
const std::vector< bool > & getInAlgebraicSystem() const
const GeochemistrySpeciesSwapper & getSwapper() const
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...
const std::vector< bool > & getBasisActivityKnown() const
DenseVector< Real > getAlgebraicVariableDenseValues() const
void performSwap(unsigned swap_out_of_basis, unsigned swap_into_basis)
Perform the basis swap, and ensure that the resulting system is consistent.
void setConstraintValue(unsigned basis_ind, Real value)
Set the constraint value for the basis species.
unsigned getNumInEquilibrium() const
returns the number of species in equilibrium with the basis components
const std::vector< std::string > _swap_out
Species to immediately remove from the basis in favor of _swap_in.
unsigned getNumBasisInAlgebraicSystem() const
return the number of basis species in the algebraic system
void closeSystem()
Changes a KG_SOLVENT_WATER constraint to MOLES_BULK_WATER (if there is such a constraint) and all FRE...
const std::vector< unsigned > & getBasisIndexOfAlgebraicSystem() const
void setMineralRelatedFreeMoles(Real value)
Set the free mole number of mineral-related species to the value provided.
const std::vector< Real > & getEquilibriumMolality() const
Real getSurfaceCharge(unsigned sp) const
const std::vector< GeochemicalSystem::ConstraintMeaningEnum > & getConstraintMeaning() const
const std::string & getOriginalRedoxLHS() const
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&#39;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
unsigned _num_basis_in_algebraic_system
number of unknown molalities in the algebraic system. Note: surface potentials (if any) are extra qua...
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 _bas...
std::vector< Real > getSaturationIndices() const