LCOV - code coverage report
Current view: top level - src/materials - PorousFlow1PhaseP.C (source / functions) Hit Total Coverage
Test: porous_flow Test Coverage Lines: 52 54 96.3 %
Date: 2017-11-21 14:47:27 Functions: 10 10 100.0 %
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 "PorousFlow1PhaseP.h"
       9             : #include "PorousFlowCapillaryPressure.h"
      10             : 
      11             : template <>
      12             : InputParameters
      13         193 : validParams<PorousFlow1PhaseP>()
      14             : {
      15         193 :   InputParameters params = validParams<PorousFlowVariableBase>();
      16         579 :   params.addRequiredCoupledVar("porepressure",
      17         193 :                                "Variable that represents the porepressure of the single phase");
      18         579 :   params.addParam<UserObjectName>("capillary_pressure",
      19         193 :                                   "Name of the UserObject defining the capillary pressure");
      20         386 :   params.addClassDescription("This Material is used for the fully saturated single-phase situation "
      21         193 :                              "where porepressure is the primary variable");
      22         193 :   return params;
      23             : }
      24             : 
      25         579 : PorousFlow1PhaseP::PorousFlow1PhaseP(const InputParameters & parameters)
      26             :   : PorousFlowVariableBase(parameters),
      27             : 
      28        1737 :     _porepressure_var(_nodal_material ? coupledNodalValue("porepressure")
      29        1077 :                                       : coupledValue("porepressure")),
      30        1158 :     _gradp_qp_var(coupledGradient("porepressure")),
      31        1158 :     _porepressure_varnum(coupled("porepressure")),
      32         579 :     _p_var_num(_dictator.isPorousFlowVariable(_porepressure_varnum)
      33         579 :                    ? _dictator.porousFlowVariableNum(_porepressure_varnum)
      34             :                    : 0),
      35        1158 :     _pc_uo(parameters.isParamSetByUser("capillary_pressure")
      36        1737 :                ? &getUserObject<PorousFlowCapillaryPressure>("capillary_pressure")
      37        3474 :                : nullptr)
      38             : {
      39         579 :   if (_num_phases != 1)
      40             :     mooseError("The Dictator proclaims that the number of phases is ",
      41           0 :                _dictator.numPhases(),
      42             :                " whereas PorousFlow1PhaseP can only be used for 1-phase simulations.  Be aware "
      43           0 :                "that the Dictator has noted your mistake.");
      44         579 : }
      45             : 
      46             : void
      47      120684 : PorousFlow1PhaseP::initQpStatefulProperties()
      48             : {
      49      120684 :   PorousFlowVariableBase::initQpStatefulProperties();
      50      120684 :   buildQpPPSS();
      51      120684 : }
      52             : 
      53             : void
      54     6301454 : PorousFlow1PhaseP::computeQpProperties()
      55             : {
      56             :   // size stuff correctly and prepare the derivative matrices with zeroes
      57     6301454 :   PorousFlowVariableBase::computeQpProperties();
      58             : 
      59     6301454 :   buildQpPPSS();
      60    12602908 :   const Real dseff = dEffectiveSaturation_dP(_porepressure_var[_qp]);
      61             : 
      62     6301454 :   if (!_nodal_material)
      63             :   {
      64     8952582 :     (*_gradp_qp)[_qp][0] = _gradp_qp_var[_qp];
      65     5968388 :     (*_grads_qp)[_qp][0] = dseff * _gradp_qp_var[_qp];
      66             :   }
      67             : 
      68             :   // _porepressure is only dependent on _porepressure, and its derivative is 1
      69     6301454 :   if (_dictator.isPorousFlowVariable(_porepressure_varnum))
      70             :   {
      71             :     // _porepressure is a PorousFlow variable
      72    12602908 :     _dporepressure_dvar[_qp][0][_p_var_num] = 1.0;
      73    12602908 :     _dsaturation_dvar[_qp][0][_p_var_num] = dseff;
      74     6301454 :     if (!_nodal_material)
      75             :     {
      76     5968388 :       (*_dgradp_qp_dgradv)[_qp][0][_p_var_num] = 1.0;
      77     5968388 :       (*_dgrads_qp_dgradv)[_qp][0][_p_var_num] = dseff;
      78     5968388 :       (*_dgrads_qp_dv)[_qp][0][_p_var_num] =
      79     8952582 :           d2EffectiveSaturation_dP2(_porepressure_var[_qp]) * _gradp_qp_var[_qp];
      80             :     }
      81             :   }
      82     6301454 : }
      83             : 
      84             : void
      85     6422138 : PorousFlow1PhaseP::buildQpPPSS()
      86             : {
      87    19266414 :   _porepressure[_qp][0] = _porepressure_var[_qp];
      88    12844276 :   _saturation[_qp][0] = effectiveSaturation(_porepressure_var[_qp]);
      89     6422138 : }
      90             : 
      91             : Real
      92     6422138 : PorousFlow1PhaseP::effectiveSaturation(Real pc) const
      93             : {
      94     6422138 :   return _pc_uo->effectiveSaturation(pc);
      95             : }
      96             : 
      97             : Real
      98     6301454 : PorousFlow1PhaseP::dEffectiveSaturation_dP(Real pc) const
      99             : {
     100     6301454 :   return _pc_uo->dEffectiveSaturation(pc);
     101             : }
     102             : 
     103             : Real
     104     2984194 : PorousFlow1PhaseP::d2EffectiveSaturation_dP2(Real pc) const
     105             : {
     106     2984194 :   return _pc_uo->d2EffectiveSaturation(pc);
     107        2499 : }

Generated by: LCOV version 1.11