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