https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
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
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
50 const auto elem_ptr = (fi.faceType(_var_sys_numbers_pair) == FaceInfo::VarFaceNeighbors::ELEM)
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}
DualNumber< Real, DNDerivativeType, true > ADReal
registerMooseObject("NavierStokesApp", INSFVSwitchableOutletPressureBC)
const std::pair< unsigned int, unsigned int > _var_sys_numbers_pair
VarFaceNeighbors faceType(const std::pair< unsigned int, unsigned int > &var_sys) const
const Elem * neighborPtr() const
const Elem * elemPtr() const
A parent class for INSFV flow boundary conditions.
Definition INSFVFlowBC.h:18
A class for setting the value of the pressure at an outlet of the system.
static InputParameters validParams()
ADReal boundaryValue(const FaceInfo &, const Moose::StateArg &) const override
A class for setting the value of the pressure at an outlet of the system.
INSFVSwitchableOutletPressureBC(const InputParameters &params)
ADReal boundaryValue(const FaceInfo &, const Moose::StateArg &) const override
const bool & _switch_bc
Boolean switch to turn boundary condition on/off.
void declareControllable(const std::string &name, std::set< ExecFlagType > execute_flags={})
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)
virtual ADReal getExtrapolatedBoundaryFaceValue(const FaceInfo &fi, bool two_term_expansion, bool correct_skewness, const Elem *elem_side_to_extrapolate_from, const StateArg &state) const