LCOV - code coverage report
Current view: top level - src/materials - PorousFlowPorosityTHM.C (source / functions) Hit Total Coverage
Test: porous_flow Test Coverage Lines: 59 59 100.0 %
Date: 2017-11-21 09:41:48 Functions: 9 9 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 "PorousFlowPorosityTHM.h"
       9             : 
      10             : template <>
      11             : InputParameters
      12          12 : validParams<PorousFlowPorosityTHM>()
      13             : {
      14          12 :   InputParameters params = validParams<PorousFlowPorosityExponentialBase>();
      15          36 :   params.addRequiredCoupledVar("porosity_zero",
      16             :                                "The porosity at zero volumetric strain and "
      17             :                                "reference temperature and reference effective "
      18          12 :                                "porepressure");
      19          36 :   params.addRequiredParam<Real>(
      20             :       "thermal_expansion_coeff",
      21          12 :       "Thermal expansion coefficient of the drained porous solid skeleton");
      22          48 :   params.addRangeCheckedParam<Real>(
      23          12 :       "biot_coefficient", 1, "biot_coefficient>=0 & biot_coefficient<=1", "Biot coefficient");
      24          48 :   params.addRequiredRangeCheckedParam<Real>(
      25          12 :       "solid_bulk", "solid_bulk>0", "Bulk modulus of the drained porous solid skeleton");
      26          36 :   params.addRequiredCoupledVar("displacements", "The solid-mechanics displacement variables");
      27          36 :   params.addCoupledVar("reference_temperature",
      28             :                        0.0,
      29          12 :                        "porosity = porosity_zero at reference temperature and pressure");
      30          36 :   params.addCoupledVar("reference_porepressure",
      31             :                        0.0,
      32          12 :                        "porosity = porosity_zero at reference temperature and pressure");
      33          24 :   params.addClassDescription(
      34          12 :       "This Material calculates the porosity for hydro-mechanical simulations");
      35          12 :   return params;
      36             : }
      37             : 
      38          36 : PorousFlowPorosityTHM::PorousFlowPorosityTHM(const InputParameters & parameters)
      39             :   : PorousFlowPorosityExponentialBase(parameters),
      40             : 
      41         108 :     _phi0(_nodal_material ? coupledNodalValue("porosity_zero") : coupledValue("porosity_zero")),
      42         108 :     _biot(getParam<Real>("biot_coefficient")),
      43         108 :     _exp_coeff(getParam<Real>("thermal_expansion_coeff")),
      44         108 :     _solid_bulk(getParam<Real>("solid_bulk")),
      45          36 :     _coeff((_biot - 1.0) / _solid_bulk),
      46             : 
      47         108 :     _t_reference(_nodal_material ? coupledNodalValue("reference_temperature")
      48          66 :                                  : coupledValue("reference_temperature")),
      49         108 :     _p_reference(_nodal_material ? coupledNodalValue("reference_porepressure")
      50          66 :                                  : coupledValue("reference_porepressure")),
      51             : 
      52          72 :     _ndisp(coupledComponents("displacements")),
      53          36 :     _disp_var_num(_ndisp),
      54             : 
      55          72 :     _vol_strain_qp(getMaterialProperty<Real>("PorousFlow_total_volumetric_strain_qp")),
      56             :     _dvol_strain_qp_dvar(getMaterialProperty<std::vector<RealGradient>>(
      57          72 :         "dPorousFlow_total_volumetric_strain_qp_dvar")),
      58             : 
      59         108 :     _pf(_nodal_material ? getMaterialProperty<Real>("PorousFlow_effective_fluid_pressure_nodal")
      60          66 :                         : getMaterialProperty<Real>("PorousFlow_effective_fluid_pressure_qp")),
      61          72 :     _dpf_dvar(_nodal_material ? getMaterialProperty<std::vector<Real>>(
      62          78 :                                     "dPorousFlow_effective_fluid_pressure_nodal_dvar")
      63             :                               : getMaterialProperty<std::vector<Real>>(
      64          66 :                                     "dPorousFlow_effective_fluid_pressure_qp_dvar")),
      65             : 
      66         108 :     _temperature(_nodal_material ? getMaterialProperty<Real>("PorousFlow_temperature_nodal")
      67          66 :                                  : getMaterialProperty<Real>("PorousFlow_temperature_qp")),
      68             :     _dtemperature_dvar(
      69          36 :         _nodal_material
      70         108 :             ? getMaterialProperty<std::vector<Real>>("dPorousFlow_temperature_nodal_dvar")
      71         606 :             : getMaterialProperty<std::vector<Real>>("dPorousFlow_temperature_qp_dvar"))
      72             : {
      73         252 :   for (unsigned int i = 0; i < _ndisp; ++i)
      74         324 :     _disp_var_num[i] = coupled("displacements", i);
      75          36 : }
      76             : 
      77             : Real
      78       12800 : PorousFlowPorosityTHM::atNegInfinityQp() const
      79             : {
      80       12800 :   return _biot;
      81             : }
      82             : 
      83             : Real
      84       12800 : PorousFlowPorosityTHM::atZeroQp() const
      85             : {
      86       25600 :   return _phi0[_qp];
      87             : }
      88             : 
      89             : Real
      90       12800 : PorousFlowPorosityTHM::decayQp() const
      91             : {
      92             :   // Note that in the following _strain[_qp] is evaluated at q quadpoint
      93             :   // So _porosity_nodal[_qp], which should be the nodal value of porosity
      94             :   // actually uses the strain at a quadpoint.  This
      95             :   // is OK for LINEAR elements, as strain is constant over the element anyway.
      96             :   const unsigned qp_to_use =
      97       12800 :       (_nodal_material && (_bnd || _strain_at_nearest_qp) ? nearestQP(_qp) : _qp);
      98             : 
      99       51200 :   return -_vol_strain_qp[qp_to_use] + _coeff * (_pf[_qp] - _p_reference[_qp]) +
     100       38400 :          _exp_coeff * (_temperature[_qp] - _t_reference[_qp]);
     101             : }
     102             : 
     103             : Real
     104       70016 : PorousFlowPorosityTHM::ddecayQp_dvar(unsigned pvar) const
     105             : {
     106      210048 :   return _coeff * _dpf_dvar[_qp][pvar] + _exp_coeff * _dtemperature_dvar[_qp][pvar];
     107             : }
     108             : 
     109             : RealGradient
     110       70016 : PorousFlowPorosityTHM::ddecayQp_dgradvar(unsigned pvar) const
     111             : {
     112             :   const unsigned qp_to_use =
     113       70016 :       (_nodal_material && (_bnd || _strain_at_nearest_qp) ? nearestQP(_qp) : _qp);
     114      140032 :   return -_dvol_strain_qp_dvar[qp_to_use][pvar];
     115        2499 : }

Generated by: LCOV version 1.11