https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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"
12#include "NS.h"
13
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
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}
DualNumber< Real, DNDerivativeType, true > ADReal
registerMooseObject("NavierStokesApp", WCNSFVMassFluxBC)
MooseVariableFV< Real > & _var
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
ADRealVectorValue _normal
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)
void paramError(const std::string &param, Args... args) const
void mooseError(Args &&... args) const
Moose::StateArg determineState() const
Base class for weakly compressible flux boundary conditions.
const Moose::Functor< ADReal > & _rho
Fluid density functor.
ADReal inflowMassFlux(const Moose::StateArg &state) const
computes the inflow massflux
static InputParameters validParams()
const PostprocessorValue *const _mdot_pp
Postprocessor with the inlet mass flow rate.
const Real _scaling_factor
Scaling factor.
const PostprocessorValue *const _velocity_pp
Postprocessor with the inlet velocity.
virtual bool isInflow() const
true if a boundary is an inflow boundary, false if outflow
const PostprocessorValue *const _area_pp
Postprocessor with the inlet area.
ADRealVectorValue varVelocity(const Moose::StateArg &state) const
returns the velocity vector (vel_x, vel_y, vel_z)
Flux boundary condition for the weakly compressible mass conservation equation.
WCNSFVMassFluxBC(const InputParameters &params)
static InputParameters validParams()
ADReal computeQpResidual() override