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"))
71 const dof_id_type closest_id = closest_node->id();
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";
const ModelGeochemicalDatabase mgd
registerMooseObject("GeochemistryApp", GeochemistryConsoleOutput)
void ErrorVector unsigned int
const ConsoleStream _console
This class holds information about bulk composition, molalities, activities, activity coefficients,...
Real log10KineticActivityProduct(unsigned kin) const
std::vector< Real > getSaturationIndices() const
unsigned getNumKinetic() const
returns the number of kinetic species
Real getLog10K(unsigned j) const
Real getEquilibriumActivityCoefficient(unsigned j) const
const std::vector< Real > & getSorbingSurfaceArea() const
const std::string & getOriginalRedoxLHS() const
Real log10RedoxActivityProduct(unsigned red) const
Real getKineticLog10K(unsigned kin) const
Real getRedoxLog10K(unsigned red) const
Real getSurfacePotential(unsigned sp) const
unsigned getNumSurfacePotentials() const
return the number of surface potentials
unsigned getNumInBasis() const
returns the number of species in the basis
Real getKineticMoles(unsigned kin) const
unsigned getNumInEquilibrium() const
returns the number of species in equilibrium with the basis components
unsigned getChargeBalanceBasisIndex() const
return the index of the charge-balance species in the basis list
Real getTotalChargeOld() const
DenseVector< Real > getTransportedBulkInOriginalBasis() const
Real getStoichiometricIonicStrength() const
Get the stoichiometric ionic strength.
Real getBasisActivityCoefficient(unsigned i) const
const std::vector< Real > & getBulkMolesOld() const
const ModelGeochemicalDatabase & getModelGeochemicalDatabase() const
Real getIonicStrength() const
Get the ionic strength.
const std::vector< Real > & getSolventMassAndFreeMolalityAndMineralMoles() const
void performSwapNoCheck(unsigned swap_out_of_basis, unsigned swap_into_basis)
Perform the basis swap, and ensure that the resulting system is consistent.
DenseVector< Real > getBulkOldInOriginalBasis() const
Real getSurfaceCharge(unsigned sp) const
Real getBasisActivity(unsigned i) const
Real getEquilibriumMolality(unsigned j) const
void setModelGeochemicalDatabase(const ModelGeochemicalDatabase &mgd)
Copies a ModelGeochemicalDatabase into our _mgd structure.
Real getTemperature() const
Outputs information (to the console) from a GeochemistryReactorBase at a point.
const Real _stoi_tol
Tolerance on stoichiometric coefficients before they are deemed to be zero.
const GeochemistryReactorBase & _reactor
the Reactor from which to extract info
GeochemistryConsoleOutput(const InputParameters ¶meters)
const bool _solver_info
Whether to print solver info.
static InputParameters validParams()
const unsigned _precision
precision of output
const Real _mol_cutoff
Species with molalities less than mol_cutoff will not be outputted.
void outputNernstInfo(const GeochemicalSystem &egs_ref) const
static InputParameters sharedParams()
contains params that are shared with Actions that use this object
const NearestNodeNumberUO & _nnn
UserObject defining the node of interest.
virtual void output() override
Base class that controls the spatio-temporal solution of geochemistry reactions.
virtual const GeochemicalSystem & getGeochemicalSystem(dof_id_type node_id) const =0
virtual Real getSolverResidual(dof_id_type node_id) const =0
virtual const DenseVector< Real > & getMoleAdditions(dof_id_type node_id) const =0
const PertinentGeochemicalSystem & getPertinentGeochemicalSystem() const
returns a reference to the PertinentGeochemicalSystem used to creat the ModelGeochemicalDatabase
virtual const std::stringstream & getSolverOutput(dof_id_type node_id) const =0
virtual unsigned getSolverIterations(dof_id_type node_id) const =0
void mooseWarning(Args &&... args) const
virtual const char * what() const
const Node * getClosestNode() const
static InputParameters validParams()
std::vector< std::string > originalBasisNames() const
constexpr Real GAS_CONSTANT
constexpr Real CELSIUS_TO_KELVIN
constexpr Real MOLES_PER_KG_WATER
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-...
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
DenseMatrix< Real > eqm_stoichiometry
eqm_stoichiometry(i, j) = stoichiometric coefficient for equilibrium species "i" in terms of the basi...
std::vector< Real > basis_species_molecular_weight
all quantities have a molecular weight (g)
DenseMatrix< Real > kin_stoichiometry
kin_stoichiometry(i, j) = stoichiometric coefficient for kinetic species "i" in terms of the basis sp...
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
std::vector< Real > eqm_species_molecular_weight
all quantities have a molecular weight (g)
std::vector< unsigned > have_swapped_into_basis
Species that have been swapped into the basis.
std::vector< std::string > kin_species_name
kin_species_name[j] = name of the j^th kinetic species
DenseMatrix< Real > redox_stoichiometry
redox_stoichiometry(i, j) = stoichiometric coefficients for i^th redox species that is in disequilibr...
std::vector< bool > basis_species_mineral
basis_species_mineral[j] = true iff the j^th basis species is a mineral
std::vector< Real > kin_species_molecular_volume
all quantities have a molecular volume (cm^3/mol) (only nonzero for minerals, however)
std::unordered_map< std::string, SurfaceComplexationInfo > surface_complexation_info
Holds info on surface complexation, if any, in the model.
std::vector< unsigned > have_swapped_out_of_basis
Species that have been swapped out of the basis.
std::unordered_map< std::string, unsigned > eqm_species_index
eqm_species_index[name] = index of the equilibrium species (secondary aqueous species,...
std::vector< std::string > basis_species_name
basis_species_name[j] = name of the j^th basis species
std::unordered_map< std::string, unsigned > basis_species_index
basis_species_index[name] = index of the basis species, within all ModelGeochemicalDatabase internal ...
std::vector< std::string > surface_sorption_name
surface_sorption_name[k] = name of the mineral involved in surface sorption.
std::vector< bool > basis_species_gas
basis_species_gas[j] = true iff the j^th basis species is a gas
std::vector< std::string > eqm_species_name
eqm_species_name[i] = name of the i^th eqm species
std::vector< bool > eqm_species_gas
eqm_species_gas[i] = true iff the i^th equilibrium species is a gas
std::vector< Real > kin_species_molecular_weight
all quantities have a molecular weight (g/mol)