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