https://mooseframework.inl.gov
WCNSFVSwitchableInletVelocityBC.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 "INSFVVelocityVariable.h"
12 #include "NS.h"
13 
15 
18 {
20 
21  params.addClassDescription("Adds switchable inlet-velocity boundary condition"
22  "for weakly compressible flows.");
23 
24  params.addParam<bool>(
25  "switch_bc", true, "Switch on (true) / off (false) for boundary condition.");
26  params.declareControllable("switch_bc");
27 
28  params.addParam<Real>("face_limiter", 1.0, "Face flux limiter.");
29  params.declareControllable("face_limiter");
30 
31  return params;
32 }
33 
35  : WCNSFVInletVelocityBC(params),
36  _switch_bc(getParam<bool>("switch_bc")),
37  _face_limiter(getParam<Real>("face_limiter"))
38 {
39 }
40 
41 ADReal
43  const Moose::StateArg & state) const
44 {
45  if (_switch_bc)
47  else
48  {
49  // if on an internal face (internal to the mesh, but an external boundary of the flow area),
50  // we have to make sure to select the element on which the velocity is defined
52  ? fi.elemPtr()
53  : fi.neighborPtr();
54  // The two-term expansion = false piece is critical as it prevents infinite recursion that would
55  // occur with a Green-Gauss gradient calculation which would call back to this "Dirichlet"
56  // object
58  /*two_term_expansion=*/false,
59  /*correct_skewness=*/false,
60  elem_ptr,
61  state) *
63  }
64 }
ADReal boundaryValue(const FaceInfo &fi, const Moose::StateArg &state) const override
const std::pair< unsigned int, unsigned int > _var_sys_numbers_pair
WCNSFVSwitchableInletVelocityBC(const InputParameters &params)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
MooseVariableFV< Real > & _var
Dirichlet boundary conditions for the velocity, set from either a velocity postprocessor or a mass fl...
DualNumber< Real, DNDerivativeType, true > ADReal
registerMooseObject("NavierStokesApp", WCNSFVSwitchableInletVelocityBC)
const bool & _switch_bc
Boolean switch to turn boundary condition on/off.
ADReal boundaryValue(const FaceInfo &fi, const Moose::StateArg &state) const override
const Elem * neighborPtr() const
virtual ADReal getExtrapolatedBoundaryFaceValue(const FaceInfo &fi, bool two_term_expansion, bool correct_skewness, const Elem *elem_side_to_extrapolate_from, const StateArg &state) const
const Elem * elemPtr() const
Dirichlet boundary conditions for the velocity, set from either a velocity postprocessor The class is...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void addClassDescription(const std::string &doc_string)
static InputParameters validParams()
void declareControllable(const std::string &name, std::set< ExecFlagType > execute_flags={})
VarFaceNeighbors faceType(const std::pair< unsigned int, unsigned int > &var_sys) const