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 812 : InletMassFlowRateTemperature1Phase::validParams() 17 : { 18 812 : InputParameters params = FlowBoundary1Phase::validParams(); 19 1624 : params.addRequiredParam<Real>("m_dot", "Prescribed mass flow rate [kg/s]"); 20 1624 : params.addRequiredParam<Real>("T", "Prescribed temperature [K]"); 21 1624 : params.addParam<std::vector<FunctionName>>( 22 : "passives", {}, "Prescribed passive transport functions [amount/m^3]"); 23 1624 : params.addParam<bool>("reversible", true, "True for reversible, false for pure inlet"); 24 1624 : params.declareControllable("m_dot T"); 25 812 : params.addClassDescription("Boundary condition with prescribed mass flow rate and temperature " 26 : "for 1-phase flow channels."); 27 812 : return params; 28 0 : } 29 : 30 405 : InletMassFlowRateTemperature1Phase::InletMassFlowRateTemperature1Phase( 31 405 : const InputParameters & params) 32 405 : : FlowBoundary1Phase(params) 33 : { 34 405 : } 35 : 36 : void 37 402 : InletMassFlowRateTemperature1Phase::check() const 38 : { 39 402 : FlowBoundary1Phase::check(); 40 : 41 402 : auto fm = dynamic_cast<const FlowModelSinglePhase *>(_flow_model.get()); 42 400 : if (fm) 43 : { 44 800 : const auto n_passives = getParam<std::vector<FunctionName>>("passives").size(); 45 400 : if (n_passives != fm->passiveTransportSolutionVariableNames().size()) 46 0 : logError("The number of entries in 'passives' must match the number of passive transport " 47 : "variables provided in the connected flow channel."); 48 : } 49 : else 50 2 : logError("Incompatible flow model. Make sure you use this component with single phase flow " 51 : "channel."); 52 402 : } 53 : 54 : void 55 393 : InletMassFlowRateTemperature1Phase::addMooseObjects() 56 : { 57 393 : ExecFlagEnum userobject_execute_on(MooseUtils::getDefaultExecFlagEnum()); 58 1965 : userobject_execute_on = {EXEC_INITIAL, EXEC_LINEAR, EXEC_NONLINEAR}; 59 : 60 : // boundary flux user object 61 : { 62 393 : const std::string class_name = "ADBoundaryFlux3EqnGhostMassFlowRateTemperature"; 63 393 : InputParameters params = _factory.getValidParams(class_name); 64 393 : params.applyParameters(parameters()); 65 786 : params.set<Real>("mass_flow_rate") = getParam<Real>("m_dot"); 66 393 : params.set<Real>("normal") = _normal; 67 393 : params.set<UserObjectName>("numerical_flux") = _numerical_flux_name; 68 393 : params.set<UserObjectName>("fluid_properties") = _fp_name; 69 393 : params.set<ExecFlagEnum>("execute_on") = userobject_execute_on; 70 393 : getTHMProblem().addUserObject(class_name, _boundary_uo_name, params); 71 786 : connectObject(params, _boundary_uo_name, "m_dot", "mass_flow_rate"); 72 393 : connectObject(params, _boundary_uo_name, "T"); 73 393 : } 74 : 75 : // BCs 76 393 : addWeakBCs(); 77 786 : }