https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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");
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
41Real
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) *
73}
registerMooseObject("PorousFlowApp", PorousFlowDarcyVelocityComponentLowerDimensional)
const FEBase *const & getFE(FEType type, unsigned int dim) const
const Elem *const & _current_elem
MooseVariableField< ComputeValueType > & _var
void addClassDescription(const std::string &doc_string)
void addCoupledVar(const std::string &name, const std::string &doc_string)
const std::string & name() const
void paramError(const std::string &param, Args... args) const
void mooseError(Args &&... args) const
virtual unsigned int dimension() const
Computes a component of the Darcy velocity: -k_ij * krel /(mu a) (nabla_j P - w_j) where k_ij is the ...
Computes a component of the Darcy velocity: -k_ij * krel /mu (nabla_j P - w_j) where k_ij is the perm...
unsigned int _component
Desired spatial component.
const RealVectorValue _gravity
Gravitational acceleration.
const unsigned int _ph
Index of the fluid phase.
const GenericMaterialProperty< std::vector< Real >, is_ad > & _fluid_density_qp
Fluid density for each phase (at the qp)
const GenericMaterialProperty< std::vector< Real >, is_ad > & _fluid_viscosity
Viscosity of each component in each phase.
const GenericMaterialProperty< std::vector< Real >, is_ad > & _relative_permeability
Relative permeability of each phase.
const GenericMaterialProperty< RealTensorValue, is_ad > & _permeability
Permeability of porous material.
const GenericMaterialProperty< std::vector< RealGradient >, is_ad > & _grad_p
Gradient of the pore pressure in each phase.