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 : #include "WCNSFVMassFluxBC.h" 11 : #include "INSFVPressureVariable.h" 12 : #include "NS.h" 13 : 14 : registerMooseObject("NavierStokesApp", WCNSFVMassFluxBC); 15 : 16 : InputParameters 17 340 : WCNSFVMassFluxBC::validParams() 18 : { 19 340 : InputParameters params = WCNSFVFluxBCBase::validParams(); 20 340 : params.addClassDescription("Flux boundary conditions for mass advection."); 21 680 : params.addParam<Real>("scaling_factor", 1, "To scale the mass flux"); 22 340 : return params; 23 0 : } 24 : 25 200 : WCNSFVMassFluxBC::WCNSFVMassFluxBC(const InputParameters & params) : WCNSFVFluxBCBase(params) 26 : { 27 196 : if (!dynamic_cast<INSFVPressureVariable *>(&_var)) 28 0 : paramError("variable", 29 : "The variable argument to WCNSFVMassFluxBC must be of type INSFVPressureVariable"); 30 : 31 : // Need enough information to compute the mass flux 32 196 : if (_mdot_pp && !_area_pp) 33 4 : mooseError("The inlet area should be provided along with the mass flow rate"); 34 192 : if (!_mdot_pp && !_velocity_pp) 35 0 : mooseError("Velocity should be provided if the mass flow rate is not"); 36 192 : } 37 : 38 : ADReal 39 8700 : WCNSFVMassFluxBC::computeQpResidual() 40 : { 41 8700 : const auto state = determineState(); 42 : 43 8700 : if (!isInflow()) 44 : { 45 579 : const auto fa = singleSidedFaceArg(); 46 1158 : return varVelocity(state) * _normal * _rho(fa, state); 47 : } 48 : 49 16239 : return -_scaling_factor * inflowMassFlux(state); 50 : }