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 "FlowJunction.h" 11 : #include "FlowChannelBase.h" 12 : 13 : InputParameters 14 3096 : FlowJunction::validParams() 15 : { 16 3096 : InputParameters params = Component1DJunction::validParams(); 17 6192 : params.addPrivateParam<std::string>("component_type", "flow_junction"); 18 3096 : return params; 19 0 : } 20 : 21 1548 : FlowJunction::FlowJunction(const InputParameters & params) 22 : : Component1DJunction(params), 23 : 24 3096 : _junction_uo_name(genName(name(), "junction_uo")) 25 : { 26 1548 : } 27 : 28 : void 29 1539 : FlowJunction::init() 30 : { 31 1539 : Component1DJunction::init(); 32 : 33 1539 : if (_connections.size() > 0) 34 : { 35 : std::vector<UserObjectName> fp_names; 36 : std::vector<THM::FlowModelID> flow_model_ids; 37 4854 : for (const auto & connection : _connections) 38 : { 39 3315 : const std::string comp_name = connection._component_name; 40 : if (hasComponentByName<FlowChannelBase>(comp_name)) 41 : { 42 : const FlowChannelBase & comp = 43 3315 : getTHMProblem().getComponentByName<FlowChannelBase>(comp_name); 44 : 45 3315 : fp_names.push_back(comp.getFluidPropertiesName()); 46 3315 : flow_model_ids.push_back(comp.getFlowModelID()); 47 : } 48 : } 49 : 50 1539 : if (fp_names.size() > 0) 51 : { 52 3078 : checkAllConnectionsHaveSame<UserObjectName>(fp_names, "fluid properties object"); 53 : _fp_name = fp_names[0]; 54 : 55 3078 : checkAllConnectionsHaveSame<THM::FlowModelID>(flow_model_ids, "flow model ID"); 56 1539 : _flow_model_id = flow_model_ids[0]; 57 : 58 1539 : if (hasComponentByName<FlowChannelBase>(_connections[0]._component_name)) 59 : { 60 : const FlowChannelBase & flow_channel = 61 : getComponentByName<FlowChannelBase>(_connections[0]._component_name); 62 3078 : _flow_model = flow_channel.getFlowModel(); 63 : } 64 : } 65 1539 : } 66 1539 : } 67 : 68 : void 69 1509 : FlowJunction::check() const 70 : { 71 1509 : Component1DJunction::check(); 72 : 73 4764 : for (const auto & comp_name : _connected_component_names) 74 3255 : checkComponentOfTypeExistsByName<FlowChannelBase>(comp_name); 75 1509 : } 76 : 77 : const UserObjectName & 78 0 : FlowJunction::getFluidPropertiesName() const 79 : { 80 0 : checkSetupStatus(INITIALIZED_PRIMARY); 81 : 82 0 : return _fp_name; 83 : }