Line data Source code
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 : #pragma once 11 : 12 : #include "NS.h" 13 : #include "FVFluxBC.h" 14 : #include "INSFVFlowBC.h" 15 : 16 : /** 17 : * Base class for weakly compressible flux boundary conditions 18 : */ 19 : class WCNSFVFluxBCBase : public FVFluxBC, public INSFVFlowBC 20 : { 21 : public: 22 : static InputParameters validParams(); 23 : WCNSFVFluxBCBase(const InputParameters & params); 24 : 25 : ///@{ in residual and jacobian setup we check if the area is zero 26 : void residualSetup() override; 27 : void jacobianSetup() override; 28 : ///@} 29 : 30 : protected: 31 : /** 32 : * check for improper use on an internal face, e.g. for specific postprocessors used if a user 33 : * imposes this object on an internal face then the 'direction' parameter must be supplied 34 : */ 35 : void checkForInternalDirection() const; 36 : 37 : /// true if a boundary is an inflow boundary, false if outflow 38 : virtual bool isInflow() const; 39 : 40 : /// computes the inflow massflux 41 : ADReal inflowMassFlux(const Moose::StateArg & state) const; 42 : 43 : /// computes the inflow speed 44 : ADReal inflowSpeed(const Moose::StateArg & state) const; 45 : 46 : /// returns the velocity vector (vel_x, vel_y, vel_z) 47 : ADRealVectorValue varVelocity(const Moose::StateArg & state) const; 48 : 49 : /// Scaling factor 50 : const Real _scaling_factor; 51 : 52 : /// Postprocessor with the inlet velocity 53 : const PostprocessorValue * const _velocity_pp; 54 : 55 : /// Postprocessor with the inlet mass flow rate 56 : const PostprocessorValue * const _mdot_pp; 57 : 58 : /// Postprocessor with the inlet area 59 : const PostprocessorValue * const _area_pp; 60 : 61 : /// Fluid density functor 62 : const Moose::Functor<ADReal> & _rho; 63 : 64 : /// The direction in which the flow is entering/leaving the domain. This is mainly used for cases 65 : /// when the orientation of the face cannot be established (boundary on an internal face) or when the flow is 66 : /// entering with an angle compared to the boundary surface. 67 : const Point _direction; 68 : 69 : /// Flag to store if the flow direction is specified by the user 70 : const bool _direction_specified_by_user; 71 : 72 : ///@{ Velocity components 73 : const Moose::Functor<ADReal> & _vel_x; 74 : const Moose::Functor<ADReal> * const _vel_y; 75 : const Moose::Functor<ADReal> * const _vel_z; 76 : ///@} 77 : }; 78 : 79 : inline void 80 54744 : WCNSFVFluxBCBase::checkForInternalDirection() const 81 : { 82 54744 : if (_face_info->neighborPtr() && !_direction_specified_by_user) 83 12 : mooseError( 84 : type(), 85 : " can only be defined on an internal face if the 'direction' parameter is supplied!"); 86 54732 : }