LCOV - code coverage report
Current view: top level - src/kernels - PoroMechanicsCoupling.C (source / functions) Hit Total Coverage
Test: idaholab/moose tensor_mechanics: d6b47a Lines: 21 23 91.3 %
Date: 2024-02-27 11:53:14 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://www.mooseframework.org
       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 "PoroMechanicsCoupling.h"
      11             : 
      12             : // MOOSE includes
      13             : #include "Function.h"
      14             : #include "MooseMesh.h"
      15             : #include "MooseVariable.h"
      16             : 
      17             : registerMooseObject("TensorMechanicsApp", PoroMechanicsCoupling);
      18             : 
      19             : InputParameters
      20          66 : PoroMechanicsCoupling::validParams()
      21             : {
      22          66 :   InputParameters params = Kernel::validParams();
      23          66 :   params.addClassDescription(
      24             :       "Adds $-Bi \\cdot p_s \\cdot \\nabla \\Psi_c$, where the subscript $c$ is the component.");
      25         132 :   params.addRequiredCoupledVar("porepressure", "Pore pressure, $p_s$.");
      26         132 :   params.addRequiredParam<unsigned int>("component",
      27             :                                         "The gradient direction (0 for x, 1 for y and 2 for z)");
      28          66 :   return params;
      29           0 : }
      30             : 
      31          36 : PoroMechanicsCoupling::PoroMechanicsCoupling(const InputParameters & parameters)
      32             :   : Kernel(parameters),
      33          36 :     _coefficient(getMaterialProperty<Real>("biot_coefficient")),
      34          36 :     _porepressure(coupledValue("porepressure")),
      35          36 :     _porepressure_var_num(coupled("porepressure")),
      36         108 :     _component(getParam<unsigned int>("component"))
      37             : {
      38          36 :   if (_component >= _mesh.dimension())
      39           0 :     mooseError("PoroMechanicsCoupling: component should not be greater than the mesh dimension\n");
      40          36 : }
      41             : 
      42             : Real
      43       51456 : PoroMechanicsCoupling::computeQpResidual()
      44             : {
      45       51456 :   return -_coefficient[_qp] * _porepressure[_qp] * _grad_test[_i][_qp](_component);
      46             : }
      47             : 
      48             : Real
      49       67584 : PoroMechanicsCoupling::computeQpJacobian()
      50             : {
      51       67584 :   if (_var.number() != _porepressure_var_num)
      52             :     return 0.0;
      53        2048 :   return -_coefficient[_qp] * _phi[_j][_qp] * _grad_test[_i][_qp](_component);
      54             : }
      55             : 
      56             : Real
      57      202752 : PoroMechanicsCoupling::computeQpOffDiagJacobian(unsigned int jvar)
      58             : {
      59      202752 :   if (jvar != _porepressure_var_num)
      60             :     return 0.0;
      61       65536 :   return -_coefficient[_qp] * _phi[_j][_qp] * _grad_test[_i][_qp](_component);
      62             : }

Generated by: LCOV version 1.14