LCOV - code coverage report
Current view: top level - src/kernels - PorousFlowDesorpedMassTimeDerivative.C (source / functions) Hit Total Coverage
Test: porous_flow Test Coverage Lines: 36 37 97.3 %
Date: 2017-11-20 10:17:24 Functions: 8 8 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 "PorousFlowDesorpedMassTimeDerivative.h"
       9             : 
      10             : // MOOSE includes
      11             : #include "MooseVariable.h"
      12             : 
      13             : #include "libmesh/quadrature.h"
      14             : 
      15             : template <>
      16             : InputParameters
      17           5 : validParams<PorousFlowDesorpedMassTimeDerivative>()
      18             : {
      19           5 :   InputParameters params = validParams<TimeKernel>();
      20          15 :   params.addRequiredParam<UserObjectName>(
      21           5 :       "PorousFlowDictator", "The UserObject that holds the list of Porous-Flow variable names.");
      22          15 :   params.addRequiredCoupledVar(
      23           5 :       "conc_var", "The variable that represents the concentration of desorped species");
      24          10 :   params.addClassDescription("Desorped component mass derivative wrt time.");
      25           5 :   return params;
      26             : }
      27             : 
      28           5 : PorousFlowDesorpedMassTimeDerivative::PorousFlowDesorpedMassTimeDerivative(
      29           5 :     const InputParameters & parameters)
      30             :   : TimeKernel(parameters),
      31          10 :     _dictator(getUserObject<PorousFlowDictator>("PorousFlowDictator")),
      32          10 :     _conc_var_number(coupled("conc_var")),
      33          10 :     _conc(coupledValue("conc_var")),
      34          10 :     _conc_old(coupledValueOld("conc_var")),
      35          10 :     _porosity(getMaterialProperty<Real>("PorousFlow_porosity_qp")),
      36          10 :     _porosity_old(getMaterialPropertyOld<Real>("PorousFlow_porosity_qp")),
      37          10 :     _dporosity_dvar(getMaterialProperty<std::vector<Real>>("dPorousFlow_porosity_qp_dvar")),
      38             :     _dporosity_dgradvar(
      39          50 :         getMaterialProperty<std::vector<RealGradient>>("dPorousFlow_porosity_qp_dgradvar"))
      40             : {
      41           5 : }
      42             : 
      43             : Real
      44        1712 : PorousFlowDesorpedMassTimeDerivative::computeQpResidual()
      45             : {
      46        5136 :   Real c = (1.0 - _porosity[_qp]) * _conc[_qp];
      47        5136 :   Real c_old = (1.0 - _porosity_old[_qp]) * _conc_old[_qp];
      48        3424 :   return _test[_i][_qp] * (c - c_old) / _dt;
      49             : }
      50             : 
      51             : Real
      52        4184 : PorousFlowDesorpedMassTimeDerivative::computeQpJacobian()
      53             : {
      54        4184 :   return computeQpJac(_var.number());
      55             : }
      56             : 
      57             : Real
      58        1792 : PorousFlowDesorpedMassTimeDerivative::computeQpOffDiagJacobian(unsigned int jvar)
      59             : {
      60        1792 :   return computeQpJac(jvar);
      61             : }
      62             : 
      63             : Real
      64        5976 : PorousFlowDesorpedMassTimeDerivative::computeQpJac(unsigned int jvar) const
      65             : {
      66             :   Real deriv = 0.0;
      67             : 
      68        5976 :   if (jvar == _conc_var_number)
      69        1800 :     deriv = (1.0 - _porosity[_qp]) * _phi[_j][_qp];
      70             : 
      71        5976 :   if (_dictator.notPorousFlowVariable(jvar))
      72           0 :     return _test[_i][_qp] * deriv / _dt;
      73        5976 :   const unsigned int pvar = _dictator.porousFlowVariableNum(jvar);
      74             : 
      75       23904 :   deriv -= _dporosity_dgradvar[_qp][pvar] * _grad_phi[_j][_qp] * _conc[_qp];
      76       17928 :   deriv -= _dporosity_dvar[_qp][pvar] * _phi[_j][_qp] * _conc[_qp];
      77             : 
      78       11952 :   return _test[_i][_qp] * deriv / _dt;
      79        2499 : }

Generated by: LCOV version 1.11