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 "PoroMechanicsCoupling.h" 11 : 12 : // MOOSE includes 13 : #include "Function.h" 14 : #include "MooseMesh.h" 15 : #include "MooseVariable.h" 16 : 17 : registerMooseObject("SolidMechanicsApp", PoroMechanicsCoupling); 18 : 19 : InputParameters 20 132 : PoroMechanicsCoupling::validParams() 21 : { 22 132 : InputParameters params = Kernel::validParams(); 23 132 : params.addClassDescription( 24 : "Adds $-Bi \\cdot p_s \\cdot \\nabla \\Psi_c$, where the subscript $c$ is the component."); 25 264 : params.addRequiredCoupledVar("porepressure", "Pore pressure, $p_s$."); 26 264 : params.addRequiredParam<unsigned int>("component", 27 : "The gradient direction (0 for x, 1 for y and 2 for z)"); 28 132 : return params; 29 0 : } 30 : 31 72 : PoroMechanicsCoupling::PoroMechanicsCoupling(const InputParameters & parameters) 32 : : Kernel(parameters), 33 72 : _coefficient(getMaterialProperty<Real>("biot_coefficient")), 34 72 : _porepressure(coupledValue("porepressure")), 35 72 : _porepressure_var_num(coupled("porepressure")), 36 216 : _component(getParam<unsigned int>("component")) 37 : { 38 72 : if (_component >= _mesh.dimension()) 39 0 : mooseError("PoroMechanicsCoupling: component should not be greater than the mesh dimension\n"); 40 72 : } 41 : 42 : Real 43 86016 : PoroMechanicsCoupling::computeQpResidual() 44 : { 45 86016 : return -_coefficient[_qp] * _porepressure[_qp] * _grad_test[_i][_qp](_component); 46 : } 47 : 48 : Real 49 135168 : PoroMechanicsCoupling::computeQpJacobian() 50 : { 51 135168 : if (_var.number() != _porepressure_var_num) 52 : return 0.0; 53 4096 : return -_coefficient[_qp] * _phi[_j][_qp] * _grad_test[_i][_qp](_component); 54 : } 55 : 56 : Real 57 405504 : PoroMechanicsCoupling::computeQpOffDiagJacobian(unsigned int jvar) 58 : { 59 405504 : if (jvar != _porepressure_var_num) 60 : return 0.0; 61 131072 : return -_coefficient[_qp] * _phi[_j][_qp] * _grad_test[_i][_qp](_component); 62 : }