https://mooseframework.inl.gov
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
PorousFlowJoinerTempl< is_ad > Class Template Reference

Material designed to form a std::vector of property and derivatives of these wrt the nonlinear variables from the individual phase properties. More...

#include <PorousFlowJoiner.h>

Inheritance diagram for PorousFlowJoinerTempl< is_ad >:
[legend]

Public Types

typedef DerivativeMaterialPropertyNameInterface::SymbolName SymbolName
 

Public Member Functions

 PorousFlowJoinerTempl (const InputParameters &parameters)
 
const GenericMaterialProperty< U, is_ad > & getDefaultMaterialProperty (const std::string &name)
 
const GenericMaterialProperty< U, is_ad > & getDefaultMaterialPropertyByName (const std::string &name)
 
void validateDerivativeMaterialPropertyBase (const std::string &base)
 
const MaterialPropertyName derivativePropertyName (const MaterialPropertyName &base, const std::vector< SymbolName > &c) const
 
const MaterialPropertyName derivativePropertyNameFirst (const MaterialPropertyName &base, const SymbolName &c1) const
 
const MaterialPropertyName derivativePropertyNameSecond (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2) const
 
const MaterialPropertyName derivativePropertyNameThird (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2, const SymbolName &c3) const
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const std::vector< VariableName > &c)
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const std::vector< SymbolName > &c)
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const std::vector< VariableName > &c)
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const std::vector< SymbolName > &c)
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const std::vector< VariableName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const std::vector< SymbolName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const SymbolName &c1, unsigned int v2, unsigned int v3=libMesh::invalid_uint)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, unsigned int v1, unsigned int v2=libMesh::invalid_uint, unsigned int v3=libMesh::invalid_uint)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const std::vector< VariableName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const std::vector< SymbolName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const SymbolName &c1, unsigned int v2, unsigned int v3=libMesh::invalid_uint)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, unsigned int v1, unsigned int v2=libMesh::invalid_uint, unsigned int v3=libMesh::invalid_uint)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const std::vector< VariableName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const std::vector< SymbolName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const std::vector< VariableName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const std::vector< SymbolName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
void validateCoupling (const MaterialPropertyName &base, const std::vector< VariableName > &c, bool validate_aux=true)
 
void validateCoupling (const MaterialPropertyName &base, const VariableName &c1="", const VariableName &c2="", const VariableName &c3="")
 
void validateCoupling (const MaterialPropertyName &base, const std::vector< VariableName > &c, bool validate_aux=true)
 
void validateCoupling (const MaterialPropertyName &base, const VariableName &c1="", const VariableName &c2="", const VariableName &c3="")
 
void validateNonlinearCoupling (const MaterialPropertyName &base, const VariableName &c1="", const VariableName &c2="", const VariableName &c3="")
 
void validateNonlinearCoupling (const MaterialPropertyName &base, const VariableName &c1="", const VariableName &c2="", const VariableName &c3="")
 
const MaterialPropertyName propertyName (const MaterialPropertyName &base, const std::vector< SymbolName > &c) const
 
const MaterialPropertyName propertyName (const MaterialPropertyName &base, const std::vector< SymbolName > &c) const
 
const MaterialPropertyName propertyNameFirst (const MaterialPropertyName &base, const SymbolName &c1) const
 
const MaterialPropertyName propertyNameFirst (const MaterialPropertyName &base, const SymbolName &c1) const
 
const MaterialPropertyName propertyNameSecond (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2) const
 
const MaterialPropertyName propertyNameSecond (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2) const
 
const MaterialPropertyName propertyNameThird (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2, const SymbolName &c3) const
 
const MaterialPropertyName propertyNameThird (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2, const SymbolName &c3) const
 

Static Public Member Functions

static InputParameters validParams ()
 

Protected Member Functions

virtual void initQpStatefulProperties () override
 
virtual void computeQpProperties () override
 

Protected Attributes

const std::string _pf_prop
 Name of material property to be joined. More...
 
const MaterialProperty< std::vector< std::vector< Real > > > *const _dporepressure_dvar
 Derivatives of porepressure variable wrt PorousFlow variables at the qps or nodes. More...
 
const MaterialProperty< std::vector< std::vector< Real > > > *const _dsaturation_dvar
 Derivatives of saturation variable wrt PorousFlow variables at the qps or nodes. More...
 
const MaterialProperty< std::vector< Real > > *const _dtemperature_dvar
 Derivatives of temperature variable wrt PorousFlow variables at the qps or nodes. More...
 
const bool _has_mass_fraction
 Flag to check whether mass fractions are used. More...
 
const MaterialProperty< std::vector< std::vector< std::vector< Real > > > > *const _dmass_fraction_dvar
 Derivatives of mass fraction variable wrt PorousFlow variables at the qps or nodes. More...
 
GenericMaterialProperty< std::vector< Real >, is_ad > & _property
 Computed property of the phase. More...
 
MaterialProperty< std::vector< std::vector< Real > > > *const _dproperty_dvar
 d(property)/d(PorousFlow variable) More...
 
std::vector< const GenericMaterialProperty< Real, is_ad > * > _phase_property
 Property of each phase. More...
 
std::vector< const MaterialProperty< Real > * > _dphase_property_dp
 d(property of each phase)/d(pressure) More...
 
std::vector< const MaterialProperty< Real > * > _dphase_property_ds
 d(property of each phase)/d(saturation) More...
 
std::vector< const MaterialProperty< Real > * > _dphase_property_dt
 d(property of each phase)/d(temperature) More...
 
std::vector< const MaterialProperty< Real > * > _dphase_property_dX
 d(property of each phase)/d(mass fraction) More...
 
const unsigned int _num_phases
 Number of phases. More...
 
const unsigned int _num_components
 Number of fluid components. More...
 
const unsigned int _num_var
 Number of PorousFlow variables. More...
 

Detailed Description

template<bool is_ad>
class PorousFlowJoinerTempl< is_ad >

Material designed to form a std::vector of property and derivatives of these wrt the nonlinear variables from the individual phase properties.

Values at the quadpoint or the nodes are formed depending on _at_qps

Properties can be viscosities, densities, thermal conductivities , etc and the user specifies the property they are interested in using the pf_prop string.

Also, using d(property)/dP, d(property)/dS, etc, and dP/dvar, dS/dvar, etc, the matrix of derivatives of property with respect to the nonlinear Variables, var, are computed.

Only values at the nodes are used - not at the quadpoints

Definition at line 32 of file PorousFlowJoiner.h.

Constructor & Destructor Documentation

◆ PorousFlowJoinerTempl()

template<bool is_ad>
PorousFlowJoinerTempl< is_ad >::PorousFlowJoinerTempl ( const InputParameters parameters)

Definition at line 31 of file PorousFlowJoiner.C.

32  : PorousFlowMaterialVectorBase(parameters),
33  _pf_prop(getParam<std::string>("material_property")),
34  _dporepressure_dvar(is_ad ? nullptr
35  : !_nodal_material ? &getMaterialProperty<std::vector<std::vector<Real>>>(
36  "dPorousFlow_porepressure_qp_dvar")
37  : &getMaterialProperty<std::vector<std::vector<Real>>>(
38  "dPorousFlow_porepressure_nodal_dvar")),
39  _dsaturation_dvar(is_ad ? nullptr
40  : !_nodal_material ? &getMaterialProperty<std::vector<std::vector<Real>>>(
41  "dPorousFlow_saturation_qp_dvar")
42  : &getMaterialProperty<std::vector<std::vector<Real>>>(
43  "dPorousFlow_saturation_nodal_dvar")),
45  is_ad ? nullptr
46  : !_nodal_material
47  ? &getMaterialProperty<std::vector<Real>>("dPorousFlow_temperature_qp_dvar")
48  : &getMaterialProperty<std::vector<Real>>("dPorousFlow_temperature_nodal_dvar")),
49  _has_mass_fraction(!_nodal_material
50  ? hasGenericMaterialProperty<std::vector<std::vector<Real>>, is_ad>(
51  "PorousFlow_mass_frac_qp")
52  : hasGenericMaterialProperty<std::vector<std::vector<Real>>, is_ad>(
53  "PorousFlow_mass_frac_nodal")),
55  is_ad ? nullptr
57  ? (!_nodal_material ? &getMaterialProperty<std::vector<std::vector<std::vector<Real>>>>(
58  "dPorousFlow_mass_frac_qp_dvar")
59  : &getMaterialProperty<std::vector<std::vector<std::vector<Real>>>>(
60  "dPorousFlow_mass_frac_nodal_dvar"))
61  : nullptr),
62  _property(declareGenericProperty<std::vector<Real>, is_ad>(_pf_prop)),
64  is_ad ? nullptr
65  : &declareProperty<std::vector<std::vector<Real>>>("d" + _pf_prop + "_dvar"))
66 {
68 
69  if (!is_ad)
70  {
75  }
76 
77  for (unsigned int ph = 0; ph < _num_phases; ++ph)
78  {
79  const std::string phase = Moose::stringify(ph);
80  _phase_property[ph] = &getGenericMaterialProperty<Real, is_ad>(_pf_prop + phase);
81 
82  if (!is_ad)
83  {
85  &getMaterialPropertyDerivative<Real>(_pf_prop + phase, _pressure_variable_name);
87  &getMaterialPropertyDerivative<Real>(_pf_prop + phase, _saturation_variable_name);
89  &getMaterialPropertyDerivative<Real>(_pf_prop + phase, _temperature_variable_name);
91  &getMaterialPropertyDerivative<Real>(_pf_prop + phase, _mass_fraction_variable_name);
92  }
93  }
94 }
const bool _has_mass_fraction
Flag to check whether mass fractions are used.
MaterialProperty< std::vector< std::vector< Real > > > *const _dproperty_dvar
d(property)/d(PorousFlow variable)
const unsigned int _num_phases
Number of phases.
std::vector< const MaterialProperty< Real > * > _dphase_property_ds
d(property of each phase)/d(saturation)
const std::string _pf_prop
Name of material property to be joined.
const MaterialProperty< std::vector< std::vector< std::vector< Real > > > > *const _dmass_fraction_dvar
Derivatives of mass fraction variable wrt PorousFlow variables at the qps or nodes.
std::vector< const MaterialProperty< Real > * > _dphase_property_dp
d(property of each phase)/d(pressure)
std::vector< const MaterialProperty< Real > * > _dphase_property_dt
d(property of each phase)/d(temperature)
const MaterialProperty< std::vector< std::vector< Real > > > *const _dsaturation_dvar
Derivatives of saturation variable wrt PorousFlow variables at the qps or nodes.
const MaterialProperty< std::vector< std::vector< Real > > > *const _dporepressure_dvar
Derivatives of porepressure variable wrt PorousFlow variables at the qps or nodes.
std::vector< const GenericMaterialProperty< Real, is_ad > * > _phase_property
Property of each phase.
GenericMaterialProperty< std::vector< Real >, is_ad > & _property
Computed property of the phase.
std::vector< const MaterialProperty< Real > * > _dphase_property_dX
d(property of each phase)/d(mass fraction)
std::string stringify(const T &t)
PorousFlowMaterialVectorBase(const InputParameters &parameters)
const MaterialProperty< std::vector< Real > > *const _dtemperature_dvar
Derivatives of temperature variable wrt PorousFlow variables at the qps or nodes. ...

Member Function Documentation

◆ computeQpProperties()

template<bool is_ad>
void PorousFlowJoinerTempl< is_ad >::computeQpProperties ( )
overrideprotectedvirtual

Definition at line 108 of file PorousFlowJoiner.C.

109 {
111 
112  if (!is_ad)
113  {
114  (*_dproperty_dvar)[_qp].resize(_num_phases);
115  for (unsigned int ph = 0; ph < _num_phases; ++ph)
116  {
117  (*_dproperty_dvar)[_qp][ph].resize(_num_var);
118  for (unsigned v = 0; v < _num_var; ++v)
119  {
120  // the "if" conditions in the following are because a nodal_material's derivatives might
121  // not have been defined. If that is the case, then DerivativeMaterial passes back a
122  // MaterialProperty with zeroes (for the derivatives), but that property will be sized
123  // by the number of quadpoints in the element, which may be smaller than the number of
124  // nodes!
125  (*_dproperty_dvar)[_qp][ph][v] = 0.0;
126  if ((*_dphase_property_dp[ph]).size() > _qp)
127  (*_dproperty_dvar)[_qp][ph][v] +=
128  (*_dphase_property_dp[ph])[_qp] * (*_dporepressure_dvar)[_qp][ph][v];
129  if ((*_dphase_property_ds[ph]).size() > _qp)
130  (*_dproperty_dvar)[_qp][ph][v] +=
131  (*_dphase_property_ds[ph])[_qp] * (*_dsaturation_dvar)[_qp][ph][v];
132  if ((*_dphase_property_dt[ph]).size() > _qp)
133  (*_dproperty_dvar)[_qp][ph][v] +=
134  (*_dphase_property_dt[ph])[_qp] * (*_dtemperature_dvar)[_qp][v];
135 
136  // Only add derivative wrt mass fraction if they exist
137  if (_has_mass_fraction)
138  if ((*_dphase_property_dX[ph]).size() > _qp)
139  (*_dproperty_dvar)[_qp][ph][v] +=
140  (*_dphase_property_dX[ph])[_qp] * (*_dmass_fraction_dvar)[_qp][ph][0][v];
141  }
142  }
143  }
144 }
const bool _has_mass_fraction
Flag to check whether mass fractions are used.
MaterialProperty< std::vector< std::vector< Real > > > *const _dproperty_dvar
d(property)/d(PorousFlow variable)
const unsigned int _num_phases
Number of phases.
std::vector< const MaterialProperty< Real > * > _dphase_property_ds
d(property of each phase)/d(saturation)
const MaterialProperty< std::vector< std::vector< std::vector< Real > > > > *const _dmass_fraction_dvar
Derivatives of mass fraction variable wrt PorousFlow variables at the qps or nodes.
std::vector< const MaterialProperty< Real > * > _dphase_property_dp
d(property of each phase)/d(pressure)
std::vector< const MaterialProperty< Real > * > _dphase_property_dt
d(property of each phase)/d(temperature)
const MaterialProperty< std::vector< std::vector< Real > > > *const _dsaturation_dvar
Derivatives of saturation variable wrt PorousFlow variables at the qps or nodes.
const MaterialProperty< std::vector< std::vector< Real > > > *const _dporepressure_dvar
Derivatives of porepressure variable wrt PorousFlow variables at the qps or nodes.
virtual void initQpStatefulProperties() override
std::vector< const MaterialProperty< Real > * > _dphase_property_dX
d(property of each phase)/d(mass fraction)
const unsigned int _num_var
Number of PorousFlow variables.
static const std::string v
Definition: NS.h:84
const MaterialProperty< std::vector< Real > > *const _dtemperature_dvar
Derivatives of temperature variable wrt PorousFlow variables at the qps or nodes. ...

◆ initQpStatefulProperties()

template<bool is_ad>
void PorousFlowJoinerTempl< is_ad >::initQpStatefulProperties ( )
overrideprotectedvirtual

Definition at line 98 of file PorousFlowJoiner.C.

99 {
100  _property[_qp].resize(_num_phases);
101 
102  for (unsigned int ph = 0; ph < _num_phases; ++ph)
103  _property[_qp][ph] = (*_phase_property[ph])[_qp];
104 }
const unsigned int _num_phases
Number of phases.
std::vector< const GenericMaterialProperty< Real, is_ad > * > _phase_property
Property of each phase.
GenericMaterialProperty< std::vector< Real >, is_ad > & _property
Computed property of the phase.

◆ validParams()

template<bool is_ad>
InputParameters PorousFlowJoinerTempl< is_ad >::validParams ( )
static

Definition at line 18 of file PorousFlowJoiner.C.

19 {
21  params.addRequiredParam<std::string>("material_property",
22  "The property that you want joined into a std::vector");
23  params.set<std::string>("pf_material_type") = "joiner";
24  params.addClassDescription("This Material forms a std::vector of properties, old properties "
25  "(optionally), and derivatives, out of the individual phase "
26  "properties");
27  return params;
28 }
T & set(const std::string &name, bool quiet_mode=false)
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)

Member Data Documentation

◆ _dmass_fraction_dvar

template<bool is_ad>
const MaterialProperty<std::vector<std::vector<std::vector<Real> > > >* const PorousFlowJoinerTempl< is_ad >::_dmass_fraction_dvar
protected

Derivatives of mass fraction variable wrt PorousFlow variables at the qps or nodes.

Definition at line 59 of file PorousFlowJoiner.h.

◆ _dphase_property_dp

template<bool is_ad>
std::vector<const MaterialProperty<Real> *> PorousFlowJoinerTempl< is_ad >::_dphase_property_dp
protected

d(property of each phase)/d(pressure)

Definition at line 71 of file PorousFlowJoiner.h.

Referenced by PorousFlowJoinerTempl< is_ad >::PorousFlowJoinerTempl().

◆ _dphase_property_ds

template<bool is_ad>
std::vector<const MaterialProperty<Real> *> PorousFlowJoinerTempl< is_ad >::_dphase_property_ds
protected

d(property of each phase)/d(saturation)

Definition at line 74 of file PorousFlowJoiner.h.

Referenced by PorousFlowJoinerTempl< is_ad >::PorousFlowJoinerTempl().

◆ _dphase_property_dt

template<bool is_ad>
std::vector<const MaterialProperty<Real> *> PorousFlowJoinerTempl< is_ad >::_dphase_property_dt
protected

d(property of each phase)/d(temperature)

Definition at line 77 of file PorousFlowJoiner.h.

Referenced by PorousFlowJoinerTempl< is_ad >::PorousFlowJoinerTempl().

◆ _dphase_property_dX

template<bool is_ad>
std::vector<const MaterialProperty<Real> *> PorousFlowJoinerTempl< is_ad >::_dphase_property_dX
protected

d(property of each phase)/d(mass fraction)

Definition at line 80 of file PorousFlowJoiner.h.

Referenced by PorousFlowJoinerTempl< is_ad >::PorousFlowJoinerTempl().

◆ _dporepressure_dvar

template<bool is_ad>
const MaterialProperty<std::vector<std::vector<Real> > >* const PorousFlowJoinerTempl< is_ad >::_dporepressure_dvar
protected

Derivatives of porepressure variable wrt PorousFlow variables at the qps or nodes.

Definition at line 47 of file PorousFlowJoiner.h.

◆ _dproperty_dvar

template<bool is_ad>
MaterialProperty<std::vector<std::vector<Real> > >* const PorousFlowJoinerTempl< is_ad >::_dproperty_dvar
protected

d(property)/d(PorousFlow variable)

Definition at line 65 of file PorousFlowJoiner.h.

◆ _dsaturation_dvar

template<bool is_ad>
const MaterialProperty<std::vector<std::vector<Real> > >* const PorousFlowJoinerTempl< is_ad >::_dsaturation_dvar
protected

Derivatives of saturation variable wrt PorousFlow variables at the qps or nodes.

Definition at line 50 of file PorousFlowJoiner.h.

◆ _dtemperature_dvar

template<bool is_ad>
const MaterialProperty<std::vector<Real> >* const PorousFlowJoinerTempl< is_ad >::_dtemperature_dvar
protected

Derivatives of temperature variable wrt PorousFlow variables at the qps or nodes.

Definition at line 53 of file PorousFlowJoiner.h.

◆ _has_mass_fraction

template<bool is_ad>
const bool PorousFlowJoinerTempl< is_ad >::_has_mass_fraction
protected

Flag to check whether mass fractions are used.

Definition at line 56 of file PorousFlowJoiner.h.

◆ _num_components

const unsigned int PorousFlowMaterialVectorBase::_num_components
protectedinherited

◆ _num_phases

const unsigned int PorousFlowMaterialVectorBase::_num_phases
protectedinherited

◆ _num_var

const unsigned int PorousFlowMaterialVectorBase::_num_var
protectedinherited

◆ _pf_prop

template<bool is_ad>
const std::string PorousFlowJoinerTempl< is_ad >::_pf_prop
protected

Name of material property to be joined.

Definition at line 44 of file PorousFlowJoiner.h.

Referenced by PorousFlowJoinerTempl< is_ad >::PorousFlowJoinerTempl().

◆ _phase_property

template<bool is_ad>
std::vector<const GenericMaterialProperty<Real, is_ad> *> PorousFlowJoinerTempl< is_ad >::_phase_property
protected

Property of each phase.

Definition at line 68 of file PorousFlowJoiner.h.

Referenced by PorousFlowJoinerTempl< is_ad >::PorousFlowJoinerTempl().

◆ _property

template<bool is_ad>
GenericMaterialProperty<std::vector<Real>, is_ad>& PorousFlowJoinerTempl< is_ad >::_property
protected

Computed property of the phase.

Definition at line 62 of file PorousFlowJoiner.h.


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