https://mooseframework.inl.gov
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 
63 void
65 {
67 }
68 void
70 {
72 }
73 
74 void
76 {
78 }
79 
80 void
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);
87  _solver_output[0],
88  _tot_iter[0],
89  _abs_residual[0],
90  0.0,
92  dmole_additions);
93 }
94 
95 const GeochemicalSystem &
97 {
98  return _egs;
99 }
100 
101 const std::stringstream &
103 {
104  return _solver_output[0];
105 }
106 
108 {
109  return _tot_iter[0];
110 }
111 
113 {
114  return _abs_residual[0];
115 }
116 
117 const DenseVector<Real> &
119 {
120  return _mole_additions;
121 }
122 
123 Real
125  const std::string & /*species*/) const
126 {
127  return 0.0;
128 }
const unsigned _num_basis
number of basis species
virtual void finalize() override
virtual void execute() override
static InputParameters validParams()
std::vector< unsigned > _tot_iter
Number of iterations used by the solver at each node.
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
virtual unsigned getSolverIterations(dof_id_type node_id) const override
T & set(const std::string &name, bool quiet_mode=false)
virtual Real getSolverResidual(dof_id_type node_id) const override
registerMooseObject("GeochemistryApp", GeochemistryTimeIndependentReactor)
const unsigned _num_my_nodes
Number of nodes handled by this processor (will need to be made un-const when mesh adaptivity is hand...
DenseVector< Real > _mole_additions
mole additions: these are always zero but are used in getMoleAdditions and the solve ...
Class that controls the time independent (and spatially independent) geochemistry reactions...
std::vector< std::stringstream > _solver_output
The solver output at each node.
GeochemistryTimeIndependentReactor(const InputParameters &parameters)
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.
virtual void initialize() override
GeochemicalSystem _egs
The equilibrium geochemical system that holds all the molalities, activities, etc.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
std::vector< Real > _abs_residual
L1norm of the solver residual at each node.
virtual const GeochemicalSystem & getGeochemicalSystem(dof_id_type node_id) const override
virtual Real getMolesDumped(dof_id_type node_id, const std::string &species) const override
This class holds information about bulk composition, molalities, activities, activity coefficients...
void addClassDescription(const std::string &doc_string)
Base class that controls the spatio-temporal solution of geochemistry reactions.
const ExecFlagType EXEC_FINAL
uint8_t dof_id_type
virtual const DenseVector< Real > & getMoleAdditions(dof_id_type node_id) const override
virtual const std::stringstream & getSolverOutput(dof_id_type node_id) const override