https://mooseframework.inl.gov
Loading...
Searching...
No Matches
PorousFlowDesorpedMassVolumetricExpansion.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
12#include "MooseVariable.h"
13
16
17template <bool is_ad>
20{
22 params.set<MultiMooseEnum>("vector_tags") = "time";
23 params.set<MultiMooseEnum>("matrix_tags") = "system time";
24 params.addRequiredParam<UserObjectName>(
25 "PorousFlowDictator", "The UserObject that holds the list of PorousFlow variable names.");
27 "conc_var", "The variable that represents the concentration of desorped species");
28 params.addClassDescription("Desorped_mass * rate_of_solid_volumetric_expansion");
29 return params;
30}
31
32template <bool is_ad>
35 : GenericKernel<is_ad>(parameters),
36 _dictator(this->template getUserObject<PorousFlowDictator>("PorousFlowDictator")),
37 _conc_var_number(coupled("conc_var")),
38 _conc(this->template coupledGenericValue<is_ad>("conc_var")),
39 _porosity(this->template getGenericMaterialProperty<Real, is_ad>("PorousFlow_porosity_qp")),
40 _dporosity_dvar(is_ad ? nullptr
41 : &this->template getMaterialProperty<std::vector<Real>>(
42 "dPorousFlow_porosity_qp_dvar")),
43 _dporosity_dgradvar(is_ad ? nullptr
44 : &this->template getMaterialProperty<std::vector<RealGradient>>(
45 "dPorousFlow_porosity_qp_dgradvar")),
46 _strain_rate_qp(this->template getGenericMaterialProperty<Real, is_ad>(
47 "PorousFlow_volumetric_strain_rate_qp")),
48 _dstrain_rate_qp_dvar(is_ad ? nullptr
49 : &this->template getMaterialProperty<std::vector<RealGradient>>(
50 "dPorousFlow_volumetric_strain_rate_qp_dvar"))
51{
52}
53
54template <bool is_ad>
57{
58 return _test[_i][_qp] * (1.0 - _porosity[_qp]) * _conc[_qp] * _strain_rate_qp[_qp];
59}
60
61template <bool is_ad>
62Real
64{
65 return computeQpJac(_var.number());
66}
67
68template <bool is_ad>
69Real
71{
72 return computeQpJac(jvar);
73}
74
75template <bool is_ad>
76Real
78{
79 if constexpr (!is_ad)
80 {
81 Real deriv = 0.0;
82
83 if (jvar == _conc_var_number)
84 deriv = (1.0 - _porosity[_qp]) * _phi[_j][_qp] * _strain_rate_qp[_qp];
85
86 if (_dictator.notPorousFlowVariable(jvar))
87 return _test[_i][_qp] * deriv;
88 const unsigned int pvar = _dictator.porousFlowVariableNum(jvar);
89
90 deriv -=
91 (*_dporosity_dgradvar)[_qp][pvar] * _grad_phi[_j][_qp] * _conc[_qp] * _strain_rate_qp[_qp];
92 deriv -= (*_dporosity_dvar)[_qp][pvar] * _phi[_j][_qp] * _conc[_qp] * _strain_rate_qp[_qp];
93 deriv += (1.0 - _porosity[_qp]) * _conc[_qp] * (*_dstrain_rate_qp_dvar)[_qp][pvar] *
94 _grad_phi[_j][_qp];
95
96 return _test[_i][_qp] * deriv;
97 }
98 else
99 {
100 libmesh_ignore(jvar);
101 return 0.0;
102 }
103}
104
Moose::GenericType< Real, is_ad > GenericReal
registerMooseObject("PorousFlowApp", PorousFlowDesorpedMassVolumetricExpansion)
static InputParameters validParams()
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
T & set(const std::string &name, bool quiet_mode=false)
Kernel = desorped_mass * rate_of_solid_volumetric_expansion where desorped_mass = (1 - porosity) * co...
Real computeQpJac(unsigned int jvar) const
Derivative of the residual with respect to the Moose variable with variable number jvar.
This holds maps between the nonlinear variables used in a PorousFlow simulation and the variable numb...