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