Go to the documentation of this file.
12 #include "MooseVariable.h"
20 InputParameters params = validParams<TimeKernel>();
21 params.addParam<
bool>(
"strain_at_nearest_qp",
23 "When calculating nodal porosity that depends on strain, use the strain at "
24 "the nearest quadpoint. This adds a small extra computational burden, and "
25 "is not necessary for simulations involving only linear lagrange elements. "
26 " If you set this to true, you will also want to set the same parameter to "
27 "true for related Kernels and Materials");
28 params.addParam<
unsigned int>(
29 "fluid_component", 0,
"The index corresponding to the component for this kernel");
30 params.addRequiredParam<UserObjectName>(
31 "PorousFlowDictator",
"The UserObject that holds the list of PorousFlow variable names.");
32 params.addClassDescription(
"Component_mass*rate_of_solid_volumetric_expansion");
37 const InputParameters & parameters)
38 : TimeKernel(parameters),
39 _fluid_component(getParam<unsigned int>(
"fluid_component")),
41 _var_is_porflow_var(!_dictator.notPorousFlowVariable(_var.number())),
42 _strain_at_nearest_qp(getParam<bool>(
"strain_at_nearest_qp")),
43 _porosity(getMaterialProperty<Real>(
"PorousFlow_porosity_nodal")),
44 _dporosity_dvar(getMaterialProperty<std::vector<Real>>(
"dPorousFlow_porosity_nodal_dvar")),
46 getMaterialProperty<std::vector<
RealGradient>>(
"dPorousFlow_porosity_nodal_dgradvar")),
47 _nearest_qp(_strain_at_nearest_qp
48 ? &getMaterialProperty<unsigned int>(
"PorousFlow_nearestqp_nodal")
50 _fluid_density(getMaterialProperty<std::vector<Real>>(
"PorousFlow_fluid_phase_density_nodal")),
51 _dfluid_density_dvar(getMaterialProperty<std::vector<std::vector<Real>>>(
52 "dPorousFlow_fluid_phase_density_nodal_dvar")),
53 _fluid_saturation(getMaterialProperty<std::vector<Real>>(
"PorousFlow_saturation_nodal")),
54 _dfluid_saturation_dvar(
55 getMaterialProperty<std::vector<std::vector<Real>>>(
"dPorousFlow_saturation_nodal_dvar")),
56 _mass_frac(getMaterialProperty<std::vector<std::vector<Real>>>(
"PorousFlow_mass_frac_nodal")),
57 _dmass_frac_dvar(getMaterialProperty<std::vector<std::vector<std::vector<Real>>>>(
58 "dPorousFlow_mass_frac_nodal_dvar")),
59 _strain_rate_qp(getMaterialProperty<Real>(
"PorousFlow_volumetric_strain_rate_qp")),
60 _dstrain_rate_qp_dvar(getMaterialProperty<std::vector<
RealGradient>>(
61 "dPorousFlow_volumetric_strain_rate_qp_dvar"))
64 mooseError(
"The Dictator proclaims that the number of components in this simulation is ",
66 " whereas you have used the Kernel PorousFlowComponetMassVolumetricExpansion with "
69 ". The Dictator is watching you");
76 "PorousFlowMassVolumetricExpansion: fluid_component is given as "
78 <<
" which must be less than the number of fluid components described by the "
79 "mass-fraction matrix, which is "
83 "PorousFlowMassVolumetricExpansion: Size of fluid density = "
85 <<
" but both these must be equal to the number of phases in the system");
88 for (
unsigned ph = 0; ph < num_phases; ++ph)
117 for (
unsigned ph = 0; ph < num_phases; ++ph)
123 return _test[_i][_qp] * mass *
_porosity[_i] * dvol;
136 for (
unsigned ph = 0; ph < num_phases; ++ph)
139 _grad_phi[_j][nearest_qp];
144 for (
unsigned ph = 0; ph < num_phases; ++ph)
const MaterialProperty< Real > & _strain_rate_qp
Strain rate.
virtual Real computeQpResidual() override
const MaterialProperty< std::vector< Real > > & _fluid_density
Fluid density.
InputParameters validParams< PorousFlowMassVolumetricExpansion >()
VectorValue< Real > RealGradient
bool notPorousFlowVariable(unsigned int moose_var_num) const
Returns true if moose_var_num is not a porous flow variabe.
const bool _strain_at_nearest_qp
Whether the porosity uses the volumetric strain at the closest quadpoint.
const MaterialProperty< Real > & _porosity
Porosity.
const MaterialProperty< std::vector< Real > > & _fluid_saturation
Fluid saturation.
unsigned int porousFlowVariableNum(unsigned int moose_var_num) const
The PorousFlow variable number.
const PorousFlowDictator & _dictator
PorousFlowDictator UserObject.
registerMooseObject("PorousFlowApp", PorousFlowMassVolumetricExpansion)
This holds maps between the nonlinear variables used in a PorousFlow simulation and the variable numb...
const MaterialProperty< std::vector< std::vector< Real > > > & _dfluid_density_dvar
d(fluid density)/d(PorousFlow variable)
const MaterialProperty< std::vector< std::vector< Real > > > & _mass_frac
Mass fraction.
Real computedMassQpJac(unsigned int jvar) const
Derivative of mass part of the residual with respect to the Variable with variable number jvar.
Real computedVolQpJac(unsigned int jvar) const
Derivative of volumetric-strain part of the residual with respect to the Variable with variable numbe...
virtual Real computeQpOffDiagJacobian(unsigned int jvar) override
const MaterialProperty< std::vector< Real > > & _dporosity_dvar
d(porosity)/d(PorousFlow variable)
const unsigned int _fluid_component
The fluid component index.
const MaterialProperty< std::vector< RealGradient > > & _dporosity_dgradvar
d(porosity)/d(grad PorousFlow variable)
unsigned int numComponents() const
The number of fluid components.
const MaterialProperty< std::vector< std::vector< Real > > > & _dfluid_saturation_dvar
d(fluid saturation)/d(PorousFlow variable)
const MaterialProperty< std::vector< RealGradient > > & _dstrain_rate_qp_dvar
d(strain rate)/d(PorousFlow variable)
Kernel = mass_component * d(volumetric_strain)/dt where mass_component = porosity*sum_phases(density_...
virtual Real computeQpJacobian() override
const MaterialProperty< std::vector< std::vector< std::vector< Real > > > > & _dmass_frac_dvar
d(mass fraction)/d(PorousFlow variable)
PorousFlowMassVolumetricExpansion(const InputParameters ¶meters)