www.mooseframework.org
PorousFlowDesorpedMassTimeDerivative.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 
9 
10 // MOOSE includes
11 #include "MooseVariable.h"
12 
13 #include "libmesh/quadrature.h"
14 
15 template <>
16 InputParameters
18 {
19  InputParameters params = validParams<TimeKernel>();
20  params.addRequiredParam<UserObjectName>(
21  "PorousFlowDictator", "The UserObject that holds the list of Porous-Flow variable names.");
22  params.addRequiredCoupledVar(
23  "conc_var", "The variable that represents the concentration of desorped species");
24  params.addClassDescription("Desorped component mass derivative wrt time.");
25  return params;
26 }
27 
29  const InputParameters & parameters)
30  : TimeKernel(parameters),
31  _dictator(getUserObject<PorousFlowDictator>("PorousFlowDictator")),
32  _conc_var_number(coupled("conc_var")),
33  _conc(coupledValue("conc_var")),
34  _conc_old(coupledValueOld("conc_var")),
35  _porosity(getMaterialProperty<Real>("PorousFlow_porosity_qp")),
36  _porosity_old(getMaterialPropertyOld<Real>("PorousFlow_porosity_qp")),
37  _dporosity_dvar(getMaterialProperty<std::vector<Real>>("dPorousFlow_porosity_qp_dvar")),
38  _dporosity_dgradvar(
39  getMaterialProperty<std::vector<RealGradient>>("dPorousFlow_porosity_qp_dgradvar"))
40 {
41 }
42 
43 Real
45 {
46  Real c = (1.0 - _porosity[_qp]) * _conc[_qp];
47  Real c_old = (1.0 - _porosity_old[_qp]) * _conc_old[_qp];
48  return _test[_i][_qp] * (c - c_old) / _dt;
49 }
50 
51 Real
53 {
54  return computeQpJac(_var.number());
55 }
56 
57 Real
59 {
60  return computeQpJac(jvar);
61 }
62 
63 Real
65 {
66  Real deriv = 0.0;
67 
68  if (jvar == _conc_var_number)
69  deriv = (1.0 - _porosity[_qp]) * _phi[_j][_qp];
70 
72  return _test[_i][_qp] * deriv / _dt;
73  const unsigned int pvar = _dictator.porousFlowVariableNum(jvar);
74 
75  deriv -= _dporosity_dgradvar[_qp][pvar] * _grad_phi[_j][_qp] * _conc[_qp];
76  deriv -= _dporosity_dvar[_qp][pvar] * _phi[_j][_qp] * _conc[_qp];
77 
78  return _test[_i][_qp] * deriv / _dt;
79 }
const VariableValue & _conc_old
Old value of the concentration variable.
const MaterialProperty< std::vector< RealGradient > > & _dporosity_dgradvar
d(porosity)/d(grad porous-flow variable) - these derivatives will be wrt grad(vars) at qps ...
const MaterialProperty< Real > & _porosity_old
old value of porosity
const MaterialProperty< std::vector< Real > > & _dporosity_dvar
d(porosity)/d(porous-flow variable) - these derivatives will be wrt variables at the qps ...
InputParameters validParams< PorousFlowDesorpedMassTimeDerivative >()
Real computeQpJac(unsigned int jvar) const
Derivative of residual with respect to variable number jvar This is used by both computeQpJacobian an...
virtual Real computeQpOffDiagJacobian(unsigned int jvar) override
const VariableValue & _conc
The concentration variable.
This holds maps between the nonlinear variables used in a PorousFlow simulation and the variable numb...
const PorousFlowDictator & _dictator
holds info on the PorousFlow variables
const unsigned int _conc_var_number
The MOOSE variable number of the concentration variable.
const MaterialProperty< Real > & _porosity
porosity at the qps
PorousFlowDesorpedMassTimeDerivative(const InputParameters &parameters)
bool notPorousFlowVariable(unsigned int moose_var_num) const
returns true if moose_var_num is not a porous flow variabe
unsigned int porousFlowVariableNum(unsigned int moose_var_num) const
the PorousFlow variable number