https://mooseframework.inl.gov
Loading...
Searching...
No Matches
JunctionOneToOne1Phase.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
11#include "FlowChannel1Phase.h"
13#include "THMMesh.h"
15
17
20{
22
24 "Junction connecting one flow channel to one other flow channel for 1-phase flow");
25
26 return params;
27}
28
30 : FlowJunction1Phase(params),
31 _slope_reconstruction(
32 SlopeReconstruction1DInterface<true>::getSlopeReconstructionMooseEnum("None"))
33{
34}
35
36void
38{
40
41 const auto & connected_elems = getConnectedElementIDs();
42 if (connected_elems.size() == 2)
43 getTHMProblem().augmentSparsity(connected_elems[0], connected_elems[1]);
44}
45
46void
48{
50
51 // Get slope reconstruction option used
52 for (const auto & connection : getConnections())
53 {
54 const std::string & comp_name = connection._component_name;
55 if (hasComponentByName<FlowChannel1Phase>(comp_name))
56 {
57 const FlowChannel1Phase & comp = getComponentByName<FlowChannel1Phase>(comp_name);
59 }
60 }
61}
62
63void
65{
67
68 // Check that there are exactly 2 connections
70}
71
72void
74{
77
78 // Add user object for computing and storing the fluxes
79 {
80 const std::string class_name = "ADJunctionOneToOne1PhaseUserObject";
81 InputParameters params = _factory.getValidParams(class_name);
82 params.set<std::vector<BoundaryName>>("boundary") = _boundary_names;
83 params.set<std::vector<Real>>("normals") = _normals;
84 params.set<std::vector<processor_id_type>>("processor_ids") = getConnectedProcessorIDs();
85 params.set<UserObjectName>("fluid_properties") = _fp_name;
86 // It is assumed that each channel should have the same numerical flux, so
87 // just use the first one.
88 params.set<UserObjectName>("numerical_flux") = _numerical_flux_names[0];
89 params.set<std::vector<VariableName>>("A_elem") = {FlowModel::AREA};
90 params.set<std::vector<VariableName>>("A_linear") = {FlowModel::AREA_LINEAR};
91 params.set<std::vector<VariableName>>("rhoA") = {FlowModelSinglePhase::RHOA};
92 params.set<std::vector<VariableName>>("rhouA") = {FlowModelSinglePhase::RHOUA};
93 params.set<std::vector<VariableName>>("rhoEA") = {FlowModelSinglePhase::RHOEA};
94 params.set<std::string>("junction_name") = name();
95 params.set<MooseEnum>("scheme") = _slope_reconstruction;
96 params.set<ExecFlagEnum>("execute_on") = execute_on;
97 getTHMProblem().addUserObject(class_name, _junction_uo_name, params);
98 }
99
100 const std::vector<NonlinearVariableName> var_names = {
102
103 // Add BC to each of the connected flow channels
104 for (std::size_t i = 0; i < _boundary_names.size(); i++)
105 for (std::size_t j = 0; j < var_names.size(); j++)
106 {
107 const std::string class_name = "ADJunctionOneToOne1PhaseBC";
108 InputParameters params = _factory.getValidParams(class_name);
109 params.set<std::vector<BoundaryName>>("boundary") = {_boundary_names[i]};
110 params.set<Real>("normal") = _normals[i];
111 params.set<NonlinearVariableName>("variable") = var_names[j];
112 params.set<UserObjectName>("junction_uo") = _junction_uo_name;
113 params.set<unsigned int>("connection_index") = i;
114 params.set<std::vector<VariableName>>("rhoA") = {FlowModelSinglePhase::RHOA};
115 params.set<std::vector<VariableName>>("rhouA") = {FlowModelSinglePhase::RHOUA};
116 params.set<std::vector<VariableName>>("rhoEA") = {FlowModelSinglePhase::RHOEA};
117 params.set<bool>("implicit") = getTHMProblem().getImplicitTimeIntegrationFlag();
119 class_name, genName(name(), i, var_names[j] + ":" + class_name), params);
120 }
121}
registerMooseObject("ThermalHydraulicsApp", JunctionOneToOne1Phase)
const ExecFlagType EXEC_INITIAL
const ExecFlagType EXEC_LINEAR
const ExecFlagType EXEC_NONLINEAR
const std::string name
Definition Setup.h:21
std::vector< Real > _normals
Outward normals associated with connected components.
std::vector< BoundaryName > _boundary_names
Boundary names of connected components.
void checkNumberOfConnections(const unsigned int &n_connections) const
Checks that the number of connections is equal to the supplied value.
const std::vector< Connection > & getConnections() const
Returns the vector of connections of this component.
const std::vector< processor_id_type > & getConnectedProcessorIDs()
Gets the processor IDs of the connected 1D components.
const std::vector< dof_id_type > & getConnectedElementIDs()
Gets the element IDs of the connected 1D components.
THMProblem & getTHMProblem() const
Gets the THM problem.
Definition Component.C:135
Factory & _factory
The Factory associated with the MooseApp.
Definition Component.h:497
virtual void setupMesh()
Performs mesh setup such as creating mesh or naming mesh sets.
Definition Component.h:421
virtual std::vector< std::shared_ptr< UserObject > > addUserObject(const std::string &user_object_name, const std::string &name, InputParameters &parameters)
virtual void addBoundaryCondition(const std::string &bc_name, const std::string &name, InputParameters &parameters)
InputParameters getValidParams(const std::string &name) const
const MooseEnum & getSlopeReconstruction() const
Gets the slope reconstruction option used.
Single-component, single-phase flow channel.
Base class for 1-phase flow junctions.
std::vector< UserObjectName > _numerical_flux_names
virtual void check() const override
Check the component integrity.
virtual void init() override
Initializes the component.
static InputParameters validParams()
const std::string _junction_uo_name
Name of junction user object name, if any.
UserObjectName _fp_name
Fluid property user object name.
static const std::string RHOUA
static const std::string RHOA
static const std::string RHOEA
static const std::string AREA
Definition FlowModel.h:102
static const std::string AREA_LINEAR
Definition FlowModel.h:103
void addClassDescription(const std::string &doc_string)
T & set(const std::string &name, bool quiet_mode=false)
Junction connecting one flow channel to one other flow channel for 1-phase flow.
virtual void addMooseObjects() override
JunctionOneToOne1Phase(const InputParameters &params)
MooseEnum _slope_reconstruction
Slope reconstruction option.
virtual void setupMesh() override
Performs mesh setup such as creating mesh or naming mesh sets.
virtual void init() override
Initializes the component.
virtual void check() const override
Check the component integrity.
static InputParameters validParams()
std::string genName(const std::string &prefix, unsigned int id, const std::string &suffix="") const
Build a name from a prefix, number and possible suffix.
virtual void augmentSparsity(const dof_id_type &elem_id1, const dof_id_type &elem_id2)
Hint how to augment sparsity pattern between two elements.
Definition Simulation.C:71
const bool & getImplicitTimeIntegrationFlag()
Gets the flag indicating whether an implicit time integration scheme is being used.
Definition Simulation.h:329
Interface class for 1-D slope reconstruction.
ExecFlagEnum getDefaultExecFlagEnum()