www.mooseframework.org
PorousFlowEffectiveFluidPressure.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
11 
14 
15 template <bool is_ad>
18 {
20  params.set<std::string>("pf_material_type") = "effective_pressure";
21  params.addClassDescription("This Material calculates an effective fluid pressure: "
22  "effective_stress = total_stress + "
23  "biot_coeff*effective_fluid_pressure. The effective_fluid_pressure = "
24  "sum_{phases}(S_phase * P_phase)");
25  return params;
26 }
27 
28 template <bool is_ad>
30  const InputParameters & parameters)
31  : PorousFlowMaterialVectorBase(parameters),
32  _porepressure(
33  _nodal_material
34  ? getGenericMaterialProperty<std::vector<Real>, is_ad>("PorousFlow_porepressure_nodal")
35  : getGenericMaterialProperty<std::vector<Real>, is_ad>("PorousFlow_porepressure_qp")),
36  _dporepressure_dvar(is_ad ? nullptr
37  : _nodal_material ? &getMaterialProperty<std::vector<std::vector<Real>>>(
38  "dPorousFlow_porepressure_nodal_dvar")
39  : &getMaterialProperty<std::vector<std::vector<Real>>>(
40  "dPorousFlow_porepressure_qp_dvar")),
41  _saturation(
42  _nodal_material
43  ? getGenericMaterialProperty<std::vector<Real>, is_ad>("PorousFlow_saturation_nodal")
44  : getGenericMaterialProperty<std::vector<Real>, is_ad>("PorousFlow_saturation_qp")),
45  _dsaturation_dvar(is_ad ? nullptr
46  : _nodal_material ? &getMaterialProperty<std::vector<std::vector<Real>>>(
47  "dPorousFlow_saturation_nodal_dvar")
48  : &getMaterialProperty<std::vector<std::vector<Real>>>(
49  "dPorousFlow_saturation_qp_dvar")),
50  _pf(_nodal_material
51  ? declareGenericProperty<Real, is_ad>("PorousFlow_effective_fluid_pressure_nodal")
52  : declareGenericProperty<Real, is_ad>("PorousFlow_effective_fluid_pressure_qp")),
53  _dpf_dvar(
54  is_ad ? nullptr
55  : _nodal_material
56  ? &declareProperty<std::vector<Real>>("dPorousFlow_effective_fluid_pressure_nodal_dvar")
57  : &declareProperty<std::vector<Real>>("dPorousFlow_effective_fluid_pressure_qp_dvar"))
58 {
59 }
60 
61 template <bool is_ad>
62 void
64 {
65  _pf[_qp] = 0.0;
66  for (unsigned int ph = 0; ph < _num_phases; ++ph)
67  _pf[_qp] += _saturation[_qp][ph] * _porepressure[_qp][ph];
68 }
69 
70 template <bool is_ad>
71 void
73 {
74  _pf[_qp] = 0.0;
75 
76  if (!is_ad)
77  (*_dpf_dvar)[_qp].assign(_num_var, 0.0);
78 
79  for (unsigned int ph = 0; ph < _num_phases; ++ph)
80  {
81  _pf[_qp] += _saturation[_qp][ph] * _porepressure[_qp][ph];
82 
83  if constexpr (!is_ad)
84  for (unsigned int v = 0; v < _num_var; ++v)
85  (*_dpf_dvar)[_qp][v] += (*_dsaturation_dvar)[_qp][ph][v] * _porepressure[_qp][ph] +
86  _saturation[_qp][ph] * (*_dporepressure_dvar)[_qp][ph][v];
87  }
88 }
T & set(const std::string &name, bool quiet_mode=false)
registerMooseObject("PorousFlowApp", PorousFlowEffectiveFluidPressure)
Material designed to calculate the effective fluid pressure that can be used in the mechanical effect...
Base class for all PorousFlow vector materials.
PorousFlowEffectiveFluidPressureTempl(const InputParameters &parameters)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static const std::string v
Definition: NS.h:82
void addClassDescription(const std::string &doc_string)