https://mooseframework.inl.gov
FlowJunction.C
Go to the documentation of this file.
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 
15 {
17  params.addPrivateParam<std::string>("component_type", "flow_junction");
18  return params;
19 }
20 
22  : Component1DJunction(params),
23 
24  _junction_uo_name(genName(name(), "junction_uo"))
25 {
26 }
27 
28 void
30 {
32 
33  if (_connections.size() > 0)
34  {
35  std::vector<UserObjectName> fp_names;
36  std::vector<THM::FlowModelID> flow_model_ids;
37  for (const auto & connection : _connections)
38  {
39  const std::string comp_name = connection._component_name;
40  if (hasComponentByName<FlowChannelBase>(comp_name))
41  {
42  const FlowChannelBase & comp =
44 
45  fp_names.push_back(comp.getFluidPropertiesName());
46  flow_model_ids.push_back(comp.getFlowModelID());
47  }
48  }
49 
50  if (fp_names.size() > 0)
51  {
52  checkAllConnectionsHaveSame<UserObjectName>(fp_names, "fluid properties object");
53  _fp_name = fp_names[0];
54 
55  checkAllConnectionsHaveSame<THM::FlowModelID>(flow_model_ids, "flow model ID");
56  _flow_model_id = flow_model_ids[0];
57 
58  if (hasComponentByName<FlowChannelBase>(_connections[0]._component_name))
59  {
60  const FlowChannelBase & flow_channel =
61  getComponentByName<FlowChannelBase>(_connections[0]._component_name);
62  _flow_model = flow_channel.getFlowModel();
63  }
64  }
65  }
66 }
67 
68 void
70 {
72 
73  for (const auto & comp_name : _connected_component_names)
74  checkComponentOfTypeExistsByName<FlowChannelBase>(comp_name);
75 }
76 
77 const UserObjectName &
79 {
81 
82  return _fp_name;
83 }
virtual void init() override
Initializes the component.
void addPrivateParam(const std::string &name, const T &value)
THMProblem & getTHMProblem() const
Gets the THM problem.
Definition: Component.C:135
virtual void init() override
Initializes the component.
Definition: FlowJunction.C:29
std::vector< Connection > _connections
Vector of connections of this component.
A base class for flow channels.
FlowJunction(const InputParameters &params)
Definition: FlowJunction.C:21
static InputParameters validParams()
virtual std::shared_ptr< const FlowModel > getFlowModel() const
virtual void check() const override
Check the component integrity.
Definition: FlowJunction.C:69
std::shared_ptr< const FlowModel > _flow_model
Flow model.
Definition: FlowJunction.h:36
const UserObjectName & getFluidPropertiesName() const
Gets the name of fluid properties used in all flow connections.
Definition: FlowJunction.C:78
THM::FlowModelID _flow_model_id
Flow model ID.
Definition: FlowJunction.h:34
std::vector< std::string > _connected_component_names
Vector of connected component names.
const std::string name
Definition: Setup.h:20
mesh set up, called primary init
Definition: Component.h:40
static InputParameters validParams()
Definition: FlowJunction.C:14
const T & getComponentByName(const std::string &name) const
Get component by its name.
Definition: Simulation.h:504
virtual void check() const override
Check the component integrity.
Base class for junctions of 1D components.
void checkSetupStatus(const EComponentSetupStatus &status) const
Throws an error if the supplied setup status of this component has not been reached.
Definition: Component.C:117
UserObjectName _fp_name
Fluid property user object name.
Definition: FlowJunction.h:38
virtual const THM::FlowModelID & getFlowModelID() const =0
Gets the flow model ID.
const UserObjectName & getFluidPropertiesName() const
Gets the name of the fluid properties user object for this component.