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