https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
28void
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
68void
70{
72
73 for (const auto & comp_name : _connected_component_names)
74 checkComponentOfTypeExistsByName<FlowChannelBase>(comp_name);
75}
76
77const UserObjectName &
const std::string name
Definition Setup.h:21
std::vector< std::string > _connected_component_names
Vector of connected component names.
std::vector< Connection > _connections
Vector of connections of this component.
Base class for junctions of 1D components.
virtual void check() const override
Check the component integrity.
static InputParameters validParams()
virtual void init()
Initializes the component.
Definition Component.h:405
THMProblem & getTHMProblem() const
Gets the THM problem.
Definition Component.C:135
@ INITIALIZED_PRIMARY
mesh set up, called primary init
Definition Component.h:41
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
A base class for flow channels.
const UserObjectName & getFluidPropertiesName() const
Gets the name of the fluid properties user object for this component.
virtual std::shared_ptr< const FlowModel > getFlowModel() const
virtual const THM::FlowModelID & getFlowModelID() const =0
Gets the flow model ID.
FlowJunction(const InputParameters &params)
static InputParameters validParams()
virtual void init() override
Initializes the component.
THM::FlowModelID _flow_model_id
Flow model ID.
std::shared_ptr< const FlowModel > _flow_model
Flow model.
virtual void check() const override
Check the component integrity.
const UserObjectName & getFluidPropertiesName() const
Gets the name of fluid properties used in all flow connections.
UserObjectName _fp_name
Fluid property user object name.
void addPrivateParam(const std::string &name, const T &value)
const T & getComponentByName(const std::string &name) const
Get component by its name.
Definition Simulation.h:504