LCOV - code coverage report
Current view: top level - src/materials - PorousFlowPorosityHMBiotModulus.C (source / functions) Hit Total Coverage
Test: porous_flow Test Coverage Lines: 41 41 100.0 %
Date: 2017-11-21 14:47:27 Functions: 5 5 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 "PorousFlowPorosityHMBiotModulus.h"
       9             : #include "libmesh/utility.h"
      10             : 
      11             : template <>
      12             : InputParameters
      13           3 : validParams<PorousFlowPorosityHMBiotModulus>()
      14             : {
      15           3 :   InputParameters params = validParams<PorousFlowPorosityHM>();
      16          12 :   params.addRequiredRangeCheckedParam<Real>("constant_biot_modulus",
      17             :                                             "constant_biot_modulus>0",
      18           3 :                                             "Biot modulus, which is constant for this Material");
      19          12 :   params.addRequiredRangeCheckedParam<Real>(
      20             :       "constant_fluid_bulk_modulus",
      21             :       "constant_fluid_bulk_modulus>0",
      22           3 :       "Fluid bulk modulus, which is constant for this Material");
      23           6 :   params.addClassDescription(
      24             :       "This Material calculates the porosity for hydro-mechanical simulations, assuming that the "
      25             :       "Biot modulus and the fluid bulk modulus are both constant.  This is useful for comparing "
      26           3 :       "with solutions from poroelasticity theory, but is less accurate than PorousFlowPorosityHM");
      27           3 :   return params;
      28             : }
      29             : 
      30           9 : PorousFlowPorosityHMBiotModulus::PorousFlowPorosityHMBiotModulus(const InputParameters & parameters)
      31             :   : PorousFlowPorosityHM(parameters),
      32          27 :     _porosity_old(_nodal_material ? getMaterialPropertyOld<Real>("PorousFlow_porosity_nodal")
      33           9 :                                   : getMaterialPropertyOld<Real>("PorousFlow_porosity_qp")),
      34          27 :     _biot_modulus(getParam<Real>("constant_biot_modulus")),
      35          27 :     _fluid_bulk_modulus(getParam<Real>("constant_fluid_bulk_modulus")),
      36           9 :     _pf_old(_nodal_material
      37          27 :                 ? getMaterialPropertyOld<Real>("PorousFlow_effective_fluid_pressure_nodal")
      38           9 :                 : getMaterialPropertyOld<Real>("PorousFlow_effective_fluid_pressure_qp")),
      39          18 :     _vol_strain_qp_old(getMaterialPropertyOld<Real>("PorousFlow_total_volumetric_strain_qp")),
      40          18 :     _vol_strain_rate_qp(getMaterialProperty<Real>("PorousFlow_volumetric_strain_rate_qp")),
      41             :     _dvol_strain_rate_qp_dvar(getMaterialProperty<std::vector<RealGradient>>(
      42          81 :         "dPorousFlow_volumetric_strain_rate_qp_dvar"))
      43             : {
      44           9 : }
      45             : 
      46             : void
      47      181440 : PorousFlowPorosityHMBiotModulus::computeQpProperties()
      48             : {
      49             :   // Note that in the following _strain[_qp] is evaluated at q quadpoint
      50             :   // So _porosity_nodal[_qp], which should be the nodal value of porosity
      51             :   // actually uses the strain at a quadpoint.  This
      52             :   // is OK for LINEAR elements, as strain is constant over the element anyway.
      53             : 
      54             :   const unsigned qp_to_use =
      55      181440 :       (_nodal_material && (_bnd || _strain_at_nearest_qp) ? nearestQP(_qp) : _qp);
      56             : 
      57      362880 :   const Real denom = 1.0 + _vol_strain_rate_qp[qp_to_use] * _dt;
      58      362880 :   _porosity[_qp] =
      59      907200 :       (_porosity_old[_qp] * std::exp(-(_pf[_qp] - _pf_old[_qp]) / _fluid_bulk_modulus) +
      60      725760 :        (_pf[_qp] - _pf_old[_qp]) / _biot_modulus +
      61      725760 :        _biot * (_vol_strain_qp[qp_to_use] - _vol_strain_qp_old[qp_to_use])) /
      62             :       denom;
      63             : 
      64      362880 :   _dporosity_dvar[_qp].resize(_num_var);
      65     1632960 :   for (unsigned int v = 0; v < _num_var; ++v)
      66     1451520 :     _dporosity_dvar[_qp][v] =
      67     2177280 :         _dpf_dvar[_qp][v] *
      68     3628800 :         (-_porosity_old[_qp] * std::exp(-(_pf[_qp] - _pf_old[_qp]) / _fluid_bulk_modulus) /
      69     1451520 :              _fluid_bulk_modulus +
      70     1451520 :          1.0 / _biot_modulus) /
      71             :         denom;
      72             : 
      73      362880 :   _dporosity_dgradvar[_qp].resize(_num_var);
      74     1632960 :   for (unsigned int v = 0; v < _num_var; ++v)
      75     1451520 :     _dporosity_dgradvar[_qp][v] =
      76     1451520 :         _biot * _dvol_strain_qp_dvar[qp_to_use][v] / denom -
      77     2177280 :         _porosity[_qp] / denom * _dvol_strain_rate_qp_dvar[qp_to_use][v] * _dt;
      78      183939 : }

Generated by: LCOV version 1.11