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