https://mooseframework.inl.gov
Loading...
Searching...
No Matches
PorousFlowAqueousPreDisMineral.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.addCoupledVar("initial_concentrations",
19 "Initial concentrations for the mineral species "
20 "(m^{3}(precipitate)/m^{3}(porous material)). Default = 0");
21 params.addPrivateParam<std::string>("pf_material_type", "mineral");
22 params.addClassDescription("This Material forms a std::vector of mineral concentrations "
23 "(volume-of-mineral/volume-of-material) appropriate to the aqueous "
24 "precipitation-dissolution system provided.");
25 return params;
26}
27
29 : PorousFlowMaterialVectorBase(parameters),
30 _num_reactions(_dictator.numAqueousKinetic()),
31 _aq_ph(_dictator.aqueousPhaseNumber()),
32 _saturation(_nodal_material
33 ? getMaterialProperty<std::vector<Real>>("PorousFlow_saturation_nodal")
34 : getMaterialProperty<std::vector<Real>>("PorousFlow_saturation_qp")),
35 _sec_conc(_nodal_material
36 ? declareProperty<std::vector<Real>>("PorousFlow_mineral_concentration_nodal")
37 : declareProperty<std::vector<Real>>("PorousFlow_mineral_concentration_qp")),
38
39 _porosity_old(_nodal_material ? getMaterialPropertyOld<Real>("PorousFlow_porosity_nodal")
40 : getMaterialPropertyOld<Real>("PorousFlow_porosity_qp")),
41 _sec_conc_old(
42 _nodal_material
43 ? getMaterialPropertyOld<std::vector<Real>>("PorousFlow_mineral_concentration_nodal")
44 : getMaterialPropertyOld<std::vector<Real>>("PorousFlow_mineral_concentration_qp")),
45 _reaction_rate(
46 _nodal_material
47 ? getMaterialProperty<std::vector<Real>>("PorousFlow_mineral_reaction_rate_nodal")
48 : getMaterialProperty<std::vector<Real>>("PorousFlow_mineral_reaction_rate_qp")),
49
50 _initial_conc_supplied(isParamValid("initial_concentrations")),
51 _num_initial_conc(_initial_conc_supplied ? coupledComponents("initial_concentrations")
52 : _num_reactions)
53{
54 /* Not needed due to PorousFlow_mineral_reaction_rate already checking this condition
55 if (_dictator.numPhases() < 1)
56 mooseError("PorousFlowAqueousPreDisMineral: The number of fluid phases must not be zero");
57 */
58
59 if (_num_initial_conc != _dictator.numAqueousKinetic())
60 mooseError("PorousFlowAqueousPreDisMineral: The number of initial concentrations is ",
62 " but the Dictator knows that the number of aqueous kinetic "
63 "(precipitation-dissolution) reactions is ",
64 _dictator.numAqueousKinetic());
65
68 for (unsigned r = 0; r < _num_reactions; ++r)
69 {
70 // If initial_concentrations are elemental AuxVariables (or constants), we want to use
71 // coupledGenericValue() rather than coupledGenericDofValue()
72 const bool is_nodal = isCoupled("initial_concentrations")
73 ? getFieldVar("initial_concentrations", r)->isNodal()
74 : false;
75
76 _initial_conc[r] =
77 (_nodal_material && is_nodal ? &coupledDofValues("initial_concentrations", r)
78 : &coupledValue("initial_concentrations", r));
79 }
80}
81
82void
84{
85 _sec_conc[_qp].assign(_num_reactions, 0.0);
87 for (unsigned r = 0; r < _num_reactions; ++r)
88 _sec_conc[_qp][r] = (*_initial_conc[r])[_qp];
89}
90
91void
93{
95
96 /*
97 *
98 * Note the use of the OLD value of porosity here.
99 * This strategy, which breaks the cyclic dependency between porosity
100 * and mineral concentration, is used in
101 * Kernel: PorousFlowPreDis
102 * Material: PorousFlowPorosity
103 * Material: PorousFlowAqueousPreDisChemistry
104 * Material: PorousFlowAqueousPreDisMineral
105 *
106 */
107 for (unsigned r = 0; r < _num_reactions; ++r)
108 _sec_conc[_qp][r] = _sec_conc_old[_qp][r] + _porosity_old[_qp] * _reaction_rate[_qp][r] *
109 _saturation[_qp][_aq_ph] * _dt;
110}
void mooseError(Args &&... args)
registerMooseObject("PorousFlowApp", PorousFlowAqueousPreDisMineral)
void addPrivateParam(const std::string &name, const T &value)
void addClassDescription(const std::string &doc_string)
void addCoupledVar(const std::string &name, const std::string &doc_string)
virtual void resize(const std::size_t size) override final
Material designed to form a std::vector of mass fractions of mineral concentrations from reaction rat...
const unsigned int _aq_ph
Aqueous phase number.
std::vector< const VariableValue * > _initial_conc
Initial values of the secondary species concentrations.
const bool _initial_conc_supplied
Whether the initial values of the secondary species concentrations have been supplied by the user.
const MaterialProperty< std::vector< Real > > & _sec_conc_old
Old values of the mineral species concentrations.
const MaterialProperty< Real > & _porosity_old
Porosity.
const MaterialProperty< std::vector< Real > > & _reaction_rate
Reaction rate of mineralisation.
const unsigned _num_initial_conc
Number of secondary species concentrations supplied by the user.
MaterialProperty< std::vector< Real > > & _sec_conc
Mineral concentrations at quadpoint or nodes.
PorousFlowAqueousPreDisMineral(const InputParameters &parameters)
const unsigned int _num_reactions
Number of equations in the aqueous geochemistry system.
const MaterialProperty< std::vector< Real > > & _saturation
Saturation.
Base class for all PorousFlow vector materials.