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

Material designed to form a std::vector<std::vector> of mass fractions from the individual mass fraction variables. More...

#include <PorousFlowMassFraction.h>

Inheritance diagram for PorousFlowMassFraction:
[legend]

Public Member Functions

 PorousFlowMassFraction (const InputParameters &parameters)
 

Protected Member Functions

virtual void initQpStatefulProperties () override
 
virtual void computeQpProperties () override
 
void build_mass_frac (unsigned int qp)
 Builds the mass-fraction variable matrix at the quad point. More...
 

Protected Attributes

MaterialProperty< std::vector< std::vector< Real > > > & _mass_frac
 Mass fraction matrix at quadpoint or nodes. More...
 
MaterialProperty< std::vector< std::vector< RealGradient > > > *const _grad_mass_frac
 Gradient of the mass fraction matrix at the quad points. More...
 
MaterialProperty< std::vector< std::vector< std::vector< Real > > > > & _dmass_frac_dvar
 Derivative of the mass fraction matrix with respect to the porous flow variables. More...
 
const unsigned int _num_passed_mf_vars
 Number of mass-fraction variables provided by the user This needs to be num_phases*(_num_components - 1), since the mass fraction of the final component in each phase is determined as 1 - sum{components}(mass fraction of all other components in the phase) More...
 
std::vector< unsigned int > _mf_vars_num
 The variable number of the mass-fraction variables. More...
 
std::vector< const VariableValue * > _mf_vars
 The mass-fraction variables. More...
 
std::vector< const VariableGradient * > _grad_mf_vars
 The gradient of the mass-fraction variables. 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

Material designed to form a std::vector<std::vector> of mass fractions from the individual mass fraction variables.

Definition at line 24 of file PorousFlowMassFraction.h.

Constructor & Destructor Documentation

◆ PorousFlowMassFraction()

PorousFlowMassFraction::PorousFlowMassFraction ( const InputParameters &  parameters)

Definition at line 32 of file PorousFlowMassFraction.C.

33  : PorousFlowMaterialVectorBase(parameters),
34 
35  _mass_frac(_nodal_material
36  ? declareProperty<std::vector<std::vector<Real>>>("PorousFlow_mass_frac_nodal")
37  : declareProperty<std::vector<std::vector<Real>>>("PorousFlow_mass_frac_qp")),
38  _grad_mass_frac(_nodal_material ? nullptr
39  : &declareProperty<std::vector<std::vector<RealGradient>>>(
40  "PorousFlow_grad_mass_frac_qp")),
41  _dmass_frac_dvar(_nodal_material ? declareProperty<std::vector<std::vector<std::vector<Real>>>>(
42  "dPorousFlow_mass_frac_nodal_dvar")
43  : declareProperty<std::vector<std::vector<std::vector<Real>>>>(
44  "dPorousFlow_mass_frac_qp_dvar")),
45 
46  _num_passed_mf_vars(coupledComponents("mass_fraction_vars"))
47 {
48  if (_num_phases < 1 || _num_components < 1)
49  mooseError("PorousFlowMassFraction: The Dictator proclaims that the number of phases is ",
51  " and the number of components is ",
53  ", and stipulates that you should not use PorousFlowMassFraction in this case");
54 
56  paramError("mass_fraction_vars",
57  "This value must be equal to the Dictator's num_phases (",
59  ") multiplied by num_components-1 (",
60  _num_components - 1,
61  ")");
62 
66  for (unsigned i = 0; i < _num_passed_mf_vars; ++i)
67  {
68  _mf_vars_num[i] = coupled("mass_fraction_vars", i);
69  _mf_vars[i] = (_nodal_material ? &coupledNodalValue("mass_fraction_vars", i)
70  : &coupledValue("mass_fraction_vars", i));
71  _grad_mf_vars[i] = &coupledGradient("mass_fraction_vars", i);
72  }
73 }
const unsigned int _num_phases
Number of phases.
MaterialProperty< std::vector< std::vector< RealGradient > > > *const _grad_mass_frac
Gradient of the mass fraction matrix at the quad points.
MaterialProperty< std::vector< std::vector< std::vector< Real > > > > & _dmass_frac_dvar
Derivative of the mass fraction matrix with respect to the porous flow variables. ...
std::vector< unsigned int > _mf_vars_num
The variable number of the mass-fraction variables.
const unsigned int _num_components
Number of fluid components.
PorousFlowMaterialVectorBase(const InputParameters &parameters)
std::vector< const VariableValue * > _mf_vars
The mass-fraction variables.
std::vector< const VariableGradient * > _grad_mf_vars
The gradient of the mass-fraction variables.
const unsigned int _num_passed_mf_vars
Number of mass-fraction variables provided by the user This needs to be num_phases*(_num_components -...
MaterialProperty< std::vector< std::vector< Real > > > & _mass_frac
Mass fraction matrix at quadpoint or nodes.

Member Function Documentation

◆ build_mass_frac()

void PorousFlowMassFraction::build_mass_frac ( unsigned int  qp)
protected

Builds the mass-fraction variable matrix at the quad point.

Parameters
qpthe quad point

◆ computeQpProperties()

void PorousFlowMassFraction::computeQpProperties ( )
overrideprotectedvirtual

Reimplemented in PorousFlowMassFractionAqueousEquilibriumChemistry.

Definition at line 84 of file PorousFlowMassFraction.C.

Referenced by PorousFlowMassFractionAqueousEquilibriumChemistry::computeQpProperties(), and initQpStatefulProperties().

85 {
86  // size all properties correctly
87  _mass_frac[_qp].resize(_num_phases);
88  _dmass_frac_dvar[_qp].resize(_num_phases);
89  if (!_nodal_material)
90  (*_grad_mass_frac)[_qp].resize(_num_phases);
91  for (unsigned int ph = 0; ph < _num_phases; ++ph)
92  {
93  _mass_frac[_qp][ph].resize(_num_components);
94  _dmass_frac_dvar[_qp][ph].resize(_num_components);
95  for (unsigned int comp = 0; comp < _num_components; ++comp)
96  _dmass_frac_dvar[_qp][ph][comp].assign(_num_var, 0.0);
97  if (!_nodal_material)
98  (*_grad_mass_frac)[_qp][ph].resize(_num_components);
99  }
100 
101  // compute the values and derivatives
102  unsigned int i = 0;
103  for (unsigned int ph = 0; ph < _num_phases; ++ph)
104  {
105  Real total_mass_frac = 0;
106  if (!_nodal_material)
107  (*_grad_mass_frac)[_qp][ph][_num_components - 1] = 0.0;
108  for (unsigned int comp = 0; comp < _num_components - 1; ++comp)
109  {
110  _mass_frac[_qp][ph][comp] = (*_mf_vars[i])[_qp];
111  total_mass_frac += _mass_frac[_qp][ph][comp];
112  if (!_nodal_material)
113  {
114  (*_grad_mass_frac)[_qp][ph][comp] = (*_grad_mf_vars[i])[_qp];
115  (*_grad_mass_frac)[_qp][ph][_num_components - 1] -= (*_grad_mf_vars[i])[_qp];
116  }
117  if (_dictator.isPorousFlowVariable(_mf_vars_num[i]))
118  {
119  // _mf_vars[i] is a PorousFlow variable
120  const unsigned int pf_var_num = _dictator.porousFlowVariableNum(_mf_vars_num[i]);
121  _dmass_frac_dvar[_qp][ph][comp][pf_var_num] = 1.0;
122  _dmass_frac_dvar[_qp][ph][_num_components - 1][pf_var_num] = -1.0;
123  }
124  i++;
125  }
126  _mass_frac[_qp][ph][_num_components - 1] = 1.0 - total_mass_frac;
127  }
128 }
const unsigned int _num_phases
Number of phases.
MaterialProperty< std::vector< std::vector< std::vector< Real > > > > & _dmass_frac_dvar
Derivative of the mass fraction matrix with respect to the porous flow variables. ...
std::vector< unsigned int > _mf_vars_num
The variable number of the mass-fraction variables.
const unsigned int _num_components
Number of fluid components.
const unsigned int _num_var
Number of PorousFlow variables.
std::vector< const VariableValue * > _mf_vars
The mass-fraction variables.
std::vector< const VariableGradient * > _grad_mf_vars
The gradient of the mass-fraction variables.
MaterialProperty< std::vector< std::vector< Real > > > & _mass_frac
Mass fraction matrix at quadpoint or nodes.

◆ initQpStatefulProperties()

void PorousFlowMassFraction::initQpStatefulProperties ( )
overrideprotectedvirtual

Reimplemented in PorousFlowMassFractionAqueousEquilibriumChemistry.

Definition at line 76 of file PorousFlowMassFraction.C.

77 {
78  // all we need to do is compute _mass_frac for _nodal_materials
79  // but the following avoids code duplication
81 }
virtual void computeQpProperties() override

Member Data Documentation

◆ _dmass_frac_dvar

MaterialProperty<std::vector<std::vector<std::vector<Real> > > >& PorousFlowMassFraction::_dmass_frac_dvar
protected

Derivative of the mass fraction matrix with respect to the porous flow variables.

Definition at line 37 of file PorousFlowMassFraction.h.

Referenced by PorousFlowMassFractionAqueousEquilibriumChemistry::computeQpProperties(), and computeQpProperties().

◆ _grad_mass_frac

MaterialProperty<std::vector<std::vector<RealGradient> > >* const PorousFlowMassFraction::_grad_mass_frac
protected

Gradient of the mass fraction matrix at the quad points.

Definition at line 34 of file PorousFlowMassFraction.h.

Referenced by PorousFlowMassFractionAqueousEquilibriumChemistry::computeQpProperties().

◆ _grad_mf_vars

std::vector<const VariableGradient *> PorousFlowMassFraction::_grad_mf_vars
protected

The gradient of the mass-fraction variables.

Definition at line 63 of file PorousFlowMassFraction.h.

Referenced by PorousFlowMassFractionAqueousEquilibriumChemistry::computeQpProperties(), computeQpProperties(), and PorousFlowMassFraction().

◆ _mass_frac

MaterialProperty<std::vector<std::vector<Real> > >& PorousFlowMassFraction::_mass_frac
protected

Mass fraction matrix at quadpoint or nodes.

Definition at line 31 of file PorousFlowMassFraction.h.

Referenced by PorousFlowMassFractionAqueousEquilibriumChemistry::computeQpProperties(), and computeQpProperties().

◆ _mf_vars

std::vector<const VariableValue *> PorousFlowMassFraction::_mf_vars
protected

◆ _mf_vars_num

std::vector<unsigned int> PorousFlowMassFraction::_mf_vars_num
protected

The variable number of the mass-fraction variables.

Definition at line 57 of file PorousFlowMassFraction.h.

Referenced by PorousFlowMassFractionAqueousEquilibriumChemistry::computeQpProperties(), computeQpProperties(), and PorousFlowMassFraction().

◆ _num_components

const unsigned int PorousFlowMaterialVectorBase::_num_components
protectedinherited

◆ _num_passed_mf_vars

const unsigned int PorousFlowMassFraction::_num_passed_mf_vars
protected

Number of mass-fraction variables provided by the user This needs to be num_phases*(_num_components - 1), since the mass fraction of the final component in each phase is determined as 1 - sum{components}(mass fraction of all other components in the phase)

Definition at line 54 of file PorousFlowMassFraction.h.

Referenced by PorousFlowMassFraction().

◆ _num_phases

const unsigned int PorousFlowMaterialVectorBase::_num_phases
protectedinherited

◆ _num_var

const unsigned int PorousFlowMaterialVectorBase::_num_var
protectedinherited

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