Line data Source code
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 : #include "GeochemistryTimeIndependentReactor.h"
11 :
12 : registerMooseObject("GeochemistryApp", GeochemistryTimeIndependentReactor);
13 :
14 : InputParameters
15 695 : GeochemistryTimeIndependentReactor::validParams()
16 : {
17 695 : InputParameters params = GeochemistryReactorBase::validParams();
18 1390 : params.addParam<Real>("temperature", 25.0, "The temperature (degC) of the aqueous solution");
19 695 : params.addClassDescription("UserObject that controls the time-independent geochemistry reaction "
20 : "processes. Spatial dependence is not possible using this class");
21 2085 : params.set<ExecFlagEnum>("execute_on") = {EXEC_FINAL};
22 695 : return params;
23 695 : }
24 :
25 402 : GeochemistryTimeIndependentReactor::GeochemistryTimeIndependentReactor(
26 402 : const InputParameters & parameters)
27 : : GeochemistryReactorBase(parameters),
28 402 : _temperature(getParam<Real>("temperature")),
29 3216 : _egs(_mgd,
30 : _gac,
31 402 : _is,
32 402 : _swapper,
33 : getParam<std::vector<std::string>>("swap_out_of_basis"),
34 : getParam<std::vector<std::string>>("swap_into_basis"),
35 804 : 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 402 : _temperature,
41 804 : getParam<unsigned>("extra_iterations_to_make_consistent"),
42 804 : getParam<Real>("min_initial_molality"),
43 : {},
44 : {},
45 804 : MultiMooseEnum("")),
46 1206 : _solver(_mgd.basis_species_name.size(),
47 : _mgd.kin_species_name.size(),
48 : _is,
49 804 : getParam<Real>("abs_tol"),
50 804 : getParam<Real>("rel_tol"),
51 804 : getParam<unsigned>("max_iter"),
52 402 : getParam<Real>("max_initial_residual"),
53 402 : _small_molality,
54 402 : _max_swaps_allowed,
55 : getParam<std::vector<std::string>>("prevent_precipitation"),
56 804 : getParam<Real>("max_ionic_strength"),
57 402 : getParam<unsigned>("ramp_max_ionic_strength_initial"),
58 : false),
59 804 : _mole_additions(DenseVector<Real>(_num_basis, 0.0))
60 : {
61 402 : }
62 :
63 : void
64 345 : GeochemistryTimeIndependentReactor::initialize()
65 : {
66 : GeochemistryReactorBase::initialize();
67 345 : }
68 : void
69 255 : GeochemistryTimeIndependentReactor::finalize()
70 : {
71 : GeochemistryReactorBase::finalize();
72 255 : }
73 :
74 : void
75 330 : GeochemistryTimeIndependentReactor::execute()
76 : {
77 : GeochemistryReactorBase::execute();
78 330 : }
79 :
80 : void
81 345 : GeochemistryTimeIndependentReactor::initialSetup()
82 : {
83 345 : if (_num_my_nodes == 0)
84 120 : return; // rather peculiar case where user has used many processors
85 225 : DenseMatrix<Real> dmole_additions(_num_basis, _num_basis);
86 225 : _solver.solveSystem(_egs,
87 : _solver_output[0],
88 : _tot_iter[0],
89 : _abs_residual[0],
90 : 0.0,
91 225 : _mole_additions,
92 : dmole_additions);
93 225 : }
94 :
95 : const GeochemicalSystem &
96 66165 : GeochemistryTimeIndependentReactor::getGeochemicalSystem(dof_id_type /*node_id*/) const
97 : {
98 66165 : return _egs;
99 : }
100 :
101 : const std::stringstream &
102 147 : GeochemistryTimeIndependentReactor::getSolverOutput(dof_id_type /*node_id*/) const
103 : {
104 147 : return _solver_output[0];
105 : }
106 :
107 147 : unsigned GeochemistryTimeIndependentReactor::getSolverIterations(dof_id_type /*node_id*/) const
108 : {
109 147 : return _tot_iter[0];
110 : }
111 :
112 147 : Real GeochemistryTimeIndependentReactor::getSolverResidual(dof_id_type /*node_id*/) const
113 : {
114 147 : return _abs_residual[0];
115 : }
116 :
117 : const DenseVector<Real> &
118 0 : GeochemistryTimeIndependentReactor::getMoleAdditions(dof_id_type /*node_id*/) const
119 : {
120 0 : return _mole_additions;
121 : }
122 :
123 : Real
124 0 : GeochemistryTimeIndependentReactor::getMolesDumped(dof_id_type /*node_id*/,
125 : const std::string & /*species*/) const
126 : {
127 0 : return 0.0;
128 : }
|