https://mooseframework.inl.gov
Loading...
Searching...
No Matches
PorousFlowDarcyVelocityComponent.C
Go to the documentation of this file.
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
11
14
15template <bool is_ad>
18{
20 params.addRequiredParam<RealVectorValue>("gravity",
21 "Gravitational acceleration vector downwards (m/s^2)");
22 params.addRequiredParam<UserObjectName>(
23 "PorousFlowDictator", "The UserObject that holds the list of PorousFlow variable names");
24 params.addParam<unsigned int>("fluid_phase", 0, "The index corresponding to the fluid phase");
25 MooseEnum component("x=0 y=1 z=2");
27 "component", component, "The spatial component of the Darcy flux to return");
28 params.addClassDescription("Darcy velocity (in m^3.s^-1.m^-2, or m.s^-1) -(k_ij * krel /mu "
29 "(nabla_j P - w_j)), where k_ij is the permeability tensor, krel is "
30 "the relative permeability, mu is the fluid viscosity, P is the fluid "
31 "pressure, and w_j is the fluid weight.");
32 return params;
33}
34
35template <bool is_ad>
37 const InputParameters & parameters)
38 : AuxKernel(parameters),
39 _relative_permeability(getGenericMaterialProperty<std::vector<Real>, is_ad>(
40 "PorousFlow_relative_permeability_qp")),
41 _fluid_viscosity(
42 getGenericMaterialProperty<std::vector<Real>, is_ad>("PorousFlow_viscosity_qp")),
43 _permeability(getGenericMaterialProperty<RealTensorValue, is_ad>("PorousFlow_permeability_qp")),
44 _grad_p(getGenericMaterialProperty<std::vector<RealGradient>, is_ad>(
45 "PorousFlow_grad_porepressure_qp")),
46 _fluid_density_qp(
47 getGenericMaterialProperty<std::vector<Real>, is_ad>("PorousFlow_fluid_phase_density_qp")),
48 _dictator(getUserObject<PorousFlowDictator>("PorousFlowDictator")),
49 _ph(getParam<unsigned int>("fluid_phase")),
50 _component(getParam<MooseEnum>("component")),
51 _gravity(getParam<RealVectorValue>("gravity"))
52{
53 if (_ph >= _dictator.numPhases())
54 paramError("fluid_phase",
55 "The Dictator proclaims that the maximum phase index in this simulation is ",
56 _dictator.numPhases() - 1,
57 " whereas you have used ",
58 _ph,
59 ". Remember that indexing starts at 0. The Dictator is watching you, to "
60 "ensure your wellbeing.");
61}
62
63template <bool is_ad>
64Real
66{
68 (_permeability[_qp] * (_grad_p[_qp][_ph] - _fluid_density_qp[_qp][_ph] * _gravity) *
69 _relative_permeability[_qp][_ph] / _fluid_viscosity[_qp][_ph])(_component));
70}
71
registerMooseObject("PorousFlowApp", PorousFlowDarcyVelocityComponent)
void ErrorVector unsigned int
static InputParameters validParams()
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
void paramError(const std::string &param, Args... args) const
Computes a component of the Darcy velocity: -k_ij * krel /mu (nabla_j P - w_j) where k_ij is the perm...
const unsigned int _ph
Index of the fluid phase.
const PorousFlowDictator & _dictator
PorousFlowDicatator UserObject.
PorousFlowDarcyVelocityComponentTempl(const InputParameters &parameters)
This holds maps between the nonlinear variables used in a PorousFlow simulation and the variable numb...
unsigned int numPhases() const
The number of fluid phases.
auto raw_value(const Eigen::Map< T > &in)