LCOV - code coverage report
Current view: top level - src/kernels - PorousFlowEffectiveStressCoupling.C (source / functions) Hit Total Coverage
Test: idaholab/moose porous_flow: #31405 (292dce) with base fef103 Lines: 36 38 94.7 %
Date: 2025-09-04 07:55:56 Functions: 5 5 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //* This file is part of the MOOSE framework
       2             : //* https://mooseframework.inl.gov
       3             : //*
       4             : //* All rights reserved, see COPYRIGHT for full restrictions
       5             : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
       6             : //*
       7             : //* Licensed under LGPL 2.1, please see LICENSE for details
       8             : //* https://www.gnu.org/licenses/lgpl-2.1.html
       9             : 
      10             : #include "PorousFlowEffectiveStressCoupling.h"
      11             : 
      12             : #include "Function.h"
      13             : #include "MooseMesh.h"
      14             : #include "MooseVariable.h"
      15             : 
      16             : registerMooseObject("PorousFlowApp", PorousFlowEffectiveStressCoupling);
      17             : 
      18             : InputParameters
      19        5549 : PorousFlowEffectiveStressCoupling::validParams()
      20             : {
      21        5549 :   InputParameters params = Kernel::validParams();
      22        5549 :   params.addClassDescription("Implements the weak form of the expression biot_coefficient * "
      23             :                              "grad(effective fluid pressure)");
      24       11098 :   params.addRequiredParam<UserObjectName>(
      25             :       "PorousFlowDictator", "The UserObject that holds the list of PorousFlow variable names.");
      26       11098 :   params.addRangeCheckedParam<Real>(
      27             :       "biot_coefficient", 1, "biot_coefficient>=0&biot_coefficient<=1", "Biot coefficient");
      28       11098 :   params.addRequiredParam<unsigned int>("component",
      29             :                                         "The component (0 for x, 1 for y and 2 for z) of grad(P)");
      30        5549 :   return params;
      31           0 : }
      32             : 
      33        2985 : PorousFlowEffectiveStressCoupling::PorousFlowEffectiveStressCoupling(
      34        2985 :     const InputParameters & parameters)
      35             :   : Kernel(parameters),
      36        2985 :     _dictator(getUserObject<PorousFlowDictator>("PorousFlowDictator")),
      37        5970 :     _coefficient(getParam<Real>("biot_coefficient")),
      38        5970 :     _component(getParam<unsigned int>("component")),
      39        5970 :     _pf(getMaterialProperty<Real>("PorousFlow_effective_fluid_pressure_qp")),
      40        2985 :     _dpf_dvar(
      41        2985 :         getMaterialProperty<std::vector<Real>>("dPorousFlow_effective_fluid_pressure_qp_dvar")),
      42        5970 :     _rz(getBlockCoordSystem() == Moose::COORD_RZ)
      43             : {
      44        2985 :   if (_component >= _mesh.dimension())
      45           0 :     paramError("component", "The component cannot be greater than the mesh dimension");
      46        2985 : }
      47             : 
      48             : Real
      49   118568992 : PorousFlowEffectiveStressCoupling::computeQpResidual()
      50             : {
      51   118568992 :   if (_rz && _component == 0)
      52       50048 :     return -_coefficient * _pf[_qp] * (_grad_test[_i][_qp](0) + _test[_i][_qp] / _q_point[_qp](0));
      53   118518944 :   return -_coefficient * _pf[_qp] * _grad_test[_i][_qp](_component);
      54             : }
      55             : 
      56             : Real
      57   403518336 : PorousFlowEffectiveStressCoupling::computeQpJacobian()
      58             : {
      59   403518336 :   if (_dictator.notPorousFlowVariable(_var.number()))
      60             :     return 0.0;
      61   381469056 :   const unsigned int pvar = _dictator.porousFlowVariableNum(_var.number());
      62   381469056 :   if (_rz && _component == 0)
      63      144320 :     return -_coefficient * _phi[_j][_qp] * _dpf_dvar[_qp][pvar] *
      64      144320 :            (_grad_test[_i][_qp](0) + _test[_i][_qp] / _q_point[_qp](0));
      65   381324736 :   return -_coefficient * _phi[_j][_qp] * _dpf_dvar[_qp][pvar] * _grad_test[_i][_qp](_component);
      66             : }
      67             : 
      68             : Real
      69  1327484032 : PorousFlowEffectiveStressCoupling::computeQpOffDiagJacobian(unsigned int jvar)
      70             : {
      71  1327484032 :   if (_dictator.notPorousFlowVariable(jvar))
      72             :     return 0.0;
      73  1283385472 :   const unsigned int pvar = _dictator.porousFlowVariableNum(jvar);
      74  1283385472 :   if (_rz && _component == 0)
      75      414016 :     return -_coefficient * _phi[_j][_qp] * _dpf_dvar[_qp][pvar] *
      76      414016 :            (_grad_test[_i][_qp](0) + _test[_i][_qp] / _q_point[_qp](0));
      77  1282971456 :   return -_coefficient * _phi[_j][_qp] * _dpf_dvar[_qp][pvar] * _grad_test[_i][_qp](_component);
      78             : }

Generated by: LCOV version 1.14