www.mooseframework.org
PorousFlowVariableBase.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 
9 
10 template <>
11 InputParameters
13 {
14  InputParameters params = validParams<PorousFlowMaterial>();
15  params.addClassDescription("Base class for thermophysical variable materials. Provides pressure "
16  "and saturation material properties for all phases as required");
17  return params;
18 }
19 
20 PorousFlowVariableBase::PorousFlowVariableBase(const InputParameters & parameters)
21  : DerivativeMaterialInterface<PorousFlowMaterial>(parameters),
22 
23  _num_phases(_dictator.numPhases()),
24  _num_components(_dictator.numComponents()),
25  _num_pf_vars(_dictator.numVariables()),
26 
27  _porepressure(_nodal_material
28  ? declareProperty<std::vector<Real>>("PorousFlow_porepressure_nodal")
29  : declareProperty<std::vector<Real>>("PorousFlow_porepressure_qp")),
30  _dporepressure_dvar(
31  _nodal_material
32  ? declareProperty<std::vector<std::vector<Real>>>("dPorousFlow_porepressure_nodal_dvar")
33  : declareProperty<std::vector<std::vector<Real>>>("dPorousFlow_porepressure_qp_dvar")),
34  _gradp_qp(_nodal_material
35  ? nullptr
36  : &declareProperty<std::vector<RealGradient>>("PorousFlow_grad_porepressure_qp")),
37  _dgradp_qp_dgradv(_nodal_material ? nullptr
38  : &declareProperty<std::vector<std::vector<Real>>>(
39  "dPorousFlow_grad_porepressure_qp_dgradvar")),
40  _dgradp_qp_dv(_nodal_material ? nullptr
41  : &declareProperty<std::vector<std::vector<RealGradient>>>(
42  "dPorousFlow_grad_porepressure_qp_dvar")),
43 
44  _saturation(_nodal_material ? declareProperty<std::vector<Real>>("PorousFlow_saturation_nodal")
45  : declareProperty<std::vector<Real>>("PorousFlow_saturation_qp")),
46  _dsaturation_dvar(
47  _nodal_material
48  ? declareProperty<std::vector<std::vector<Real>>>("dPorousFlow_saturation_nodal_dvar")
49  : declareProperty<std::vector<std::vector<Real>>>("dPorousFlow_saturation_qp_dvar")),
50  _grads_qp(_nodal_material
51  ? nullptr
52  : &declareProperty<std::vector<RealGradient>>("PorousFlow_grad_saturation_qp")),
53  _dgrads_qp_dgradv(_nodal_material ? nullptr
54  : &declareProperty<std::vector<std::vector<Real>>>(
55  "dPorousFlow_grad_saturation_qp_dgradvar")),
56  _dgrads_qp_dv(_nodal_material ? nullptr
57  : &declareProperty<std::vector<std::vector<RealGradient>>>(
58  "dPorousFlow_grad_saturation_qp_dv"))
59 {
60 }
61 
62 void
64 {
65  _porepressure[_qp].resize(_num_phases);
66  _saturation[_qp].resize(_num_phases);
67  // the porepressure and saturation values get set by derived classes
68 }
69 
70 void
72 {
73  // do we really need this stuff here? it seems very inefficient to keep resizing everything!
74  _porepressure[_qp].resize(_num_phases);
75  _dporepressure_dvar[_qp].resize(_num_phases);
76 
77  _saturation[_qp].resize(_num_phases);
78  _dsaturation_dvar[_qp].resize(_num_phases);
79 
80  if (!_nodal_material)
81  {
82  (*_gradp_qp)[_qp].resize(_num_phases);
83  (*_dgradp_qp_dgradv)[_qp].resize(_num_phases);
84  (*_dgradp_qp_dv)[_qp].resize(_num_phases);
85 
86  (*_grads_qp)[_qp].resize(_num_phases);
87  (*_dgrads_qp_dgradv)[_qp].resize(_num_phases);
88  (*_dgrads_qp_dv)[_qp].resize(_num_phases);
89  }
90 
92  for (unsigned phase = 0; phase < _num_phases; ++phase)
93  {
94  _dporepressure_dvar[_qp][phase].assign(_num_pf_vars, 0.0);
95  _dsaturation_dvar[_qp][phase].assign(_num_pf_vars, 0.0);
96  if (!_nodal_material)
97  {
98  (*_dgradp_qp_dgradv)[_qp][phase].assign(_num_pf_vars, 0.0);
99  (*_dgradp_qp_dv)[_qp][phase].assign(_num_pf_vars, RealGradient());
100  (*_dgrads_qp_dgradv)[_qp][phase].assign(_num_pf_vars, 0.0);
101  (*_dgrads_qp_dv)[_qp][phase].assign(_num_pf_vars, RealGradient());
102  }
103  }
104 }
InputParameters validParams< PorousFlowVariableBase >()
MaterialProperty< std::vector< std::vector< Real > > > & _dporepressure_dvar
d(porepressure)/d(PorousFlow variable)
const unsigned int _num_pf_vars
Number of PorousFlow variables.
MaterialProperty< std::vector< Real > > & _saturation
Computed nodal or qp saturation of the phases.
MaterialProperty< std::vector< std::vector< Real > > > & _dsaturation_dvar
d(saturation)/d(PorousFlow variable)
PorousFlowVariableBase(const InputParameters &parameters)
InputParameters validParams< PorousFlowMaterial >()
virtual void initQpStatefulProperties() override
virtual void computeQpProperties() override
const unsigned int _num_phases
Number of phases.
MaterialProperty< std::vector< Real > > & _porepressure
Computed nodal or quadpoint values of porepressure of the phases.