LCOV - code coverage report
Current view: top level - src/materials - PorousFlowPermeabilityExponential.C (source / functions) Hit Total Coverage
Test: porous_flow Test Coverage Lines: 45 45 100.0 %
Date: 2017-11-21 09:41:48 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 "PorousFlowPermeabilityExponential.h"
       9             : 
      10             : template <>
      11             : InputParameters
      12           3 : validParams<PorousFlowPermeabilityExponential>()
      13             : {
      14           3 :   InputParameters params = validParams<PorousFlowPermeabilityBase>();
      15           9 :   MooseEnum poroperm_function("log_k ln_k exp_k", "exp_k");
      16           9 :   params.addParam<MooseEnum>("poroperm_function",
      17             :                              poroperm_function,
      18             :                              "Form of the function relating porosity and permeability. The options "
      19             :                              "are: log_k (log k = A phi + B); ln_k (ln k = A phi + B); exp_k (k = "
      20             :                              "B exp(A phi)); where k is permeability, phi is porosity, A and B are "
      21           3 :                              "empirical constants.");
      22           9 :   params.addParam<RealTensorValue>("k_anisotropy",
      23             :                                    "A tensor to multiply the calculated scalar "
      24             :                                    "permeability, in order to obtain anisotropy if "
      25             :                                    "required. Defaults to isotropic permeability "
      26           3 :                                    "if not specified.");
      27           9 :   params.addRequiredParam<Real>("A", "Empirical constant; see poroperm_function.");
      28           9 :   params.addRequiredParam<Real>("B", "Empirical constant; see poroperm_function.");
      29           6 :   params.addClassDescription(
      30             :       "This Material calculates the permeability tensor from an exponential function of porosity: "
      31             :       "k = k_ijk * BB exp(AA phi), where k_ijk is a tensor providing the anisotropy, phi is "
      32             :       "porosity, and AA and BB are empirical constants. The user can provide input for the "
      33           3 :       "function expressed in ln k, log k or exponential forms (see poroperm_function).");
      34           3 :   return params;
      35             : }
      36             : 
      37           9 : PorousFlowPermeabilityExponential::PorousFlowPermeabilityExponential(
      38           9 :     const InputParameters & parameters)
      39             :   : PorousFlowPermeabilityBase(parameters),
      40          27 :     _A(getParam<Real>("A")),
      41          27 :     _B(getParam<Real>("B")),
      42          18 :     _k_anisotropy(parameters.isParamValid("k_anisotropy")
      43          27 :                       ? getParam<RealTensorValue>("k_anisotropy")
      44             :                       : RealTensorValue(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0)),
      45          18 :     _porosity_qp(getMaterialProperty<Real>("PorousFlow_porosity_qp")),
      46          18 :     _dporosity_qp_dvar(getMaterialProperty<std::vector<Real>>("dPorousFlow_porosity_qp_dvar")),
      47             :     _dporosity_qp_dgradvar(
      48          18 :         getMaterialProperty<std::vector<RealGradient>>("dPorousFlow_porosity_qp_dgradvar")),
      49          99 :     _poroperm_function(getParam<MooseEnum>("poroperm_function").getEnum<PoropermFunction>())
      50             : {
      51           9 :   switch (_poroperm_function)
      52             :   {
      53             :     case PoropermFunction::log_k:
      54           3 :       _AA = _A * std::log(10.0);
      55           3 :       _BB = std::pow(10.0, _B);
      56           3 :       break;
      57             : 
      58             :     case PoropermFunction::ln_k:
      59           3 :       _AA = _A;
      60           3 :       _BB = std::exp(_B);
      61           3 :       break;
      62             : 
      63             :     case PoropermFunction::exp_k:
      64           3 :       _AA = _A;
      65           3 :       _BB = _B;
      66           3 :       break;
      67             :   }
      68           9 : }
      69             : 
      70             : void
      71         126 : PorousFlowPermeabilityExponential::computeQpProperties()
      72             : {
      73         504 :   _permeability_qp[_qp] = _k_anisotropy * _BB * std::exp(_porosity_qp[_qp] * _AA);
      74             : 
      75         252 :   _dpermeability_qp_dvar[_qp].resize(_num_var, RealTensorValue());
      76         378 :   for (unsigned int v = 0; v < _num_var; ++v)
      77         630 :     _dpermeability_qp_dvar[_qp][v] = _AA * _permeability_qp[_qp] * _dporosity_qp_dvar[_qp][v];
      78             : 
      79         252 :   _dpermeability_qp_dgradvar[_qp].resize(LIBMESH_DIM);
      80         882 :   for (unsigned i = 0; i < LIBMESH_DIM; ++i)
      81             :   {
      82         756 :     _dpermeability_qp_dgradvar[_qp][i].resize(_num_var, RealTensorValue());
      83        1134 :     for (unsigned int v = 0; v < _num_var; ++v)
      84         756 :       _dpermeability_qp_dgradvar[_qp][i][v] =
      85        1134 :           _AA * _permeability_qp[_qp] * _dporosity_qp_dgradvar[_qp][v](i);
      86             :   }
      87        2625 : }

Generated by: LCOV version 1.11