LCOV - code coverage report
Current view: top level - src/kernels - PorousFlowPlasticHeatEnergy.C (source / functions) Hit Total Coverage
Test: porous_flow Test Coverage Lines: 33 33 100.0 %
Date: 2017-11-20 14:50:56 Functions: 7 7 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 "PorousFlowPlasticHeatEnergy.h"
       9             : 
      10             : // MOOSE includes
      11             : #include "MooseMesh.h"
      12             : #include "MooseVariable.h"
      13             : 
      14             : template <>
      15             : InputParameters
      16           7 : validParams<PorousFlowPlasticHeatEnergy>()
      17             : {
      18           7 :   InputParameters params = validParams<PlasticHeatEnergy>();
      19          21 :   params.addParam<bool>("strain_at_nearest_qp",
      20             :                         false,
      21             :                         "When calculating nodal porosity that depends on strain, use the strain at "
      22             :                         "the nearest quadpoint.  This adds a small extra computational burden, and "
      23             :                         "is not necessary for simulations involving only linear lagrange elements. "
      24             :                         " If you set this to true, you will also want to set the same parameter to "
      25           7 :                         "true for related Kernels and Materials");
      26          21 :   params.addRequiredParam<UserObjectName>(
      27           7 :       "PorousFlowDictator", "The UserObject that holds the list of Porous-Flow variable names.");
      28          14 :   params.addClassDescription(
      29           7 :       "Plastic heat energy density source = (1 - porosity) * coeff * stress * plastic_strain_rate");
      30           7 :   return params;
      31             : }
      32             : 
      33           7 : PorousFlowPlasticHeatEnergy::PorousFlowPlasticHeatEnergy(const InputParameters & parameters)
      34             :   : PlasticHeatEnergy(parameters),
      35          14 :     _dictator(getUserObject<PorousFlowDictator>("PorousFlowDictator")),
      36          21 :     _strain_at_nearest_qp(getParam<bool>("strain_at_nearest_qp")),
      37           7 :     _nearest_qp(_strain_at_nearest_qp
      38          14 :                     ? &getMaterialProperty<unsigned int>("PorousFlow_nearestqp_nodal")
      39             :                     : nullptr),
      40          14 :     _porosity(getMaterialProperty<Real>("PorousFlow_porosity_nodal")),
      41          14 :     _dporosity_dvar(getMaterialProperty<std::vector<Real>>("dPorousFlow_porosity_nodal_dvar")),
      42             :     _dporosity_dgradvar(
      43          56 :         getMaterialProperty<std::vector<RealGradient>>("dPorousFlow_porosity_nodal_dgradvar"))
      44             : {
      45           7 : }
      46             : 
      47             : Real
      48       31744 : PorousFlowPlasticHeatEnergy::computeQpResidual()
      49             : {
      50       63488 :   return (1.0 - _porosity[_i]) * PlasticHeatEnergy::computeQpResidual();
      51             : }
      52             : 
      53             : Real
      54       18432 : PorousFlowPlasticHeatEnergy::computeQpJacobian()
      55             : {
      56       18432 :   return computeQpOffDiagJacobian(_var.number());
      57             : }
      58             : 
      59             : Real
      60       36864 : PorousFlowPlasticHeatEnergy::computeQpOffDiagJacobian(unsigned int jvar)
      61             : {
      62             :   /// If the variable is not a PorousFlow variable, the Jacobian terms are 0
      63       36864 :   if (_dictator.notPorousFlowVariable(jvar))
      64             :     return 0.0;
      65             : 
      66       36864 :   const Real res_no_porosity = PlasticHeatEnergy::computeQpResidual();
      67       36864 :   const Real jac_no_porosity = PlasticHeatEnergy::computeQpOffDiagJacobian(jvar);
      68             : 
      69       36864 :   const unsigned pvar = _dictator.porousFlowVariableNum(jvar);
      70       36864 :   const unsigned nearest_qp = (_strain_at_nearest_qp ? (*_nearest_qp)[_i] : _i);
      71             : 
      72       73728 :   Real jac = (1.0 - _porosity[_i]) * jac_no_porosity -
      73      110592 :              _dporosity_dgradvar[_i][pvar] * _grad_phi[_j][nearest_qp] * res_no_porosity;
      74       36864 :   if (_i != _j)
      75             :     return jac;
      76             : 
      77        9216 :   return jac - _dporosity_dvar[_i][pvar] * res_no_porosity;
      78        2499 : }

Generated by: LCOV version 1.11