https://mooseframework.inl.gov
WCNSFVMassFluxBC.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 
10 #include "WCNSFVMassFluxBC.h"
11 #include "INSFVPressureVariable.h"
12 #include "NS.h"
13 
14 registerMooseObject("NavierStokesApp", WCNSFVMassFluxBC);
15 
18 {
20  params.addClassDescription("Flux boundary conditions for mass advection.");
21  params.addParam<Real>("scaling_factor", 1, "To scale the mass flux");
22  return params;
23 }
24 
26 {
27  if (!dynamic_cast<INSFVPressureVariable *>(&_var))
28  paramError("variable",
29  "The variable argument to WCNSFVMassFluxBC must be of type INSFVPressureVariable");
30 
31  // Need enough information to compute the mass flux
32  if (_mdot_pp && !_area_pp)
33  mooseError("The inlet area should be provided along with the mass flow rate");
34  if (!_mdot_pp && !_velocity_pp)
35  mooseError("Velocity should be provided if the mass flow rate is not");
36 }
37 
38 ADReal
40 {
41  const auto state = determineState();
42 
43  if (!isInflow())
44  {
45  const auto fa = singleSidedFaceArg();
46  return varVelocity(state) * _normal * _rho(fa, state);
47  }
48 
49  return -_scaling_factor * inflowMassFlux(state);
50 }
const PostprocessorValue *const _velocity_pp
Postprocessor with the inlet velocity.
ADReal computeQpResidual() override
const PostprocessorValue *const _mdot_pp
Postprocessor with the inlet mass flow rate.
const Moose::Functor< ADReal > & _rho
Fluid density functor.
ADRealVectorValue varVelocity(const Moose::StateArg &state) const
returns the velocity vector (vel_x, vel_y, vel_z)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
WCNSFVMassFluxBC(const InputParameters &params)
Moose::StateArg determineState() const
static InputParameters validParams()
ADReal inflowMassFlux(const Moose::StateArg &state) const
computes the inflow massflux
Base class for weakly compressible flux boundary conditions.
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
MooseVariableFV< Real > & _var
DualNumber< Real, DNDerivativeType, true > ADReal
Flux boundary condition for the weakly compressible mass conservation equation.
registerMooseObject("NavierStokesApp", WCNSFVMassFluxBC)
static InputParameters validParams()
const PostprocessorValue *const _area_pp
Postprocessor with the inlet area.
ADRealVectorValue _normal
void paramError(const std::string &param, Args... args) const
virtual bool isInflow() const
true if a boundary is an inflow boundary, false if outflow
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const Real _scaling_factor
Scaling factor.
void mooseError(Args &&... args) const
void addClassDescription(const std::string &doc_string)