www.mooseframework.org
PorousFlowBasicAdvection.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 
13 
16 {
18  params.addRequiredParam<UserObjectName>(
19  "PorousFlowDictator", "The UserObject that holds the list of PorousFlow variable names.");
20  params.addParam<unsigned int>("phase", 0, "Use the Darcy velocity of this fluid phase");
21  params.addClassDescription(
22  "Advective flux of a Variable using the Darcy velocity of the fluid phase");
23  return params;
24 }
25 
27  : Kernel(parameters),
28  _dictator(getUserObject<PorousFlowDictator>("PorousFlowDictator")),
29  _ph(getParam<unsigned int>("phase")),
30  _darcy_velocity(
31  getMaterialProperty<std::vector<RealVectorValue>>("PorousFlow_darcy_velocity_qp")),
32  _ddarcy_velocity_dvar(getMaterialProperty<std::vector<std::vector<RealVectorValue>>>(
33  "dPorousFlow_darcy_velocity_qp_dvar")),
34  _ddarcy_velocity_dgradvar(
35  getMaterialProperty<std::vector<std::vector<std::vector<RealVectorValue>>>>(
36  "dPorousFlow_darcy_velocity_qp_dgradvar"))
37 {
38  if (_ph >= _dictator.numPhases())
39  paramError("phase",
40  "The Dictator proclaims that the maximum phase index in this simulation is ",
41  _dictator.numPhases() - 1,
42  " whereas you have used ",
43  _ph,
44  ". Remember that indexing starts at 0. The Dictator is watching you, to "
45  "ensure your wellbeing.");
46 }
47 
48 Real
50 {
51  return -_grad_test[_i][_qp] * _darcy_velocity[_qp][_ph] * _u[_qp];
52 }
53 
54 Real
56 {
57  const Real result = -_grad_test[_i][_qp] * _darcy_velocity[_qp][_ph] * _phi[_j][_qp];
58  return result + computeQpOffDiagJacobian(_var.number());
59 }
60 
61 Real
63 {
65  return 0.0;
66 
67  const unsigned pvar = _dictator.porousFlowVariableNum(jvar);
68  Real result =
70  for (unsigned j = 0; j < LIBMESH_DIM; ++j)
71  result -= _grad_test[_i][_qp] *
72  (_ddarcy_velocity_dgradvar[_qp][_ph][j][pvar] * _grad_phi[_j][_qp](j)) * _u[_qp];
73 
74  return result;
75 }
static InputParameters validParams()
static InputParameters validParams()
const MaterialProperty< std::vector< std::vector< RealVectorValue > > > & _ddarcy_velocity_dvar
_ddarcy_velocity_dvar[_qp][ph][v](j) = d(j^th component of the Darcy velocity of phase ph)/d(PorousFl...
bool notPorousFlowVariable(unsigned int moose_var_num) const
Returns true if moose_var_num is not a porous flow variabe.
MooseVariable & _var
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
unsigned int number() const
const VariablePhiGradient & _grad_phi
virtual Real computeQpOffDiagJacobian(unsigned int jvar) override
const unsigned _ph
Phase of Darcy velocity.
registerMooseObject("PorousFlowApp", PorousFlowBasicAdvection)
void addRequiredParam(const std::string &name, const std::string &doc_string)
virtual Real computeQpJacobian() override
unsigned int _i
void paramError(const std::string &param, Args... args) const
unsigned int numPhases() const
The number of fluid phases.
const MaterialProperty< std::vector< std::vector< std::vector< RealVectorValue > > > > & _ddarcy_velocity_dgradvar
_ddarcy_velocity_dgradvar[_qp][ph][j][v](k) = d(k^th component of the Darcy velocity of phase ph)/d(j...
unsigned int _j
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
PorousFlowBasicAdvection(const InputParameters &parameters)
const PorousFlowDictator & _dictator
Holds info on the Porous Flow variables.
void addClassDescription(const std::string &doc_string)
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
unsigned int porousFlowVariableNum(unsigned int moose_var_num) const
The PorousFlow variable number.
Kernel = grad(test) * darcy_velocity * u.
const VariablePhiValue & _phi
void ErrorVector unsigned int
const MaterialProperty< std::vector< RealVectorValue > > & _darcy_velocity
_darcy_velocity[_qp][ph](j) = j^th component of the Darcy velocity of phase ph
const VariableValue & _u
unsigned int _qp
virtual Real computeQpResidual() override