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 fluid component for this kernel");
34 params.addRequiredParam<Real>(
"decay_rate",
35 "The decay rate (units 1/time) for the fluid component");
36 params.addRequiredParam<UserObjectName>(
37 "PorousFlowDictator",
"The UserObject that holds the list of PorousFlow variable names.");
38 params.addClassDescription(
"Radioactive decay of a fluid component");
43 : TimeKernel(parameters),
44 _decay_rate(getParam<Real>(
"decay_rate")),
45 _fluid_component(getParam<unsigned int>(
"fluid_component")),
47 _var_is_porflow_var(_dictator.isPorousFlowVariable(_var.number())),
48 _num_phases(_dictator.numPhases()),
49 _strain_at_nearest_qp(getParam<bool>(
"strain_at_nearest_qp")),
50 _porosity(getMaterialProperty<Real>(
"PorousFlow_porosity_nodal")),
51 _dporosity_dvar(getMaterialProperty<std::vector<Real>>(
"dPorousFlow_porosity_nodal_dvar")),
53 getMaterialProperty<std::vector<
RealGradient>>(
"dPorousFlow_porosity_nodal_dgradvar")),
54 _nearest_qp(_strain_at_nearest_qp
55 ? &getMaterialProperty<unsigned int>(
"PorousFlow_nearestqp_nodal")
57 _fluid_density(getMaterialProperty<std::vector<Real>>(
"PorousFlow_fluid_phase_density_nodal")),
58 _dfluid_density_dvar(getMaterialProperty<std::vector<std::vector<Real>>>(
59 "dPorousFlow_fluid_phase_density_nodal_dvar")),
60 _fluid_saturation_nodal(getMaterialProperty<std::vector<Real>>(
"PorousFlow_saturation_nodal")),
61 _dfluid_saturation_nodal_dvar(
62 getMaterialProperty<std::vector<std::vector<Real>>>(
"dPorousFlow_saturation_nodal_dvar")),
63 _mass_frac(getMaterialProperty<std::vector<std::vector<Real>>>(
"PorousFlow_mass_frac_nodal")),
64 _dmass_frac_dvar(getMaterialProperty<std::vector<std::vector<std::vector<Real>>>>(
65 "dPorousFlow_mass_frac_nodal_dvar"))
70 "The Dictator proclaims that the maximum fluid component index in this simulation is ",
72 " whereas you have used ",
74 ". Remember that indexing starts at 0. The Dictator does not take such mistakes lightly.");
118 _grad_phi[_j][nearest_qp];
Real computeQpJac(unsigned int pvar)
Derivative of residual with respect to PorousFlow variable number pvar This is used by both computeQp...
const bool _var_is_porflow_var
Whether the Variable for this Kernel is a PorousFlow variable according to the Dictator.
const bool _strain_at_nearest_qp
Whether the porosity uses the volumetric strain at the closest quadpoint.
VectorValue< Real > RealGradient
const MaterialProperty< std::vector< RealGradient > > & _dporosity_dgradvar
d(porosity)/d(grad PorousFlow variable) - remember 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.
const MaterialProperty< std::vector< std::vector< Real > > > & _dfluid_density_dvar
d(nodal fluid density)/d(PorousFlow variable)
const MaterialProperty< std::vector< std::vector< std::vector< Real > > > > & _dmass_frac_dvar
d(nodal mass fraction)/d(PorousFlow variable)
const MaterialProperty< std::vector< std::vector< Real > > > & _dfluid_saturation_nodal_dvar
d(nodal fluid saturation)/d(PorousFlow variable)
virtual Real computeQpOffDiagJacobian(unsigned int jvar) override
const Real _decay_rate
The decay rate.
registerMooseObject("PorousFlowApp", PorousFlowMassRadioactiveDecay)
const PorousFlowDictator & _dictator
PorousFlowDictator UserObject.
const unsigned int _num_phases
Number of fluid phases.
const MaterialProperty< std::vector< std::vector< Real > > > & _mass_frac
Nodal mass fraction.
unsigned int porousFlowVariableNum(unsigned int moose_var_num) const
The PorousFlow variable number.
This holds maps between the nonlinear variables used in a PorousFlow simulation and the variable numb...
PorousFlowMassRadioactiveDecay(const InputParameters ¶meters)
virtual Real computeQpResidual() override
unsigned int numComponents() const
The number of fluid components.
const MaterialProperty< Real > & _porosity
Porosity at the nodes, but it can depend on grad(variables) which are actually evaluated at the qps.
const MaterialProperty< std::vector< Real > > & _fluid_density
Nodal fluid density.
Kernel = _decay_rate * masscomponent where mass_component = porosity*sum_phases(density_phase*saturat...
InputParameters validParams< PorousFlowMassRadioactiveDecay >()
const MaterialProperty< std::vector< Real > > & _dporosity_dvar
d(porosity)/d(PorousFlow variable) - these derivatives will be wrt variables at the nodes
const MaterialProperty< std::vector< Real > > & _fluid_saturation_nodal
Nodal fluid saturation.
const unsigned int _fluid_component
The fluid component index.
virtual Real computeQpJacobian() override