LCOV - code coverage report
Current view: top level - src/materials - PorousFlowPorosityTM.C (source / functions) Hit Total Coverage
Test: porous_flow Test Coverage Lines: 42 42 100.0 %
Date: 2017-11-21 14:47:27 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 "PorousFlowPorosityTM.h"
       9             : 
      10             : template <>
      11             : InputParameters
      12           3 : validParams<PorousFlowPorosityTM>()
      13             : {
      14           3 :   InputParameters params = validParams<PorousFlowPorosityExponentialBase>();
      15           9 :   params.addRequiredCoupledVar("porosity_zero",
      16           3 :                                "The porosity at zero volumetric strain and reference temperature");
      17           9 :   params.addRequiredParam<Real>(
      18             :       "thermal_expansion_coeff",
      19           3 :       "Thermal expansion coefficient of the drained porous solid skeleton");
      20           9 :   params.addRequiredCoupledVar("displacements", "The solid-mechanics displacement variables");
      21           9 :   params.addCoupledVar(
      22           3 :       "reference_temperature", 0.0, "porosity = porosity_zero at reference temperature");
      23           6 :   params.addClassDescription(
      24           3 :       "This Material calculates the porosity for hydro-mechanical simulations");
      25           3 :   return params;
      26             : }
      27             : 
      28           9 : PorousFlowPorosityTM::PorousFlowPorosityTM(const InputParameters & parameters)
      29             :   : PorousFlowPorosityExponentialBase(parameters),
      30             : 
      31          27 :     _phi0(_nodal_material ? coupledNodalValue("porosity_zero") : coupledValue("porosity_zero")),
      32          27 :     _exp_coeff(getParam<Real>("thermal_expansion_coeff")),
      33             : 
      34          27 :     _t_reference(_nodal_material ? coupledNodalValue("reference_temperature")
      35          15 :                                  : coupledValue("reference_temperature")),
      36             : 
      37          18 :     _ndisp(coupledComponents("displacements")),
      38           9 :     _disp_var_num(_ndisp),
      39             : 
      40          18 :     _vol_strain_qp(getMaterialProperty<Real>("PorousFlow_total_volumetric_strain_qp")),
      41             :     _dvol_strain_qp_dvar(getMaterialProperty<std::vector<RealGradient>>(
      42          18 :         "dPorousFlow_total_volumetric_strain_qp_dvar")),
      43             : 
      44          27 :     _temperature(_nodal_material ? getMaterialProperty<Real>("PorousFlow_temperature_nodal")
      45          15 :                                  : getMaterialProperty<Real>("PorousFlow_temperature_qp")),
      46             :     _dtemperature_dvar(
      47           9 :         _nodal_material
      48          27 :             ? getMaterialProperty<std::vector<Real>>("dPorousFlow_temperature_nodal_dvar")
      49          96 :             : getMaterialProperty<std::vector<Real>>("dPorousFlow_temperature_qp_dvar"))
      50             : {
      51          63 :   for (unsigned int i = 0; i < _ndisp; ++i)
      52          81 :     _disp_var_num[i] = coupled("displacements", i);
      53           9 : }
      54             : Real
      55        4560 : PorousFlowPorosityTM::atNegInfinityQp() const
      56             : {
      57        4560 :   return 1.0;
      58             : }
      59             : 
      60             : Real
      61        4560 : PorousFlowPorosityTM::atZeroQp() const
      62             : {
      63        9120 :   return _phi0[_qp];
      64             : }
      65             : 
      66             : Real
      67        4560 : PorousFlowPorosityTM::decayQp() const
      68             : {
      69             :   // Note that in the following _strain[_qp] is evaluated at q quadpoint
      70             :   // So _porosity_nodal[_qp], which should be the nodal value of porosity
      71             :   // actually uses the strain at a quadpoint.  This
      72             :   // is OK for LINEAR elements, as strain is constant over the element anyway.
      73             :   const unsigned qp_to_use =
      74        4560 :       (_nodal_material && (_bnd || _strain_at_nearest_qp) ? nearestQP(_qp) : _qp);
      75       18240 :   return -_vol_strain_qp[qp_to_use] + _exp_coeff * (_temperature[_qp] - _t_reference[_qp]);
      76             : }
      77             : 
      78             : Real
      79       25152 : PorousFlowPorosityTM::ddecayQp_dvar(unsigned pvar) const
      80             : {
      81       50304 :   return _exp_coeff * _dtemperature_dvar[_qp][pvar];
      82             : }
      83             : 
      84             : RealGradient
      85       25152 : PorousFlowPorosityTM::ddecayQp_dgradvar(unsigned pvar) const
      86             : {
      87             :   const unsigned qp_to_use =
      88       25152 :       (_nodal_material && (_bnd || _strain_at_nearest_qp) ? nearestQP(_qp) : _qp);
      89       50304 :   return -_dvol_strain_qp_dvar[qp_to_use][pvar];
      90        2499 : }

Generated by: LCOV version 1.11