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 
16 {
19  "rho_s", "rho_s >= 0", "The density of the solid matrix");
20  params.addClassDescription(
21  "This Material calculates the porous medium density from the porosity, solid density "
22  "(assumed constant) and fluid density, for the fully-saturated single fluid phase case, "
23  "using a linear weighted average. "
24  "density = phi * rho_f + (1 - phi) * rho_s, where phi is porosity and rho_f, rho_s are "
25  "the densities of the fluid and solid phases.");
26  return params;
27 }
28 
31  const InputParameters & parameters)
33  _rho_s(getParam<Real>("rho_s")),
34  _rho_f_qp(getMaterialProperty<std::vector<Real>>("PorousFlow_fluid_phase_density_qp")),
35  _porosity_qp(getMaterialProperty<Real>("PorousFlow_porosity_qp")),
36  _drho_f_qp_dvar(getMaterialProperty<std::vector<std::vector<Real>>>(
37  "dPorousFlow_fluid_phase_density_qp_dvar")),
38  _dporosity_qp_dvar(getMaterialProperty<std::vector<Real>>("dPorousFlow_porosity_qp_dvar"))
39 {
40  if (_num_phases != 1)
41  mooseError("The Dictator proclaims that the number of phases is ",
42  _dictator.numPhases(),
43  " whereas PorousFlowThermalConductivityFromPorosity can only be used for 1-phase "
44  "simulations. Be aware that the Dictator has noted your mistake.");
45 
46  if (_nodal_material == true)
47  mooseError("PorousFlowTotalGravitationalDensityFullySaturatedFromPorosity is only defined for "
48  "at_nodes = false");
49 }
50 
51 void
53 {
54  const unsigned ph = 0;
55  _gravdensity[_qp] = _rho_s * (1.0 - _porosity_qp[_qp]) + _rho_f_qp[_qp][ph] * _porosity_qp[_qp];
56 }
57 
58 void
60 {
61  const unsigned ph = 0;
62  _gravdensity[_qp] = _rho_s * (1.0 - _porosity_qp[_qp]) + _rho_f_qp[_qp][ph] * _porosity_qp[_qp];
63 
65  for (unsigned int v = 0; v < _num_var; ++v)
66  {
67  _dgravdensity_dvar[_qp][v] = _dporosity_qp_dvar[_qp][v] * (_rho_f_qp[_qp][ph] - _rho_s) +
68  _drho_f_qp_dvar[_qp][ph][v] * _porosity_qp[_qp];
69  }
70 }
registerMooseObject("PorousFlowApp", PorousFlowTotalGravitationalDensityFullySaturatedFromPorosity)
const unsigned int _num_phases
Number of phases.
void addRequiredRangeCheckedParam(const std::string &name, const std::string &parsed_function, const std::string &doc_string)
void mooseError(Args &&... args)
const MaterialProperty< std::vector< std::vector< Real > > > & _drho_f_qp_dvar
d(rho_f)/d(PorousFlow variable)
virtual void resize(const std::size_t size) override final
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...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static const std::string v
Definition: NS.h:82
MaterialProperty< std::vector< Real > > & _dgravdensity_dvar
d(density)/d(PorousFlow variable)
void addClassDescription(const std::string &doc_string)
MaterialProperty< Real > & _gravdensity
Computed density at quadpoints.