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