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 "InletDensityVelocity1Phase.h" 11 : #include "FlowModelSinglePhase.h" 12 : 13 : registerMooseObject("ThermalHydraulicsApp", InletDensityVelocity1Phase); 14 : 15 : InputParameters 16 438 : InletDensityVelocity1Phase::validParams() 17 : { 18 438 : InputParameters params = FlowBoundary1Phase::validParams(); 19 876 : params.addRequiredParam<Real>("rho", "Prescribed density [kg/m^3]"); 20 876 : params.addRequiredParam<Real>("vel", "Prescribed velocity [m/s]"); 21 876 : params.addParam<bool>("reversible", true, "True for reversible, false for pure inlet"); 22 876 : params.declareControllable("rho vel"); 23 438 : params.addClassDescription( 24 : "Boundary condition with prescribed density and velocity for 1-phase flow channels."); 25 438 : return params; 26 0 : } 27 : 28 219 : InletDensityVelocity1Phase::InletDensityVelocity1Phase(const InputParameters & params) 29 438 : : FlowBoundary1Phase(params), _reversible(getParam<bool>("reversible")) 30 : { 31 219 : } 32 : 33 : void 34 214 : InletDensityVelocity1Phase::check() const 35 : { 36 214 : FlowBoundary1Phase::check(); 37 : 38 214 : auto fm = dynamic_cast<const FlowModelSinglePhase *>(_flow_model.get()); 39 214 : if (fm == nullptr) 40 0 : logError("Incompatible flow model. Make sure you use this component with single phase flow " 41 : "channel."); 42 214 : } 43 : 44 : void 45 219 : InletDensityVelocity1Phase::addMooseObjects() 46 : { 47 219 : ExecFlagEnum execute_on(MooseUtils::getDefaultExecFlagEnum()); 48 1095 : execute_on = {EXEC_INITIAL, EXEC_LINEAR, EXEC_NONLINEAR}; 49 : 50 : // boundary flux user object 51 : { 52 219 : const std::string class_name = "ADBoundaryFlux3EqnGhostDensityVelocity"; 53 219 : InputParameters params = _factory.getValidParams(class_name); 54 438 : params.set<Real>("rho") = getParam<Real>("rho"); 55 438 : params.set<Real>("vel") = getParam<Real>("vel"); 56 219 : params.set<Real>("normal") = _normal; 57 219 : params.set<bool>("reversible") = _reversible; 58 219 : params.set<UserObjectName>("fluid_properties") = _fp_name; 59 219 : params.set<UserObjectName>("numerical_flux") = _numerical_flux_name; 60 219 : params.set<ExecFlagEnum>("execute_on") = execute_on; 61 219 : getTHMProblem().addUserObject(class_name, _boundary_uo_name, params); 62 : 63 219 : connectObject(params, _boundary_uo_name, "rho"); 64 219 : connectObject(params, _boundary_uo_name, "vel"); 65 219 : } 66 : 67 : // BCs 68 219 : addWeakBCs(); 69 438 : }