https://mooseframework.inl.gov
PorousFlowDarcyVelocityComponentLowerDimensional.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 #include "MooseMesh.h"
12 #include "Assembly.h"
13 
15 
18 {
20  params.addCoupledVar("aperture", 1.0, "Aperture of the fracture");
21  params.addClassDescription(
22  "Darcy velocity on a lower-dimensional element embedded in a higher-dimensional mesh. Units "
23  "m^3.s^-1.m^-2, or m.s^-1. Darcy velocity = -(k_ij * krel /(mu * a) (nabla_j P - w_j)), "
24  "where k_ij is the permeability tensor, krel is the relative permeability, mu is the fluid "
25  "viscosity, P is the fluid pressure, a is the fracture aperture and w_j is the fluid weight. "
26  " The difference between this AuxKernel and PorousFlowDarcyVelocity is that this one "
27  "projects gravity along the element's tangent direction. NOTE! For a meaningful answer, "
28  "your permeability tensor must NOT contain terms that rotate tangential vectors to "
29  "non-tangential vectors.");
30  return params;
31 }
32 
34  const InputParameters & parameters)
35  : PorousFlowDarcyVelocityComponent(parameters), _aperture(coupledValue("aperture"))
36 {
37  if (isNodal())
38  paramError("variable", "This AuxKernel only supports Elemental fields");
39 }
40 
41 Real
43 {
44  const unsigned elem_dim = _current_elem->dim();
45  if (elem_dim == _mesh.dimension())
46  mooseError("The variable ",
47  _var.name(),
48  " must must be defined on lower-dimensional elements "
49  "only since it employs "
50  "PorousFlowDarcyVelocityComponentLowerDimensional\n");
51 
52  // MOOSE will automatically make grad(P) lie along the element's tangent direction
53  // but we need to project gravity in that direction too
54 
55  // tang_xi is the element's tangent vector in xi direction
56  const std::vector<RealGradient> & tang_xi = _assembly.getFE(FEType(), elem_dim)->get_dxyzdxi();
57  RealVectorValue tangential_gravity =
58  (_gravity * tang_xi[_qp] / tang_xi[_qp].norm_sq()) * tang_xi[_qp];
59  if (elem_dim == 2)
60  {
61  // tang_eta is the element's tangent vector in eta direction
62  const std::vector<RealGradient> & tang_eta =
63  _assembly.getFE(FEType(), elem_dim)->get_dxyzdeta();
64  const RealGradient normal_to_xi =
65  tang_eta[_qp] - (tang_eta[_qp] * tang_xi[_qp] / tang_xi[_qp].norm_sq()) * tang_xi[_qp];
66  tangential_gravity += (_gravity * normal_to_xi / normal_to_xi.norm_sq()) * normal_to_xi;
67  }
68 
69  return -(_permeability[_qp] *
70  (_grad_p[_qp][_ph] - _fluid_density_qp[_qp][_ph] * tangential_gravity) *
72  _aperture[_qp];
73 }
const GenericMaterialProperty< std::vector< Real >, is_ad > & _relative_permeability
Relative permeability of each phase.
virtual_for_inffe const std::vector< RealGradient > & get_dxyzdeta() const
const RealVectorValue _gravity
Gravitational acceleration.
const GenericMaterialProperty< std::vector< RealGradient >, is_ad > & _grad_p
Gradient of the pore pressure in each phase.
const std::string & name() const override
const unsigned int _ph
Index of the fluid phase.
auto norm_sq() const -> decltype(std::norm(Real()))
virtual unsigned int dimension() const
Computes a component of the Darcy velocity: -k_ij * krel /mu (nabla_j P - w_j) where k_ij is the perm...
registerMooseObject("PorousFlowApp", PorousFlowDarcyVelocityComponentLowerDimensional)
void paramError(const std::string &param, Args... args) const
const GenericMaterialProperty< RealTensorValue, is_ad > & _permeability
Permeability of porous material.
void addCoupledVar(const std::string &name, const std::string &doc_string)
MooseVariableField< Real > & _var
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const GenericMaterialProperty< std::vector< Real >, is_ad > & _fluid_viscosity
Viscosity of each component in each phase.
void mooseError(Args &&... args) const
const Elem *const & _current_elem
void addClassDescription(const std::string &doc_string)
virtual_for_inffe const std::vector< RealGradient > & get_dxyzdxi() const
const FEBase *const & getFE(FEType type, unsigned int dim) const
unsigned int _component
Desired spatial component.
const GenericMaterialProperty< std::vector< Real >, is_ad > & _fluid_density_qp
Fluid density for each phase (at the qp)
Computes a component of the Darcy velocity: -k_ij * krel /(mu a) (nabla_j P - w_j) where k_ij is the ...