21 params.
addParam<
unsigned int>(
"precision", 4,
"Precision for printing values");
25 "Information regarding species with molalities less than this amount will not be outputted");
29 "Print information (to the console) from the solver including residuals, swaps, etc");
39 "The name of the GeochemistryReactor UserObject");
42 "stoichiometry_tolerance >= 0.0",
43 "if abs(any stoichiometric coefficient) < stoi_tol then it is " 44 "set to zero, and so will not appear in the output");
46 "nearest_node_number_UO",
47 "The NearestNodeNumber UserObject that defines the physical point at which to query the " 48 "GeochemistryReactor");
49 params.
addClassDescription(
"Outputs results from a GeochemistryReactor at a particular point");
58 _precision(getParam<unsigned
int>(
"precision")),
59 _stoi_tol(getParam<
Real>(
"stoichiometry_tolerance")),
60 _solver_info(getParam<bool>(
"solver_info")),
61 _mol_cutoff(getParam<
Real>(
"mol_cutoff"))
99 _console <<
" (charge-balance species = " 102 _console <<
"Mass of solvent water = " << basis_molality[0] <<
"kg\n";
105 for (
unsigned i = 1; i < num_basis; ++i)
107 _console <<
"Total mass = " << mass <<
"kg";
112 _console <<
" (including kinetic species and free minerals)\n";
113 for (
unsigned k = 0;
k < num_kin; ++
k)
115 _console <<
"Mass without kinetic species but including free minerals = " << mass <<
"kg\n";
118 for (
unsigned i = 1; i < num_basis; ++i)
122 for (
const auto & name_info :
124 for (
const auto & name_frac :
125 name_info.second.sorption_sites)
131 _console <<
"Mass of aqueous solution = " << mass <<
"kg";
133 _console <<
" (without free minerals)\n";
135 _console <<
" (without kinetic species and without free minerals)\n";
153 <<
"mol/kg(solvent water)\n";
156 _console <<
"Activity of water = " << basis_activity[0] <<
"\n";
162 std::vector<unsigned> basis_order =
165 for (
const auto & i : basis_order)
171 <<
"mol; bulk_conc = " 175 _console <<
" molality = " << basis_molality[i] <<
"mol/kg(solvent water); free_conc = " 176 << basis_molality[i] * basis_molality[0] / mass *
178 <<
"mg/kg(soln); act_coeff = " << basis_act_coef[i]
179 <<
"; log10(a) = " << std::log10(basis_activity[i]) <<
"\n";
181 _console <<
" free_moles = " << basis_molality[i] <<
"mol; free_mass = " 184 for (
unsigned i = 0; i < num_basis; ++i)
190 _console <<
"\nEquilibrium Species:\n";
191 for (
const auto & i : eqm_order)
198 <<
"mol/kg(solvent water); free_conc = " 201 <<
"mg/kg(soln); act_coeff = " << eqm_act_coef[i]
202 <<
"; log10(a) = " << std::log10(eqm_molality[i] * eqm_act_coef[i]) <<
"; " 206 <<
"; log10K = " << egs.
getLog10K(i) <<
"\n";
207 for (
unsigned i = 0; i < num_eqm; ++i)
211 for (
unsigned basis_i = 0; basis_i < num_basis; ++basis_i)
220 <<
"; log10K = " << egs.
getLog10K(i) <<
"\n";
226 for (
const auto &
k : kin_order)
245 for (
const auto & i : mineral_order)
250 <<
"; log10K = " << egs.
getLog10K(i) <<
"; SI = " << eqm_SI[i] <<
"\n";
253 _console <<
"\nNernst potentials:\n";
260 _console <<
"\nSorbing surfaces:\n";
262 for (
unsigned sp = 0; sp < num_pot; ++sp)
270 std::vector<std::string> original_basis_names =
272 _console <<
"\nIn original basis:\n";
273 for (
unsigned i = 0; i < num_basis; ++i)
274 _console << original_basis_names[i] <<
"; total_bulk_moles = " << bulk_in_original_basis(i)
275 <<
"; transported_bulk_moles = " << transported_bulk_in_original_basis(i) <<
"\n";
301 for (
int sw = have_swapped_out_of_basis.size() - 1; sw >= 0; --sw)
313 const std::string to_swap_in = mgd_ref.
eqm_species_name[have_swapped_into_basis[sw]];
314 const std::string to_swap_out = mgd_ref.
basis_species_name[have_swapped_out_of_basis[sw]];
316 mooseWarning(
"Swapping ", to_swap_out,
" and ", to_swap_in,
": ", e.
what());
330 for (
const auto & red : eh_order)
337 <<
"; Eh = " << eh[red] <<
"V\n";
DenseMatrix< Real > redox_stoichiometry
redox_stoichiometry(i, j) = stoichiometric coefficients for i^th redox species that is in disequilibr...
virtual unsigned getSolverIterations(dof_id_type node_id) const =0
std::vector< Real > eqm_species_molecular_weight
all quantities have a molecular weight (g)
Real getTemperature() const
DenseVector< Real > getBulkOldInOriginalBasis() const
constexpr Real MOLES_PER_KG_WATER
std::string redox_lhs
the name of the species on the left-hand side of the redox equations.
std::vector< bool > kin_species_mineral
kin_species_mineral[j] = true iff the j^th kinetic species is a mineral
Real getIonicStrength() const
Get the ionic strength.
virtual const char * what() const
std::vector< std::string > surface_sorption_name
surface_sorption_name[k] = name of the mineral involved in surface sorption.
const std::vector< Real > & getBulkMolesOld() const
virtual void output() override
Real getBasisActivityCoefficient(unsigned i) const
constexpr Real CELSIUS_TO_KELVIN
std::vector< bool > eqm_species_gas
eqm_species_gas[i] = true iff the i^th equilibrium species is a gas
Outputs information (to the console) from a GeochemistryReactorBase at a point.
std::unordered_map< std::string, unsigned > basis_species_index
basis_species_index[name] = index of the basis species, within all ModelGeochemicalDatabase internal ...
const ModelGeochemicalDatabase mgd
const Real _stoi_tol
Tolerance on stoichiometric coefficients before they are deemed to be zero.
DenseMatrix< Real > kin_stoichiometry
kin_stoichiometry(i, j) = stoichiometric coefficient for kinetic species "i" in terms of the basis sp...
std::vector< Real > kin_species_molecular_weight
all quantities have a molecular weight (g/mol)
virtual const std::stringstream & getSolverOutput(dof_id_type node_id) const =0
std::vector< Real > kin_species_molecular_volume
all quantities have a molecular volume (cm^3/mol) (only nonzero for minerals, however) ...
const NearestNodeNumberUO & _nnn
UserObject defining the node of interest.
std::unordered_map< std::string, unsigned > eqm_species_index
eqm_species_index[name] = index of the equilibrium species (secondary aqueous species, redox couples in equilibrium with the aqueous solution, minerals in equilibrium with the aqueous solution, gases in equilibrium with the aqueous solution) within all ModelGeochemicalDatabase internal datastrcutres, with given name
Real log10KineticActivityProduct(unsigned kin) const
unsigned getChargeBalanceBasisIndex() const
return the index of the charge-balance species in the basis list
virtual Real getSolverResidual(dof_id_type node_id) const =0
unsigned getNumKinetic() const
returns the number of kinetic species
const Node * getClosestNode() const
void outputNernstInfo(const GeochemicalSystem &egs_ref) const
void mooseWarning(Args &&... args) const
unsigned getNumInBasis() const
returns the number of species in the basis
static InputParameters sharedParams()
contains params that are shared with Actions that use this object
DenseMatrix< Real > eqm_stoichiometry
eqm_stoichiometry(i, j) = stoichiometric coefficient for equilibrium species "i" in terms of the basi...
Real getTotalChargeOld() const
Real getBasisActivity(unsigned i) const
Real getStoichiometricIonicStrength() const
Get the stoichiometric ionic strength.
virtual const GeochemicalSystem & getGeochemicalSystem(dof_id_type node_id) const =0
const bool _solver_info
Whether to print solver info.
const Real _mol_cutoff
Species with molalities less than mol_cutoff will not be outputted.
Real getKineticMoles(unsigned kin) const
Real getKineticLog10K(unsigned kin) const
const std::vector< Real > & getSorbingSurfaceArea() const
const ModelGeochemicalDatabase & getModelGeochemicalDatabase() const
const unsigned _precision
precision of output
std::vector< unsigned > sortedIndices(const std::vector< Real > &to_sort, bool ascending)
Produces a vector of indices corresponding to the smallest-to-biggest entries in to_sort (or biggest-...
registerMooseObject("GeochemistryApp", GeochemistryConsoleOutput)
virtual const DenseVector< Real > & getMoleAdditions(dof_id_type node_id) const =0
Real getRedoxLog10K(unsigned red) const
std::vector< Real > basis_species_molecular_weight
all quantities have a molecular weight (g)
const GeochemistryReactorBase & _reactor
the Reactor from which to extract info
void setModelGeochemicalDatabase(const ModelGeochemicalDatabase &mgd)
Copies a ModelGeochemicalDatabase into our _mgd structure.
Real getLog10K(unsigned j) const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Real getSurfacePotential(unsigned sp) const
unsigned getNumSurfacePotentials() const
return the number of surface potentials
std::vector< std::string > originalBasisNames() const
Real getEquilibriumMolality(unsigned j) const
constexpr Real GAS_CONSTANT
This class holds information about bulk composition, molalities, activities, activity coefficients...
Real log10RedoxActivityProduct(unsigned red) const
std::vector< unsigned > have_swapped_into_basis
Species that have been swapped into the basis.
std::vector< bool > basis_species_gas
basis_species_gas[j] = true iff the j^th basis species is a gas
std::vector< bool > basis_species_mineral
basis_species_mineral[j] = true iff the j^th basis species is a mineral
Real getEquilibriumActivityCoefficient(unsigned j) const
std::vector< std::string > kin_species_name
kin_species_name[j] = name of the j^th kinetic species
Data structure to hold all relevant information from the database file.
std::vector< bool > eqm_species_mineral
eqm_species_mineral[i] = true iff the i^th equilibrium species is a mineral
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
const ConsoleStream _console
DenseVector< Real > getTransportedBulkInOriginalBasis() const
Base class that controls the spatio-temporal solution of geochemistry reactions.
GeochemistryConsoleOutput(const InputParameters ¶meters)
unsigned getNumInEquilibrium() const
returns the number of species in equilibrium with the basis components
std::unordered_map< std::string, SurfaceComplexationInfo > surface_complexation_info
Holds info on surface complexation, if any, in the model.
MooseUnits pow(const MooseUnits &, int)
static InputParameters validParams()
std::vector< std::string > eqm_species_name
eqm_species_name[i] = name of the i^th eqm species
static const std::string k
static InputParameters validParams()
Real getSurfaceCharge(unsigned sp) const
void ErrorVector unsigned int
std::vector< std::string > basis_species_name
basis_species_name[j] = name of the j^th basis species
const std::string & getOriginalRedoxLHS() const
const PertinentGeochemicalSystem & getPertinentGeochemicalSystem() const
returns a reference to the PertinentGeochemicalSystem used to creat the ModelGeochemicalDatabase ...
std::vector< unsigned > have_swapped_out_of_basis
Species that have been swapped out of the basis.
std::vector< Real > getSaturationIndices() const