www.mooseframework.org
PorousFlowTotalGravitationalDensityFullySaturatedFromPorosity.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 {
15  params.addRequiredRangeCheckedParam<Real>(
16  "rho_s", "rho_s >= 0", "The density of the solid matrix");
17  params.addClassDescription(
18  "This Material calculates the porous medium density from the porosity, solid density "
19  "(assumed constant) and fluid density, for the fully-saturated single fluid phase case, "
20  "using a linear weighted average. "
21  "density = phi * rho_f + (1 - phi) * rho_s, where phi is porosity and rho_f, rho_s are "
22  "the densities of the fluid and solid phases.");
23  return params;
24 }
25 
28  const InputParameters & parameters)
30  _rho_s(getParam<Real>("rho_s")),
31  _rho_f_qp(getMaterialProperty<std::vector<Real>>("PorousFlow_fluid_phase_density_qp")),
32  _porosity_qp(getMaterialProperty<Real>("PorousFlow_porosity_qp")),
33  _drho_f_qp_dvar(getMaterialProperty<std::vector<std::vector<Real>>>(
34  "dPorousFlow_fluid_phase_density_qp_dvar")),
35  _dporosity_qp_dvar(getMaterialProperty<std::vector<Real>>("dPorousFlow_porosity_qp_dvar"))
36 {
37  if (_num_phases != 1)
38  mooseError("The Dictator proclaims that the number of phases is ",
39  _dictator.numPhases(),
40  " whereas PorousFlowThermalConductivityFromPorosity can only be used for 1-phase "
41  "simulations. Be aware that the Dictator has noted your mistake.");
42  if (_nodal_material == true)
43  mooseError("PorousFlowTotalGravitationalDensityFullySaturatedFromPorosity is only defined for "
44  "at_nodes = false");
45 }
46 
47 void
49 {
50  const unsigned ph = 0;
51  _gravdensity[_qp] = _rho_s * (1.0 - _porosity_qp[_qp]) + _rho_f_qp[_qp][ph] * _porosity_qp[_qp];
52 }
53 
54 void
56 {
57  const unsigned ph = 0;
58  _gravdensity[_qp] = _rho_s * (1.0 - _porosity_qp[_qp]) + _rho_f_qp[_qp][ph] * _porosity_qp[_qp];
59 
60  _dgravdensity_dvar[_qp].resize(_num_var);
61  for (unsigned int v = 0; v < _num_var; ++v)
62  {
63  _dgravdensity_dvar[_qp][v] = _dporosity_qp_dvar[_qp][v] * (_rho_f_qp[_qp][ph] - _rho_s) +
64  _drho_f_qp_dvar[_qp][ph][v] * _porosity_qp[_qp];
65  }
66 }
InputParameters validParams< PorousFlowTotalGravitationalDensityFullySaturatedFromPorosity >()
const unsigned int _num_phases
Number of phases.
const MaterialProperty< std::vector< std::vector< Real > > > & _drho_f_qp_dvar
d(rho_f)/d(PorousFlow variable)
InputParameters validParams< PorousFlowTotalGravitationalDensityBase >()
Base class Material designed to provide the density of the porous medium.
const unsigned int _num_var
Number of PorousFlow variables.
const MaterialProperty< std::vector< Real > > & _dporosity_qp_dvar
d(porosity)/d(PorousFlow variable)
MaterialProperty< std::vector< Real > > & _dgravdensity_dvar
d(density)/d(PorousFlow variable)
MaterialProperty< Real > & _gravdensity
computed density at quadpoints