www.mooseframework.org
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
PorousFlowMassRadioactiveDecay Class Reference

Kernel = _decay_rate * masscomponent where mass_component = porosity*sum_phases(density_phase*saturation_phase*massfrac_phase^component) It is lumped to the nodes. More...

#include <PorousFlowMassRadioactiveDecay.h>

Inheritance diagram for PorousFlowMassRadioactiveDecay:
[legend]

Public Member Functions

 PorousFlowMassRadioactiveDecay (const InputParameters &parameters)
 

Protected Member Functions

virtual Real computeQpResidual () override
 
virtual Real computeQpJacobian () override
 
virtual Real computeQpOffDiagJacobian (unsigned int jvar) override
 
Real computeQpJac (unsigned int pvar)
 Derivative of residual with respect to PorousFlow variable number pvar This is used by both computeQpJacobian and computeQpOffDiagJacobian. More...
 

Protected Attributes

const Real _decay_rate
 The decay rate. More...
 
const unsigned int _fluid_component
 The fluid component index. More...
 
const PorousFlowDictator_dictator
 PorousFlowDictator UserObject. More...
 
const bool _var_is_porflow_var
 Whether the Variable for this Kernel is a PorousFlow variable according to the Dictator. More...
 
const unsigned int _num_phases
 Number of fluid phases. More...
 
const bool _strain_at_nearest_qp
 Whether the porosity uses the volumetric strain at the closest quadpoint. More...
 
const MaterialProperty< Real > & _porosity
 Porosity at the nodes, but it can depend on grad(variables) which are actually evaluated at the qps. More...
 
const MaterialProperty< std::vector< Real > > & _dporosity_dvar
 d(porosity)/d(PorousFlow variable) - these derivatives will be wrt variables at the nodes More...
 
const MaterialProperty< std::vector< RealGradient > > & _dporosity_dgradvar
 d(porosity)/d(grad PorousFlow variable) - remember these derivatives will be wrt grad(vars) at qps More...
 
const MaterialProperty< unsigned int > *const _nearest_qp
 The nearest qp to the node. More...
 
const MaterialProperty< std::vector< Real > > & _fluid_density
 Nodal fluid density. More...
 
const MaterialProperty< std::vector< std::vector< Real > > > & _dfluid_density_dvar
 d(nodal fluid density)/d(PorousFlow variable) More...
 
const MaterialProperty< std::vector< Real > > & _fluid_saturation_nodal
 Nodal fluid saturation. More...
 
const MaterialProperty< std::vector< std::vector< Real > > > & _dfluid_saturation_nodal_dvar
 d(nodal fluid saturation)/d(PorousFlow variable) More...
 
const MaterialProperty< std::vector< std::vector< Real > > > & _mass_frac
 Nodal mass fraction. More...
 
const MaterialProperty< std::vector< std::vector< std::vector< Real > > > > & _dmass_frac_dvar
 d(nodal mass fraction)/d(PorousFlow variable) More...
 

Detailed Description

Kernel = _decay_rate * masscomponent where mass_component = porosity*sum_phases(density_phase*saturation_phase*massfrac_phase^component) It is lumped to the nodes.

Definition at line 27 of file PorousFlowMassRadioactiveDecay.h.

Constructor & Destructor Documentation

◆ PorousFlowMassRadioactiveDecay()

PorousFlowMassRadioactiveDecay::PorousFlowMassRadioactiveDecay ( const InputParameters &  parameters)

Definition at line 42 of file PorousFlowMassRadioactiveDecay.C.

43  : TimeKernel(parameters),
44  _decay_rate(getParam<Real>("decay_rate")),
45  _fluid_component(getParam<unsigned int>("fluid_component")),
46  _dictator(getUserObject<PorousFlowDictator>("PorousFlowDictator")),
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")),
55  ? &getMaterialProperty<unsigned int>("PorousFlow_nearestqp_nodal")
56  : nullptr),
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")),
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"))
66 {
68  paramError(
69  "fluid_component",
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.");
75 }
const MaterialProperty< std::vector< std::vector< std::vector< Real > > > > & _dmass_frac_dvar
d(nodal mass fraction)/d(PorousFlow variable)
const MaterialProperty< std::vector< Real > > & _dporosity_dvar
d(porosity)/d(PorousFlow variable) - these derivatives will be wrt variables at the nodes ...
const unsigned int _fluid_component
The fluid component index.
const unsigned int _num_phases
Number of fluid phases.
const MaterialProperty< std::vector< std::vector< Real > > > & _mass_frac
Nodal mass fraction.
unsigned int numComponents() const
The number of fluid components.
bool isPorousFlowVariable(unsigned int moose_var_num) const
Returns true if moose_var_num is a porous flow variable.
const bool _strain_at_nearest_qp
Whether the porosity uses the volumetric strain at the closest quadpoint.
const MaterialProperty< std::vector< RealGradient > > & _dporosity_dgradvar
d(porosity)/d(grad PorousFlow variable) - remember these derivatives will be wrt grad(vars) at qps ...
const MaterialProperty< std::vector< std::vector< Real > > > & _dfluid_density_dvar
d(nodal fluid density)/d(PorousFlow variable)
const MaterialProperty< std::vector< std::vector< Real > > > & _dfluid_saturation_nodal_dvar
d(nodal fluid saturation)/d(PorousFlow variable)
const MaterialProperty< unsigned int > *const _nearest_qp
The nearest qp to the node.
const PorousFlowDictator & _dictator
PorousFlowDictator UserObject.
unsigned int numPhases() const
The number of fluid phases.
const MaterialProperty< std::vector< Real > > & _fluid_density
Nodal fluid density.
const MaterialProperty< std::vector< Real > > & _fluid_saturation_nodal
Nodal fluid saturation.
const bool _var_is_porflow_var
Whether the Variable for this Kernel is a PorousFlow variable according to the Dictator.
const MaterialProperty< Real > & _porosity
Porosity at the nodes, but it can depend on grad(variables) which are actually evaluated at the qps...

Member Function Documentation

◆ computeQpJac()

Real PorousFlowMassRadioactiveDecay::computeQpJac ( unsigned int  pvar)
protected

Derivative of residual with respect to PorousFlow variable number pvar This is used by both computeQpJacobian and computeQpOffDiagJacobian.

Parameters
pvartake the derivative of the residual wrt this PorousFlow variable

Definition at line 107 of file PorousFlowMassRadioactiveDecay.C.

Referenced by computeQpJacobian(), and computeQpOffDiagJacobian().

108 {
109  const unsigned nearest_qp = (_strain_at_nearest_qp ? (*_nearest_qp)[_i] : _i);
110 
111  // porosity is dependent on variables that are lumped to the nodes,
112  // but it can depend on the gradient
113  // of variables, which are NOT lumped to the nodes, hence:
114  Real dmass = 0.0;
115  for (unsigned ph = 0; ph < _num_phases; ++ph)
116  dmass += _fluid_density[_i][ph] * _fluid_saturation_nodal[_i][ph] *
117  _mass_frac[_i][ph][_fluid_component] * _dporosity_dgradvar[_i][pvar] *
118  _grad_phi[_j][nearest_qp];
119 
120  if (_i != _j)
121  return _test[_i][_qp] * _decay_rate * dmass;
122 
123  // As the fluid mass is lumped to the nodes, only non-zero terms are for _i==_j
124  for (unsigned ph = 0; ph < _num_phases; ++ph)
125  {
126  dmass += _dfluid_density_dvar[_i][ph][pvar] * _fluid_saturation_nodal[_i][ph] *
127  _mass_frac[_i][ph][_fluid_component] * _porosity[_i];
128  dmass += _fluid_density[_i][ph] * _dfluid_saturation_nodal_dvar[_i][ph][pvar] *
129  _mass_frac[_i][ph][_fluid_component] * _porosity[_i];
130  dmass += _fluid_density[_i][ph] * _fluid_saturation_nodal[_i][ph] *
131  _dmass_frac_dvar[_i][ph][_fluid_component][pvar] * _porosity[_i];
132  dmass += _fluid_density[_i][ph] * _fluid_saturation_nodal[_i][ph] *
133  _mass_frac[_i][ph][_fluid_component] * _dporosity_dvar[_i][pvar];
134  }
135  return _test[_i][_qp] * _decay_rate * dmass;
136 }
const MaterialProperty< std::vector< std::vector< std::vector< Real > > > > & _dmass_frac_dvar
d(nodal mass fraction)/d(PorousFlow variable)
const MaterialProperty< std::vector< Real > > & _dporosity_dvar
d(porosity)/d(PorousFlow variable) - these derivatives will be wrt variables at the nodes ...
const unsigned int _fluid_component
The fluid component index.
const unsigned int _num_phases
Number of fluid phases.
const MaterialProperty< std::vector< std::vector< Real > > > & _mass_frac
Nodal mass fraction.
const bool _strain_at_nearest_qp
Whether the porosity uses the volumetric strain at the closest quadpoint.
const MaterialProperty< std::vector< RealGradient > > & _dporosity_dgradvar
d(porosity)/d(grad PorousFlow variable) - remember these derivatives will be wrt grad(vars) at qps ...
const MaterialProperty< std::vector< std::vector< Real > > > & _dfluid_density_dvar
d(nodal fluid density)/d(PorousFlow variable)
const MaterialProperty< std::vector< std::vector< Real > > > & _dfluid_saturation_nodal_dvar
d(nodal fluid saturation)/d(PorousFlow variable)
const MaterialProperty< std::vector< Real > > & _fluid_density
Nodal fluid density.
const MaterialProperty< std::vector< Real > > & _fluid_saturation_nodal
Nodal fluid saturation.
const MaterialProperty< Real > & _porosity
Porosity at the nodes, but it can depend on grad(variables) which are actually evaluated at the qps...

◆ computeQpJacobian()

Real PorousFlowMassRadioactiveDecay::computeQpJacobian ( )
overrideprotectedvirtual

Definition at line 89 of file PorousFlowMassRadioactiveDecay.C.

90 {
91  // If the variable is not a PorousFlow variable (very unusual), the diag Jacobian terms are 0
93  return 0.0;
94  return computeQpJac(_dictator.porousFlowVariableNum(_var.number()));
95 }
const PorousFlowDictator & _dictator
PorousFlowDictator UserObject.
unsigned int porousFlowVariableNum(unsigned int moose_var_num) const
The PorousFlow variable number.
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.

◆ computeQpOffDiagJacobian()

Real PorousFlowMassRadioactiveDecay::computeQpOffDiagJacobian ( unsigned int  jvar)
overrideprotectedvirtual

Definition at line 98 of file PorousFlowMassRadioactiveDecay.C.

99 {
100  // If the variable is not a PorousFlow variable, the OffDiag Jacobian terms are 0
102  return 0.0;
104 }
bool notPorousFlowVariable(unsigned int moose_var_num) const
Returns true if moose_var_num is not a porous flow variabe.
const PorousFlowDictator & _dictator
PorousFlowDictator UserObject.
unsigned int porousFlowVariableNum(unsigned int moose_var_num) const
The PorousFlow variable number.
Real computeQpJac(unsigned int pvar)
Derivative of residual with respect to PorousFlow variable number pvar This is used by both computeQp...

◆ computeQpResidual()

Real PorousFlowMassRadioactiveDecay::computeQpResidual ( )
overrideprotectedvirtual

Definition at line 78 of file PorousFlowMassRadioactiveDecay.C.

79 {
80  Real mass = 0.0;
81  for (unsigned ph = 0; ph < _num_phases; ++ph)
82  mass += _fluid_density[_i][ph] * _fluid_saturation_nodal[_i][ph] *
84 
85  return _test[_i][_qp] * _decay_rate * _porosity[_i] * mass;
86 }
const unsigned int _fluid_component
The fluid component index.
const unsigned int _num_phases
Number of fluid phases.
const MaterialProperty< std::vector< std::vector< Real > > > & _mass_frac
Nodal mass fraction.
const MaterialProperty< std::vector< Real > > & _fluid_density
Nodal fluid density.
const MaterialProperty< std::vector< Real > > & _fluid_saturation_nodal
Nodal fluid saturation.
const MaterialProperty< Real > & _porosity
Porosity at the nodes, but it can depend on grad(variables) which are actually evaluated at the qps...

Member Data Documentation

◆ _decay_rate

const Real PorousFlowMassRadioactiveDecay::_decay_rate
protected

The decay rate.

Definition at line 38 of file PorousFlowMassRadioactiveDecay.h.

Referenced by computeQpJac(), and computeQpResidual().

◆ _dfluid_density_dvar

const MaterialProperty<std::vector<std::vector<Real> > >& PorousFlowMassRadioactiveDecay::_dfluid_density_dvar
protected

d(nodal fluid density)/d(PorousFlow variable)

Definition at line 71 of file PorousFlowMassRadioactiveDecay.h.

Referenced by computeQpJac().

◆ _dfluid_saturation_nodal_dvar

const MaterialProperty<std::vector<std::vector<Real> > >& PorousFlowMassRadioactiveDecay::_dfluid_saturation_nodal_dvar
protected

d(nodal fluid saturation)/d(PorousFlow variable)

Definition at line 77 of file PorousFlowMassRadioactiveDecay.h.

Referenced by computeQpJac().

◆ _dictator

const PorousFlowDictator& PorousFlowMassRadioactiveDecay::_dictator
protected

◆ _dmass_frac_dvar

const MaterialProperty<std::vector<std::vector<std::vector<Real> > > >& PorousFlowMassRadioactiveDecay::_dmass_frac_dvar
protected

d(nodal mass fraction)/d(PorousFlow variable)

Definition at line 83 of file PorousFlowMassRadioactiveDecay.h.

Referenced by computeQpJac().

◆ _dporosity_dgradvar

const MaterialProperty<std::vector<RealGradient> >& PorousFlowMassRadioactiveDecay::_dporosity_dgradvar
protected

d(porosity)/d(grad PorousFlow variable) - remember these derivatives will be wrt grad(vars) at qps

Definition at line 62 of file PorousFlowMassRadioactiveDecay.h.

Referenced by computeQpJac().

◆ _dporosity_dvar

const MaterialProperty<std::vector<Real> >& PorousFlowMassRadioactiveDecay::_dporosity_dvar
protected

d(porosity)/d(PorousFlow variable) - these derivatives will be wrt variables at the nodes

Definition at line 59 of file PorousFlowMassRadioactiveDecay.h.

Referenced by computeQpJac().

◆ _fluid_component

const unsigned int PorousFlowMassRadioactiveDecay::_fluid_component
protected

The fluid component index.

Definition at line 41 of file PorousFlowMassRadioactiveDecay.h.

Referenced by computeQpJac(), computeQpResidual(), and PorousFlowMassRadioactiveDecay().

◆ _fluid_density

const MaterialProperty<std::vector<Real> >& PorousFlowMassRadioactiveDecay::_fluid_density
protected

Nodal fluid density.

Definition at line 68 of file PorousFlowMassRadioactiveDecay.h.

Referenced by computeQpJac(), and computeQpResidual().

◆ _fluid_saturation_nodal

const MaterialProperty<std::vector<Real> >& PorousFlowMassRadioactiveDecay::_fluid_saturation_nodal
protected

Nodal fluid saturation.

Definition at line 74 of file PorousFlowMassRadioactiveDecay.h.

Referenced by computeQpJac(), and computeQpResidual().

◆ _mass_frac

const MaterialProperty<std::vector<std::vector<Real> > >& PorousFlowMassRadioactiveDecay::_mass_frac
protected

Nodal mass fraction.

Definition at line 80 of file PorousFlowMassRadioactiveDecay.h.

Referenced by computeQpJac(), and computeQpResidual().

◆ _nearest_qp

const MaterialProperty<unsigned int>* const PorousFlowMassRadioactiveDecay::_nearest_qp
protected

The nearest qp to the node.

Definition at line 65 of file PorousFlowMassRadioactiveDecay.h.

◆ _num_phases

const unsigned int PorousFlowMassRadioactiveDecay::_num_phases
protected

Number of fluid phases.

Definition at line 50 of file PorousFlowMassRadioactiveDecay.h.

Referenced by computeQpJac(), and computeQpResidual().

◆ _porosity

const MaterialProperty<Real>& PorousFlowMassRadioactiveDecay::_porosity
protected

Porosity at the nodes, but it can depend on grad(variables) which are actually evaluated at the qps.

Definition at line 56 of file PorousFlowMassRadioactiveDecay.h.

Referenced by computeQpJac(), and computeQpResidual().

◆ _strain_at_nearest_qp

const bool PorousFlowMassRadioactiveDecay::_strain_at_nearest_qp
protected

Whether the porosity uses the volumetric strain at the closest quadpoint.

Definition at line 53 of file PorousFlowMassRadioactiveDecay.h.

Referenced by computeQpJac().

◆ _var_is_porflow_var

const bool PorousFlowMassRadioactiveDecay::_var_is_porflow_var
protected

Whether the Variable for this Kernel is a PorousFlow variable according to the Dictator.

Definition at line 47 of file PorousFlowMassRadioactiveDecay.h.

Referenced by computeQpJacobian().


The documentation for this class was generated from the following files: