Go to the documentation of this file.
12 #include "MooseVariable.h"
14 #include "libmesh/quadrature.h"
24 InputParameters params = validParams<TimeKernel>();
25 params.addParam<
bool>(
"strain_at_nearest_qp",
27 "When calculating nodal porosity that depends on strain, use the strain at "
28 "the nearest quadpoint. This adds a small extra computational burden, and "
29 "is not necessary for simulations involving only linear lagrange elements. "
30 " If you set this to true, you will also want to set the same parameter to "
31 "true for related Kernels and Materials");
32 params.addParam<
unsigned int>(
33 "fluid_component", 0,
"The index corresponding to the component for this kernel");
34 params.addRequiredParam<UserObjectName>(
35 "PorousFlowDictator",
"The UserObject that holds the list of PorousFlow variable names.");
36 params.addClassDescription(
37 "Component mass derivative wrt time for component given by fluid_component");
42 : TimeKernel(parameters),
43 _fluid_component(getParam<unsigned int>(
"fluid_component")),
45 _var_is_porflow_var(_dictator.isPorousFlowVariable(_var.number())),
46 _num_phases(_dictator.numPhases()),
47 _strain_at_nearest_qp(getParam<bool>(
"strain_at_nearest_qp")),
48 _porosity(getMaterialProperty<Real>(
"PorousFlow_porosity_nodal")),
49 _porosity_old(getMaterialPropertyOld<Real>(
"PorousFlow_porosity_nodal")),
50 _dporosity_dvar(getMaterialProperty<std::vector<Real>>(
"dPorousFlow_porosity_nodal_dvar")),
52 getMaterialProperty<std::vector<
RealGradient>>(
"dPorousFlow_porosity_nodal_dgradvar")),
53 _nearest_qp(_strain_at_nearest_qp
54 ? &getMaterialProperty<unsigned int>(
"PorousFlow_nearestqp_nodal")
56 _fluid_density(getMaterialProperty<std::vector<Real>>(
"PorousFlow_fluid_phase_density_nodal")),
58 getMaterialPropertyOld<std::vector<Real>>(
"PorousFlow_fluid_phase_density_nodal")),
59 _dfluid_density_dvar(getMaterialProperty<std::vector<std::vector<Real>>>(
60 "dPorousFlow_fluid_phase_density_nodal_dvar")),
61 _fluid_saturation_nodal(getMaterialProperty<std::vector<Real>>(
"PorousFlow_saturation_nodal")),
62 _fluid_saturation_nodal_old(
63 getMaterialPropertyOld<std::vector<Real>>(
"PorousFlow_saturation_nodal")),
64 _dfluid_saturation_nodal_dvar(
65 getMaterialProperty<std::vector<std::vector<Real>>>(
"dPorousFlow_saturation_nodal_dvar")),
66 _mass_frac(getMaterialProperty<std::vector<std::vector<Real>>>(
"PorousFlow_mass_frac_nodal")),
68 getMaterialPropertyOld<std::vector<std::vector<Real>>>(
"PorousFlow_mass_frac_nodal")),
69 _dmass_frac_dvar(getMaterialProperty<std::vector<std::vector<std::vector<Real>>>>(
70 "dPorousFlow_mass_frac_nodal_dvar"))
75 "The Dictator proclaims that the maximum fluid component index in this simulation is ",
77 " whereas you have used ",
79 ". Remember that indexing starts at 0. The Dictator does not take such mistakes lightly.");
128 _grad_phi[_j][nearest_qp];
131 return _test[_i][_qp] * dmass / _dt;
145 return _test[_i][_qp] * dmass / _dt;
const PorousFlowDictator & _dictator
PorousFlowDictator UserObject.
const MaterialProperty< std::vector< Real > > & _dporosity_dvar
d(porosity)/d(PorousFlow variable) - these derivatives will be wrt variables at the nodes
const MaterialProperty< Real > & _porosity
Porosity at the nodes, but it can depend on grad(variables) which are actually evaluated at the qps.
Kernel = (mass_component - mass_component_old)/dt where mass_component = porosity*sum_phases(density_...
virtual Real computeQpResidual() override
Real computeQpJac(unsigned int pvar)
Derivative of residual with respect to PorousFlow variable number pvar This is used by both computeQp...
registerMooseObject("PorousFlowApp", PorousFlowMassTimeDerivative)
const unsigned int _fluid_component
The fluid component index.
const MaterialProperty< std::vector< std::vector< Real > > > & _mass_frac
Nodal mass fraction.
VectorValue< Real > RealGradient
bool notPorousFlowVariable(unsigned int moose_var_num) const
Returns true if moose_var_num is not a porous flow variabe.
const MaterialProperty< std::vector< Real > > & _fluid_density_old
Old value of nodal fluid density.
const MaterialProperty< std::vector< Real > > & _fluid_saturation_nodal
Nodal fluid saturation.
const MaterialProperty< Real > & _porosity_old
Old value of porosity.
const MaterialProperty< std::vector< std::vector< Real > > > & _dfluid_saturation_nodal_dvar
d(nodal fluid saturation)/d(PorousFlow variable)
unsigned int porousFlowVariableNum(unsigned int moose_var_num) const
The PorousFlow variable number.
const MaterialProperty< std::vector< Real > > & _fluid_density
Nodal fluid density.
This holds maps between the nonlinear variables used in a PorousFlow simulation and the variable numb...
InputParameters validParams< PorousFlowMassTimeDerivative >()
const unsigned int _num_phases
Number of fluid phases.
const MaterialProperty< std::vector< std::vector< Real > > > & _dfluid_density_dvar
d(nodal fluid density)/d(PorousFlow variable)
PorousFlowMassTimeDerivative(const InputParameters ¶meters)
const MaterialProperty< std::vector< Real > > & _fluid_saturation_nodal_old
Old value of fluid saturation.
unsigned int numComponents() const
The number of fluid components.
const MaterialProperty< std::vector< RealGradient > > & _dporosity_dgradvar
d(porosity)/d(grad PorousFlow variable) - remember these derivatives will be wrt grad(vars) at qps
const bool _var_is_porflow_var
Whether the Variable for this Kernel is a PorousFlow variable according to the Dictator.
const MaterialProperty< std::vector< std::vector< std::vector< Real > > > > & _dmass_frac_dvar
d(nodal mass fraction)/d(PorousFlow variable)
const bool _strain_at_nearest_qp
Whether the porosity uses the volumetric strain at the closest quadpoint.
virtual Real computeQpJacobian() override
virtual Real computeQpOffDiagJacobian(unsigned int jvar) override
const MaterialProperty< std::vector< std::vector< Real > > > & _mass_frac_old
Old value of nodal mass fraction.