www.mooseframework.org
PorousFlowEffectiveStressCoupling.C
Go to the documentation of this file.
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 
11 
12 #include "Function.h"
13 #include "MooseMesh.h"
14 #include "MooseVariable.h"
15 
17 
20 {
22  params.addClassDescription("Implements the weak form of the expression biot_coefficient * "
23  "grad(effective fluid pressure)");
24  params.addRequiredParam<UserObjectName>(
25  "PorousFlowDictator", "The UserObject that holds the list of PorousFlow variable names.");
26  params.addRangeCheckedParam<Real>(
27  "biot_coefficient", 1, "biot_coefficient>=0&biot_coefficient<=1", "Biot coefficient");
28  params.addRequiredParam<unsigned int>("component",
29  "The component (0 for x, 1 for y and 2 for z) of grad(P)");
30  return params;
31 }
32 
34  const InputParameters & parameters)
35  : Kernel(parameters),
36  _dictator(getUserObject<PorousFlowDictator>("PorousFlowDictator")),
37  _coefficient(getParam<Real>("biot_coefficient")),
38  _component(getParam<unsigned int>("component")),
39  _pf(getMaterialProperty<Real>("PorousFlow_effective_fluid_pressure_qp")),
40  _dpf_dvar(
41  getMaterialProperty<std::vector<Real>>("dPorousFlow_effective_fluid_pressure_qp_dvar")),
42  _rz(getBlockCoordSystem() == Moose::COORD_RZ)
43 {
44  if (_component >= _mesh.dimension())
45  paramError("component", "The component cannot be greater than the mesh dimension");
46 }
47 
48 Real
50 {
51  if (_rz && _component == 0)
52  return -_coefficient * _pf[_qp] * (_grad_test[_i][_qp](0) + _test[_i][_qp] / _q_point[_qp](0));
53  return -_coefficient * _pf[_qp] * _grad_test[_i][_qp](_component);
54 }
55 
56 Real
58 {
60  return 0.0;
61  const unsigned int pvar = _dictator.porousFlowVariableNum(_var.number());
62  if (_rz && _component == 0)
63  return -_coefficient * _phi[_j][_qp] * _dpf_dvar[_qp][pvar] *
64  (_grad_test[_i][_qp](0) + _test[_i][_qp] / _q_point[_qp](0));
65  return -_coefficient * _phi[_j][_qp] * _dpf_dvar[_qp][pvar] * _grad_test[_i][_qp](_component);
66 }
67 
68 Real
70 {
72  return 0.0;
73  const unsigned int pvar = _dictator.porousFlowVariableNum(jvar);
74  if (_rz && _component == 0)
75  return -_coefficient * _phi[_j][_qp] * _dpf_dvar[_qp][pvar] *
76  (_grad_test[_i][_qp](0) + _test[_i][_qp] / _q_point[_qp](0));
77  return -_coefficient * _phi[_j][_qp] * _dpf_dvar[_qp][pvar] * _grad_test[_i][_qp](_component);
78 }
MooseMesh & _mesh
registerMooseObject("PorousFlowApp", PorousFlowEffectiveStressCoupling)
static InputParameters validParams()
bool notPorousFlowVariable(unsigned int moose_var_num) const
Returns true if moose_var_num is not a porous flow variabe.
MooseVariable & _var
unsigned int number() const
PorousFlowEffectiveStressCoupling computes -coefficient*effective_porepressure*grad_component(test) w...
COORD_RZ
const MaterialProperty< Real > & _pf
Effective porepressure.
void addRequiredParam(const std::string &name, const std::string &doc_string)
virtual Real computeQpOffDiagJacobian(unsigned int jvar) override
const VariableTestValue & _test
virtual unsigned int dimension() const
unsigned int _i
void paramError(const std::string &param, Args... args) const
unsigned int _j
const PorousFlowDictator & _dictator
The PorousFlow dictator that holds global info about the simulation.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
This holds maps between the nonlinear variables used in a PorousFlow simulation and the variable numb...
const VariableTestGradient & _grad_test
void addClassDescription(const std::string &doc_string)
unsigned int porousFlowVariableNum(unsigned int moose_var_num) const
The PorousFlow variable number.
void addRangeCheckedParam(const std::string &name, const T &value, const std::string &parsed_function, const std::string &doc_string)
const unsigned int _component
The spatial component.
const VariablePhiValue & _phi
PorousFlowEffectiveStressCoupling(const InputParameters &parameters)
void ErrorVector unsigned int
const MaterialProperty< std::vector< Real > > & _dpf_dvar
d(effective porepressure)/(d porflow variable)
const MooseArray< Point > & _q_point
unsigned int _qp
const bool _rz
Whether an RZ coordinate system is being used.