www.mooseframework.org
PorousFlowDesorpedMassTimeDerivative.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 
14 #include "libmesh/quadrature.h"
15 
17 
18 template <>
19 InputParameters
21 {
22  InputParameters params = validParams<TimeKernel>();
23  params.addRequiredParam<UserObjectName>(
24  "PorousFlowDictator", "The UserObject that holds the list of PorousFlow variable names.");
25  params.addRequiredCoupledVar(
26  "conc_var", "The variable that represents the concentration of desorped species");
27  params.addClassDescription("Desorped component mass derivative wrt time.");
28  return params;
29 }
30 
32  const InputParameters & parameters)
33  : TimeKernel(parameters),
34  _dictator(getUserObject<PorousFlowDictator>("PorousFlowDictator")),
35  _conc_var_number(coupled("conc_var")),
36  _conc(coupledValue("conc_var")),
37  _conc_old(coupledValueOld("conc_var")),
38  _porosity(getMaterialProperty<Real>("PorousFlow_porosity_qp")),
39  _porosity_old(getMaterialPropertyOld<Real>("PorousFlow_porosity_qp")),
40  _dporosity_dvar(getMaterialProperty<std::vector<Real>>("dPorousFlow_porosity_qp_dvar")),
41  _dporosity_dgradvar(
42  getMaterialProperty<std::vector<RealGradient>>("dPorousFlow_porosity_qp_dgradvar"))
43 {
44 }
45 
46 Real
48 {
49  Real c = (1.0 - _porosity[_qp]) * _conc[_qp];
50  Real c_old = (1.0 - _porosity_old[_qp]) * _conc_old[_qp];
51  return _test[_i][_qp] * (c - c_old) / _dt;
52 }
53 
54 Real
56 {
57  return computeQpJac(_var.number());
58 }
59 
60 Real
62 {
63  return computeQpJac(jvar);
64 }
65 
66 Real
68 {
69  Real deriv = 0.0;
70 
71  if (jvar == _conc_var_number)
72  deriv = (1.0 - _porosity[_qp]) * _phi[_j][_qp];
73 
75  return _test[_i][_qp] * deriv / _dt;
76  const unsigned int pvar = _dictator.porousFlowVariableNum(jvar);
77 
78  deriv -= _dporosity_dgradvar[_qp][pvar] * _grad_phi[_j][_qp] * _conc[_qp];
79  deriv -= _dporosity_dvar[_qp][pvar] * _phi[_j][_qp] * _conc[_qp];
80 
81  return _test[_i][_qp] * deriv / _dt;
82 }
const VariableValue & _conc_old
Old value of the concentration variable.
VectorValue< Real > RealGradient
const MaterialProperty< std::vector< RealGradient > > & _dporosity_dgradvar
d(porosity)/d(grad PorousFlow variable) - these derivatives will be wrt grad(vars) at qps ...
bool notPorousFlowVariable(unsigned int moose_var_num) const
Returns true if moose_var_num is not a porous flow variabe.
Kernel = (desorped_mass - desorped_mass_old)/dt It is NOT lumped to the nodes.
const MaterialProperty< Real > & _porosity_old
Old value of porosity.
const MaterialProperty< std::vector< Real > > & _dporosity_dvar
d(porosity)/d(PorousFlow variable) - these derivatives will be wrt variables at the qps ...
Real computeQpJac(unsigned int jvar) const
Derivative of residual with respect to variable number jvar This is used by both computeQpJacobian an...
InputParameters validParams< PorousFlowDesorpedMassTimeDerivative >()
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
PorousFlowDictator UserObject.
const unsigned int _conc_var_number
The MOOSE variable number of the concentration variable.
registerMooseObject("PorousFlowApp", PorousFlowDesorpedMassTimeDerivative)
const MaterialProperty< Real > & _porosity
Porosity at the qps.
PorousFlowDesorpedMassTimeDerivative(const InputParameters &parameters)
unsigned int porousFlowVariableNum(unsigned int moose_var_num) const
The PorousFlow variable number.