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
 holds info on the PorousFlow variables More...
 
const bool _var_is_porflow_var
 whether the Variable for this Kernel is a porous-flow 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(porous-flow variable) - these derivatives will be wrt variables at the nodes More...
 
const MaterialProperty< std::vector< RealGradient > > & _dporosity_dgradvar
 d(porosity)/d(grad porous-flow 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(porous-flow 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(porous-flow 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(porous-flow 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 26 of file PorousFlowMassRadioactiveDecay.h.

Constructor & Destructor Documentation

PorousFlowMassRadioactiveDecay::PorousFlowMassRadioactiveDecay ( const InputParameters &  parameters)

Definition at line 40 of file PorousFlowMassRadioactiveDecay.C.

41  : TimeKernel(parameters),
42  _decay_rate(getParam<Real>("decay_rate")),
43  _fluid_component(getParam<unsigned int>("fluid_component")),
44  _dictator(getUserObject<PorousFlowDictator>("PorousFlowDictator")),
47  _strain_at_nearest_qp(getParam<bool>("strain_at_nearest_qp")),
48  _porosity(getMaterialProperty<Real>("PorousFlow_porosity_nodal")),
49  _dporosity_dvar(getMaterialProperty<std::vector<Real>>("dPorousFlow_porosity_nodal_dvar")),
51  getMaterialProperty<std::vector<RealGradient>>("dPorousFlow_porosity_nodal_dgradvar")),
53  ? &getMaterialProperty<unsigned int>("PorousFlow_nearestqp_nodal")
54  : nullptr),
55  _fluid_density(getMaterialProperty<std::vector<Real>>("PorousFlow_fluid_phase_density_nodal")),
56  _dfluid_density_dvar(getMaterialProperty<std::vector<std::vector<Real>>>(
57  "dPorousFlow_fluid_phase_density_nodal_dvar")),
58  _fluid_saturation_nodal(getMaterialProperty<std::vector<Real>>("PorousFlow_saturation_nodal")),
60  getMaterialProperty<std::vector<std::vector<Real>>>("dPorousFlow_saturation_nodal_dvar")),
61  _mass_frac(getMaterialProperty<std::vector<std::vector<Real>>>("PorousFlow_mass_frac_nodal")),
62  _dmass_frac_dvar(getMaterialProperty<std::vector<std::vector<std::vector<Real>>>>(
63  "dPorousFlow_mass_frac_nodal_dvar"))
64 {
66  mooseError("The Dictator proclaims that the number of components in this simulation is ",
68  " whereas you have used the Kernel PorousFlowComponetMassRadioactiveDecay with "
69  "component = ",
71  ". The Dictator does not take such mistakes lightly");
72 }
const MaterialProperty< std::vector< std::vector< std::vector< Real > > > > & _dmass_frac_dvar
d(nodal mass fraction)/d(porous-flow variable)
const MaterialProperty< std::vector< Real > > & _dporosity_dvar
d(porosity)/d(porous-flow 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
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 porous-flow 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(porous-flow variable)
const MaterialProperty< std::vector< std::vector< Real > > > & _dfluid_saturation_nodal_dvar
d(nodal fluid saturation)/d(porous-flow variable)
const MaterialProperty< unsigned int > *const _nearest_qp
the nearest qp to the node
const PorousFlowDictator & _dictator
holds info on the PorousFlow variables
const MaterialProperty< std::vector< Real > > & _fluid_density
nodal fluid density
const MaterialProperty< std::vector< Real > > & _fluid_saturation_nodal
nodal fluid saturation
unsigned int numPhases() const
the number of fluid phases
bool isPorousFlowVariable(unsigned int moose_var_num) const
returns true if moose_var_num is a porous flow variable
const bool _var_is_porflow_var
whether the Variable for this Kernel is a porous-flow 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

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

As the fluid mass is lumped to the nodes, only non-zero terms are for _i==_j

Definition at line 104 of file PorousFlowMassRadioactiveDecay.C.

Referenced by computeQpJacobian(), and computeQpOffDiagJacobian().

105 {
106  const unsigned nearest_qp = (_strain_at_nearest_qp ? (*_nearest_qp)[_i] : _i);
107 
108  // porosity is dependent on variables that are lumped to the nodes,
109  // but it can depend on the gradient
110  // of variables, which are NOT lumped to the nodes, hence:
111  Real dmass = 0.0;
112  for (unsigned ph = 0; ph < _num_phases; ++ph)
113  dmass += _fluid_density[_i][ph] * _fluid_saturation_nodal[_i][ph] *
114  _mass_frac[_i][ph][_fluid_component] * _dporosity_dgradvar[_i][pvar] *
115  _grad_phi[_j][nearest_qp];
116 
117  if (_i != _j)
118  return _test[_i][_qp] * _decay_rate * dmass;
119 
121  for (unsigned ph = 0; ph < _num_phases; ++ph)
122  {
123  dmass += _dfluid_density_dvar[_i][ph][pvar] * _fluid_saturation_nodal[_i][ph] *
124  _mass_frac[_i][ph][_fluid_component] * _porosity[_i];
125  dmass += _fluid_density[_i][ph] * _dfluid_saturation_nodal_dvar[_i][ph][pvar] *
126  _mass_frac[_i][ph][_fluid_component] * _porosity[_i];
127  dmass += _fluid_density[_i][ph] * _fluid_saturation_nodal[_i][ph] *
128  _dmass_frac_dvar[_i][ph][_fluid_component][pvar] * _porosity[_i];
129  dmass += _fluid_density[_i][ph] * _fluid_saturation_nodal[_i][ph] *
130  _mass_frac[_i][ph][_fluid_component] * _dporosity_dvar[_i][pvar];
131  }
132  return _test[_i][_qp] * _decay_rate * dmass;
133 }
const MaterialProperty< std::vector< std::vector< std::vector< Real > > > > & _dmass_frac_dvar
d(nodal mass fraction)/d(porous-flow variable)
const MaterialProperty< std::vector< Real > > & _dporosity_dvar
d(porosity)/d(porous-flow 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 porous-flow 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(porous-flow variable)
const MaterialProperty< std::vector< std::vector< Real > > > & _dfluid_saturation_nodal_dvar
d(nodal fluid saturation)/d(porous-flow 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 ...
Real PorousFlowMassRadioactiveDecay::computeQpJacobian ( )
overrideprotectedvirtual

If the variable is not a PorousFlow variable (very unusual), the diag Jacobian terms are 0

Definition at line 86 of file PorousFlowMassRadioactiveDecay.C.

87 {
90  return 0.0;
91  return computeQpJac(_dictator.porousFlowVariableNum(_var.number()));
92 }
const PorousFlowDictator & _dictator
holds info on the PorousFlow variables
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 porous-flow variable according to the Dictator ...
Real PorousFlowMassRadioactiveDecay::computeQpOffDiagJacobian ( unsigned int  jvar)
overrideprotectedvirtual

If the variable is not a PorousFlow variable, the OffDiag Jacobian terms are 0

Definition at line 95 of file PorousFlowMassRadioactiveDecay.C.

96 {
99  return 0.0;
101 }
const PorousFlowDictator & _dictator
holds info on the PorousFlow variables
bool notPorousFlowVariable(unsigned int moose_var_num) const
returns true if moose_var_num is not a porous flow variabe
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...
Real PorousFlowMassRadioactiveDecay::computeQpResidual ( )
overrideprotectedvirtual

Definition at line 75 of file PorousFlowMassRadioactiveDecay.C.

76 {
77  Real mass = 0.0;
78  for (unsigned ph = 0; ph < _num_phases; ++ph)
79  mass += _fluid_density[_i][ph] * _fluid_saturation_nodal[_i][ph] *
81 
82  return _test[_i][_qp] * _decay_rate * _porosity[_i] * mass;
83 }
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

const Real PorousFlowMassRadioactiveDecay::_decay_rate
protected

The decay rate.

Definition at line 37 of file PorousFlowMassRadioactiveDecay.h.

Referenced by computeQpJac(), and computeQpResidual().

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

d(nodal fluid density)/d(porous-flow variable)

Definition at line 70 of file PorousFlowMassRadioactiveDecay.h.

Referenced by computeQpJac().

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

d(nodal fluid saturation)/d(porous-flow variable)

Definition at line 76 of file PorousFlowMassRadioactiveDecay.h.

Referenced by computeQpJac().

const PorousFlowDictator& PorousFlowMassRadioactiveDecay::_dictator
protected

holds info on the PorousFlow variables

Definition at line 43 of file PorousFlowMassRadioactiveDecay.h.

Referenced by computeQpJacobian(), computeQpOffDiagJacobian(), and PorousFlowMassRadioactiveDecay().

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

d(nodal mass fraction)/d(porous-flow variable)

Definition at line 82 of file PorousFlowMassRadioactiveDecay.h.

Referenced by computeQpJac().

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

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

Definition at line 61 of file PorousFlowMassRadioactiveDecay.h.

Referenced by computeQpJac().

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

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

Definition at line 58 of file PorousFlowMassRadioactiveDecay.h.

Referenced by computeQpJac().

const unsigned int PorousFlowMassRadioactiveDecay::_fluid_component
protected

the fluid component index

Definition at line 40 of file PorousFlowMassRadioactiveDecay.h.

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

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

nodal fluid density

Definition at line 67 of file PorousFlowMassRadioactiveDecay.h.

Referenced by computeQpJac(), and computeQpResidual().

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

nodal fluid saturation

Definition at line 73 of file PorousFlowMassRadioactiveDecay.h.

Referenced by computeQpJac(), and computeQpResidual().

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

nodal mass fraction

Definition at line 79 of file PorousFlowMassRadioactiveDecay.h.

Referenced by computeQpJac(), and computeQpResidual().

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

the nearest qp to the node

Definition at line 64 of file PorousFlowMassRadioactiveDecay.h.

const unsigned int PorousFlowMassRadioactiveDecay::_num_phases
protected

number of fluid phases

Definition at line 49 of file PorousFlowMassRadioactiveDecay.h.

Referenced by computeQpJac(), and computeQpResidual().

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 55 of file PorousFlowMassRadioactiveDecay.h.

Referenced by computeQpJac(), and computeQpResidual().

const bool PorousFlowMassRadioactiveDecay::_strain_at_nearest_qp
protected

whether the porosity uses the volumetric strain at the closest quadpoint

Definition at line 52 of file PorousFlowMassRadioactiveDecay.h.

Referenced by computeQpJac().

const bool PorousFlowMassRadioactiveDecay::_var_is_porflow_var
protected

whether the Variable for this Kernel is a porous-flow variable according to the Dictator

Definition at line 46 of file PorousFlowMassRadioactiveDecay.h.

Referenced by computeQpJacobian().


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