https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
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
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
51 const auto elem_ptr = (fi.faceType(_var_sys_numbers_pair) == FaceInfo::VarFaceNeighbors::ELEM)
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}
DualNumber< Real, DNDerivativeType, true > ADReal
registerMooseObject("NavierStokesApp", WCNSFVSwitchableInletVelocityBC)
MooseVariableFV< Real > & _var
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
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
Dirichlet boundary conditions for the velocity, set from either a velocity postprocessor or a mass fl...
static InputParameters validParams()
ADReal boundaryValue(const FaceInfo &fi, const Moose::StateArg &state) const override
Dirichlet boundary conditions for the velocity, set from either a velocity postprocessor The class is...
WCNSFVSwitchableInletVelocityBC(const InputParameters &params)
const bool & _switch_bc
Boolean switch to turn boundary condition on/off.
ADReal boundaryValue(const FaceInfo &fi, const Moose::StateArg &state) const override