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 23 of file PorousFlowMassFraction.h.

Constructor & Destructor Documentation

PorousFlowMassFraction::PorousFlowMassFraction ( const InputParameters &  parameters)

Definition at line 27 of file PorousFlowMassFraction.C.

28  : PorousFlowMaterialVectorBase(parameters),
29 
30  _mass_frac(_nodal_material
31  ? declareProperty<std::vector<std::vector<Real>>>("PorousFlow_mass_frac_nodal")
32  : declareProperty<std::vector<std::vector<Real>>>("PorousFlow_mass_frac_qp")),
33  _grad_mass_frac(_nodal_material ? nullptr
34  : &declareProperty<std::vector<std::vector<RealGradient>>>(
35  "PorousFlow_grad_mass_frac_qp")),
36  _dmass_frac_dvar(_nodal_material ? declareProperty<std::vector<std::vector<std::vector<Real>>>>(
37  "dPorousFlow_mass_frac_nodal_dvar")
38  : declareProperty<std::vector<std::vector<std::vector<Real>>>>(
39  "dPorousFlow_mass_frac_qp_dvar")),
40 
41  _num_passed_mf_vars(coupledComponents("mass_fraction_vars"))
42 {
43  if (_num_phases < 1 || _num_components < 1)
44  mooseError("PorousFlowMassFraction: The Dictator proclaims that the number of phases is ",
46  " and the number of components is ",
48  ", and stipulates that you should not use PorousFlowMassFraction in this case");
50  mooseError("PorousFlowMassFraction: The number of mass_fraction_vars is ",
52  " which must be equal to the Dictator's num_phases (",
54  ") multiplied by num_components-1 (",
55  _num_components - 1,
56  ")");
57 
61  for (unsigned i = 0; i < _num_passed_mf_vars; ++i)
62  {
63  _mf_vars_num[i] = coupled("mass_fraction_vars", i);
64  _mf_vars[i] = (_nodal_material ? &coupledNodalValue("mass_fraction_vars", i)
65  : &coupledValue("mass_fraction_vars", i));
66  _grad_mf_vars[i] = &coupledGradient("mass_fraction_vars", i);
67  }
68 }
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

void PorousFlowMassFraction::build_mass_frac ( unsigned int  qp)
protected

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

Parameters
qpthe quad point
void PorousFlowMassFraction::computeQpProperties ( )
overrideprotectedvirtual

Definition at line 79 of file PorousFlowMassFraction.C.

Referenced by initQpStatefulProperties().

80 {
81  // size all properties correctly
82  _mass_frac[_qp].resize(_num_phases);
83  _dmass_frac_dvar[_qp].resize(_num_phases);
84  if (!_nodal_material)
85  (*_grad_mass_frac)[_qp].resize(_num_phases);
86  for (unsigned int ph = 0; ph < _num_phases; ++ph)
87  {
88  _mass_frac[_qp][ph].resize(_num_components);
89  _dmass_frac_dvar[_qp][ph].resize(_num_components);
90  for (unsigned int comp = 0; comp < _num_components; ++comp)
91  _dmass_frac_dvar[_qp][ph][comp].assign(_num_var, 0.0);
92  if (!_nodal_material)
93  (*_grad_mass_frac)[_qp][ph].resize(_num_components);
94  }
95 
96  // compute the values and derivatives
97  unsigned int i = 0;
98  for (unsigned int ph = 0; ph < _num_phases; ++ph)
99  {
100  Real total_mass_frac = 0;
101  if (!_nodal_material)
102  (*_grad_mass_frac)[_qp][ph][_num_components - 1] = 0.0;
103  for (unsigned int comp = 0; comp < _num_components - 1; ++comp)
104  {
105  _mass_frac[_qp][ph][comp] = (*_mf_vars[i])[_qp];
106  total_mass_frac += _mass_frac[_qp][ph][comp];
107  if (!_nodal_material)
108  {
109  (*_grad_mass_frac)[_qp][ph][comp] = (*_grad_mf_vars[i])[_qp];
110  (*_grad_mass_frac)[_qp][ph][_num_components - 1] -= (*_grad_mf_vars[i])[_qp];
111  }
112  if (_dictator.isPorousFlowVariable(_mf_vars_num[i]))
113  {
114  // _mf_vars[i] is a PorousFlow variable
115  const unsigned int pf_var_num = _dictator.porousFlowVariableNum(_mf_vars_num[i]);
116  _dmass_frac_dvar[_qp][ph][comp][pf_var_num] = 1.0;
117  _dmass_frac_dvar[_qp][ph][_num_components - 1][pf_var_num] = -1.0;
118  }
119  i++;
120  }
121  _mass_frac[_qp][ph][_num_components - 1] = 1.0 - total_mass_frac;
122  }
123 }
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.
void PorousFlowMassFraction::initQpStatefulProperties ( )
overrideprotectedvirtual

Definition at line 71 of file PorousFlowMassFraction.C.

72 {
73  // all we need to do is compute _mass_frac for _nodal_materials
74  // but the following avoids code duplication
76 }
virtual void computeQpProperties() override

Member Data Documentation

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 36 of file PorousFlowMassFraction.h.

Referenced by computeQpProperties().

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 33 of file PorousFlowMassFraction.h.

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

the gradient of the mass-fraction variables

Definition at line 62 of file PorousFlowMassFraction.h.

Referenced by computeQpProperties(), and PorousFlowMassFraction().

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

Mass fraction matrix at quadpoint or nodes.

Definition at line 30 of file PorousFlowMassFraction.h.

Referenced by computeQpProperties().

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

the mass-fraction variables

Definition at line 59 of file PorousFlowMassFraction.h.

Referenced by computeQpProperties(), and PorousFlowMassFraction().

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

the variable number of the mass-fraction variables

Definition at line 56 of file PorousFlowMassFraction.h.

Referenced by computeQpProperties(), and PorousFlowMassFraction().

const unsigned int PorousFlowMaterialVectorBase::_num_components
protectedinherited
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 53 of file PorousFlowMassFraction.h.

Referenced by PorousFlowMassFraction().

const unsigned int PorousFlowMaterialVectorBase::_num_phases
protectedinherited
const unsigned int PorousFlowMaterialVectorBase::_num_var
protectedinherited

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