LCOV - code coverage report
Current view: top level - src/materials - PorousFlowTotalGravitationalDensityFullySaturatedFromPorosity.C (source / functions) Hit Total Coverage
Test: porous_flow Test Coverage Lines: 24 30 80.0 %
Date: 2017-11-18 13:30:36 Functions: 5 6 83.3 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : 
       8             : #include "PorousFlowTotalGravitationalDensityFullySaturatedFromPorosity.h"
       9             : 
      10             : template <>
      11             : InputParameters
      12           1 : validParams<PorousFlowTotalGravitationalDensityFullySaturatedFromPorosity>()
      13             : {
      14           1 :   InputParameters params = validParams<PorousFlowTotalGravitationalDensityBase>();
      15           4 :   params.addRequiredRangeCheckedParam<Real>(
      16           1 :       "rho_s", "rho_s >= 0", "The density of the solid matrix");
      17           2 :   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           1 :       "the densities of the fluid and solid phases.");
      23           1 :   return params;
      24             : }
      25             : 
      26           3 : PorousFlowTotalGravitationalDensityFullySaturatedFromPorosity::
      27             :     PorousFlowTotalGravitationalDensityFullySaturatedFromPorosity(
      28           3 :         const InputParameters & parameters)
      29             :   : PorousFlowTotalGravitationalDensityBase(parameters),
      30           9 :     _rho_s(getParam<Real>("rho_s")),
      31           6 :     _rho_f_qp(getMaterialProperty<std::vector<Real>>("PorousFlow_fluid_phase_density_qp")),
      32           6 :     _porosity_qp(getMaterialProperty<Real>("PorousFlow_porosity_qp")),
      33             :     _drho_f_qp_dvar(getMaterialProperty<std::vector<std::vector<Real>>>(
      34           6 :         "dPorousFlow_fluid_phase_density_qp_dvar")),
      35          21 :     _dporosity_qp_dvar(getMaterialProperty<std::vector<Real>>("dPorousFlow_porosity_qp_dvar"))
      36             : {
      37           3 :   if (_num_phases != 1)
      38             :     mooseError("The Dictator proclaims that the number of phases is ",
      39           0 :                _dictator.numPhases(),
      40             :                " whereas PorousFlowThermalConductivityFromPorosity can only be used for 1-phase "
      41           0 :                "simulations. Be aware that the Dictator has noted your mistake.");
      42           3 :   if (_nodal_material == true)
      43             :     mooseError("PorousFlowTotalGravitationalDensityFullySaturatedFromPorosity is only defined for "
      44           0 :                "at_nodes = false");
      45           3 : }
      46             : 
      47             : void
      48           0 : PorousFlowTotalGravitationalDensityFullySaturatedFromPorosity::initQpStatefulProperties()
      49             : {
      50             :   const unsigned ph = 0;
      51           0 :   _gravdensity[_qp] = _rho_s * (1.0 - _porosity_qp[_qp]) + _rho_f_qp[_qp][ph] * _porosity_qp[_qp];
      52           0 : }
      53             : 
      54             : void
      55          32 : PorousFlowTotalGravitationalDensityFullySaturatedFromPorosity::computeQpProperties()
      56             : {
      57             :   const unsigned ph = 0;
      58         128 :   _gravdensity[_qp] = _rho_s * (1.0 - _porosity_qp[_qp]) + _rho_f_qp[_qp][ph] * _porosity_qp[_qp];
      59             : 
      60          64 :   _dgravdensity_dvar[_qp].resize(_num_var);
      61          96 :   for (unsigned int v = 0; v < _num_var; ++v)
      62             :   {
      63         160 :     _dgravdensity_dvar[_qp][v] = _dporosity_qp_dvar[_qp][v] * (_rho_f_qp[_qp][ph] - _rho_s) +
      64          96 :                                  _drho_f_qp_dvar[_qp][ph][v] * _porosity_qp[_qp];
      65             :   }
      66        2531 : }

Generated by: LCOV version 1.11