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 2635 : PorousFlowEffectiveStressCoupling::validParams() 20 : { 21 2635 : InputParameters params = Kernel::validParams(); 22 2635 : params.addClassDescription("Implements the weak form of the expression biot_coefficient * " 23 : "grad(effective fluid pressure)"); 24 5270 : params.addRequiredParam<UserObjectName>( 25 : "PorousFlowDictator", "The UserObject that holds the list of PorousFlow variable names."); 26 5270 : params.addRangeCheckedParam<Real>( 27 : "biot_coefficient", 1, "biot_coefficient>=0&biot_coefficient<=1", "Biot coefficient"); 28 5270 : params.addRequiredParam<unsigned int>("component", 29 : "The component (0 for x, 1 for y and 2 for z) of grad(P)"); 30 2635 : return params; 31 0 : } 32 : 33 1389 : PorousFlowEffectiveStressCoupling::PorousFlowEffectiveStressCoupling( 34 1389 : const InputParameters & parameters) 35 : : Kernel(parameters), 36 1389 : _dictator(getUserObject<PorousFlowDictator>("PorousFlowDictator")), 37 2778 : _coefficient(getParam<Real>("biot_coefficient")), 38 2778 : _component(getParam<unsigned int>("component")), 39 2778 : _pf(getMaterialProperty<Real>("PorousFlow_effective_fluid_pressure_qp")), 40 1389 : _dpf_dvar( 41 1389 : getMaterialProperty<std::vector<Real>>("dPorousFlow_effective_fluid_pressure_qp_dvar")), 42 2778 : _rz(getBlockCoordSystem() == Moose::COORD_RZ) 43 : { 44 1389 : if (_component >= _mesh.dimension()) 45 0 : paramError("component", "The component cannot be greater than the mesh dimension"); 46 1389 : } 47 : 48 : Real 49 79539328 : PorousFlowEffectiveStressCoupling::computeQpResidual() 50 : { 51 79539328 : if (_rz && _component == 0) 52 36752 : return -_coefficient * _pf[_qp] * (_grad_test[_i][_qp](0) + _test[_i][_qp] / _q_point[_qp](0)); 53 79502576 : return -_coefficient * _pf[_qp] * _grad_test[_i][_qp](_component); 54 : } 55 : 56 : Real 57 268597504 : PorousFlowEffectiveStressCoupling::computeQpJacobian() 58 : { 59 268597504 : if (_dictator.notPorousFlowVariable(_var.number())) 60 : return 0.0; 61 253623040 : const unsigned int pvar = _dictator.porousFlowVariableNum(_var.number()); 62 253623040 : if (_rz && _component == 0) 63 106176 : return -_coefficient * _phi[_j][_qp] * _dpf_dvar[_qp][pvar] * 64 106176 : (_grad_test[_i][_qp](0) + _test[_i][_qp] / _q_point[_qp](0)); 65 253516864 : return -_coefficient * _phi[_j][_qp] * _dpf_dvar[_qp][pvar] * _grad_test[_i][_qp](_component); 66 : } 67 : 68 : Real 69 883509248 : PorousFlowEffectiveStressCoupling::computeQpOffDiagJacobian(unsigned int jvar) 70 : { 71 883509248 : if (_dictator.notPorousFlowVariable(jvar)) 72 : return 0.0; 73 853560320 : const unsigned int pvar = _dictator.porousFlowVariableNum(jvar); 74 853560320 : if (_rz && _component == 0) 75 305600 : return -_coefficient * _phi[_j][_qp] * _dpf_dvar[_qp][pvar] * 76 305600 : (_grad_test[_i][_qp](0) + _test[_i][_qp] / _q_point[_qp](0)); 77 853254720 : return -_coefficient * _phi[_j][_qp] * _dpf_dvar[_qp][pvar] * _grad_test[_i][_qp](_component); 78 : }