https://mooseframework.inl.gov
INSFVMassAdvectionOutflowBC.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 "SubProblem.h"
13 #include "MooseMesh.h"
14 #include "NS.h"
15 
17 
20 {
23  params.addClassDescription("Outflow boundary condition for advecting mass.");
24  params.addRequiredParam<MooseFunctorName>(NS::density, "The functor for the density");
25  params.declareControllable("rho");
26  params.addRequiredParam<MooseFunctorName>("u", "The velocity in the x direction.");
27  params.addParam<MooseFunctorName>("v", "The velocity in the y direction.");
28  params.addParam<MooseFunctorName>("w", "The velocity in the z direction.");
29  return params;
30 }
31 
33  : FVFluxBC(params),
35  _rho(getFunctor<ADReal>(NS::density)),
36  _u(getFunctor<ADReal>("u")),
37  _v(isParamValid("v") ? &getFunctor<ADReal>("v") : nullptr),
38  _w(isParamValid("w") ? &getFunctor<ADReal>("w") : nullptr),
39  _dim(_subproblem.mesh().dimension())
40 {
41  if (_dim >= 2 && !_v)
42  mooseError(
43  "In two or more dimensions, the v velocity must be supplied using the 'v' parameter");
44  if (_dim >= 3 && !_w)
45  mooseError("In threedimensions, the w velocity must be supplied using the 'w' parameter");
46 }
47 
48 ADReal
50 {
51  const auto boundary_face = singleSidedFaceArg();
52  const auto state = determineState();
53 
54  ADRealVectorValue v(_u(boundary_face, state));
55  if (_v)
56  v(1) = (*_v)(boundary_face, state);
57  if (_w)
58  v(2) = (*_w)(boundary_face, state);
59 
60  return _normal * v * _rho(boundary_face, state);
61 }
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
static InputParameters validParams()
Moose::StateArg determineState() const
A class for finite volume fully developed outflow boundary conditions for the mass equation It advect...
MeshBase & mesh
static const std::string density
Definition: NS.h:33
virtual ADReal computeQpResidual() override
Moose::FaceArg singleSidedFaceArg(const FaceInfo *fi=nullptr, Moose::FV::LimiterType limiter_type=Moose::FV::LimiterType::CentralDifference, bool correct_skewness=false, const Moose::StateArg *state_limiter=nullptr) const
registerADMooseObject("NavierStokesApp", INSFVMassAdvectionOutflowBC)
DualNumber< Real, DNDerivativeType, true > ADReal
static InputParameters validParams()
void addRequiredParam(const std::string &name, const std::string &doc_string)
const unsigned int _dim
the dimension of the simulation
INSFVMassAdvectionOutflowBC(const InputParameters &params)
const Moose::Functor< ADReal > *const _w
z-velocity
ADRealVectorValue _normal
const Moose::Functor< ADReal > *const _v
y-velocity
const Moose::Functor< ADReal > & _u
x-velocity
static const std::string v
Definition: NS.h:84
void mooseError(Args &&... args) const
void addClassDescription(const std::string &doc_string)
static InputParameters validParams()
const Moose::Functor< ADReal > & _rho
Density.
void declareControllable(const std::string &name, std::set< ExecFlagType > execute_flags={})
A parent class for INSFV fully developed flow boundary conditions.