https://mooseframework.inl.gov
Loading...
Searching...
No Matches
GeochemistryTimeIndependentReactor.C
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
11
13
16{
18 params.addParam<Real>("temperature", 25.0, "The temperature (degC) of the aqueous solution");
19 params.addClassDescription("UserObject that controls the time-independent geochemistry reaction "
20 "processes. Spatial dependence is not possible using this class");
21 params.set<ExecFlagEnum>("execute_on") = {EXEC_FINAL};
22 return params;
23}
24
26 const InputParameters & parameters)
27 : GeochemistryReactorBase(parameters),
28 _temperature(getParam<Real>("temperature")),
29 _egs(_mgd,
30 _gac,
31 _is,
32 _swapper,
33 getParam<std::vector<std::string>>("swap_out_of_basis"),
34 getParam<std::vector<std::string>>("swap_into_basis"),
35 getParam<std::string>("charge_balance_species"),
36 getParam<std::vector<std::string>>("constraint_species"),
37 getParam<std::vector<Real>>("constraint_value"),
38 getParam<MultiMooseEnum>("constraint_unit"),
39 getParam<MultiMooseEnum>("constraint_meaning"),
40 _temperature,
41 getParam<unsigned>("extra_iterations_to_make_consistent"),
42 getParam<Real>("min_initial_molality"),
43 {},
44 {},
45 MultiMooseEnum("")),
46 _solver(_mgd.basis_species_name.size(),
47 _mgd.kin_species_name.size(),
48 _is,
49 getParam<Real>("abs_tol"),
50 getParam<Real>("rel_tol"),
51 getParam<unsigned>("max_iter"),
52 getParam<Real>("max_initial_residual"),
53 _small_molality,
54 _max_swaps_allowed,
55 getParam<std::vector<std::string>>("prevent_precipitation"),
56 getParam<Real>("max_ionic_strength"),
57 getParam<unsigned>("ramp_max_ionic_strength_initial"),
58 false),
59 _mole_additions(DenseVector<Real>(_num_basis, 0.0))
60{
61}
62
63void
68void
73
74void
79
80void
82{
83 if (_num_my_nodes == 0)
84 return; // rather peculiar case where user has used many processors
85 DenseMatrix<Real> dmole_additions(_num_basis, _num_basis);
88 _tot_iter[0],
90 0.0,
92 dmole_additions);
93}
94
97{
98 return _egs;
99}
100
101const std::stringstream &
103{
104 return _solver_output[0];
105}
106
107unsigned
109{
110 return _tot_iter[0];
111}
112
113Real
115{
116 return _abs_residual[0];
117}
118
119const DenseVector<Real> &
121{
122 return _mole_additions;
123}
124
125Real
127 const std::string & /*species*/) const
128{
129 return 0.0;
130}
registerMooseObject("GeochemistryApp", GeochemistryTimeIndependentReactor)
const ExecFlagType EXEC_FINAL
void solveSystem(GeochemicalSystem &egs, std::stringstream &ss, unsigned &tot_iter, Real &abs_residual, Real dt, DenseVector< Real > &mole_additions, DenseMatrix< Real > &dmole_additions)
Solve the system.
This class holds information about bulk composition, molalities, activities, activity coefficients,...
Base class that controls the spatio-temporal solution of geochemistry reactions.
virtual void finalize() override
std::vector< unsigned > _tot_iter
Number of iterations used by the solver at each node.
virtual void initialize() override
static InputParameters validParams()
const unsigned _num_my_nodes
Number of nodes handled by this processor (will need to be made un-const when mesh adaptivity is hand...
std::vector< Real > _abs_residual
L1norm of the solver residual at each node.
virtual void execute() override
const unsigned _num_basis
number of basis species
std::vector< std::stringstream > _solver_output
The solver output at each node.
Class that controls the time independent (and spatially independent) geochemistry reactions.
GeochemistryTimeIndependentReactor(const InputParameters &parameters)
virtual Real getMolesDumped(dof_id_type node_id, const std::string &species) const override
virtual unsigned getSolverIterations(dof_id_type node_id) const override
virtual const DenseVector< Real > & getMoleAdditions(dof_id_type node_id) const override
virtual const GeochemicalSystem & getGeochemicalSystem(dof_id_type node_id) const override
GeochemicalSystem _egs
The equilibrium geochemical system that holds all the molalities, activities, etc.
virtual Real getSolverResidual(dof_id_type node_id) const override
virtual const std::stringstream & getSolverOutput(dof_id_type node_id) const override
DenseVector< Real > _mole_additions
mole additions: these are always zero but are used in getMoleAdditions and the solve
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
T & set(const std::string &name, bool quiet_mode=false)