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 142 : PoroMechanicsCoupling::validParams() 21 : { 22 142 : InputParameters params = Kernel::validParams(); 23 142 : params.addClassDescription( 24 : "Adds $-Bi \\cdot p_s \\cdot \\nabla \\Psi_c$, where the subscript $c$ is the component."); 25 284 : params.addRequiredCoupledVar("porepressure", "Pore pressure, $p_s$."); 26 284 : params.addRequiredParam<unsigned int>("component", 27 : "The gradient direction (0 for x, 1 for y and 2 for z)"); 28 142 : return params; 29 0 : } 30 : 31 78 : PoroMechanicsCoupling::PoroMechanicsCoupling(const InputParameters & parameters) 32 : : Kernel(parameters), 33 78 : _coefficient(getMaterialProperty<Real>("biot_coefficient")), 34 78 : _porepressure(coupledValue("porepressure")), 35 78 : _porepressure_var_num(coupled("porepressure")), 36 234 : _component(getParam<unsigned int>("component")) 37 : { 38 78 : if (_component >= _mesh.dimension()) 39 0 : mooseError("PoroMechanicsCoupling: component should not be greater than the mesh dimension\n"); 40 78 : } 41 : 42 : Real 43 94464 : PoroMechanicsCoupling::computeQpResidual() 44 : { 45 94464 : return -_coefficient[_qp] * _porepressure[_qp] * _grad_test[_i][_qp](_component); 46 : } 47 : 48 : Real 49 168960 : PoroMechanicsCoupling::computeQpJacobian() 50 : { 51 168960 : 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 506880 : PoroMechanicsCoupling::computeQpOffDiagJacobian(unsigned int jvar) 58 : { 59 506880 : if (jvar != _porepressure_var_num) 60 : return 0.0; 61 164864 : return -_coefficient[_qp] * _phi[_j][_qp] * _grad_test[_i][_qp](_component); 62 : }