16#include "libmesh/edge_edge2.h"
17#include "libmesh/edge_edge3.h"
19const std::map<std::string, FlowChannelBase::EConvHeatTransGeom>
21 {
"PIPE", PIPE}, {
"ROD_BUNDLE", ROD_BUNDLE}, {
"HEX_ROD_BUNDLE", HEX_ROD_BUNDLE}};
24 {
"STRAIGHT", STRAIGHT}, {
"CURVED", CURVED}, {
"DOWNCOMER", DOWNCOMER}};
27 {
"INTERIOR", INTERIOR}, {
"EDGE",
EDGE}, {
"CORNER",
CORNER}};
51 return stringToEnum<FlowChannelBase::EConvHeatTransGeom>(
75 params.
addRequiredParam<UserObjectName>(
"fp",
"Fluid properties user object");
77 "A",
"Area of the flow channel, can be a constant or a function");
78 params.
addParam<Real>(
"roughness", 0.0,
"Roughness [m]");
79 params.
addParam<FunctionName>(
"f",
"Wall friction factor [-]");
82 "Convective heat transfer geometry");
85 "Pipe location within the bundle");
86 params.
addParam<Real>(
"PoD", 1,
"Pitch-to-diameter ratio for parallel bundle heat transfer [-]");
88 "pipe_pars_transferred",
90 "Set to true if Dh, P_hf and A are going to be transferred in from an external source");
91 params.
addParam<std::vector<std::string>>(
94 "Closures object(s). This is optional since closure relations can be supplied directly by "
95 "Materials as well.");
96 params.
addParam<
bool>(
"name_multiple_ht_by_index",
98 "If true, when there are multiple heat transfer components connected to "
99 "this flow channel, use their index for naming related quantities; "
100 "otherwise, use the name of the heat transfer component.");
101 params.
addParam<std::vector<VariableName>>(
102 "vpp_vars", {},
"Variables to add in an ElementValueSampler");
106 "Direction of flow channel from start position to end position (no need to normalize). For "
107 "curved flow channels, it is the (tangent) direction at the start position.");
118 _flow_model(nullptr),
119 _fp_name(getParam<UserObjectName>(
"fp")),
120 _gravity_angle(
MooseUtils::absoluteFuzzyEqual(_gravity_magnitude, 0.0)
122 :
std::acos(_dir * _gravity_vector / (_dir.norm() * _gravity_magnitude)) *
124 _pipe_pars_transferred(getParam<bool>(
"pipe_pars_transferred")),
125 _roughness(getParam<Real>(
"roughness")),
127 _pipe_location(getEnumParam<
EPipeLocation>(
"pipe_location")),
128 _PoD(getParam<Real>(
"PoD")),
129 _has_PoD(isParamValid(
"PoD")),
130 _temperature_mode(false),
131 _n_heat_transfer_connections(0)
135std::shared_ptr<const FlowModel>
155 return getParam<FunctionName>(
"A");
170 const auto & closures_names = getParam<std::vector<std::string>>(
"closures");
171 for (
const auto & closures_name : closures_names)
201 closures->checkFlowChannel(*
this);
210 logError(
"Heat sources for a flow channel must be all of temperature type or all of heat "
227 const std::string class_name =
"SumIC";
245 std::string class_name =
"DirectionMaterial";
255 std::string class_name =
"FunctionAux";
261 const std::string aux_kernel_name =
genName(
name(),
"area_linear_aux");
265 const std::string class_name =
"ProjectionAux";
271 const std::string aux_kernel_name =
genName(
name(),
"area_aux");
288 const std::string class_name =
"SumAux";
302 const std::string class_name =
"ADWeightedAverageMaterial";
313 const std::string class_name =
"ADConstantMaterial";
317 params.
set<Real>(
"value") = 0;
323 const auto & vpp_vars = getParam<std::vector<VariableName>>(
"vpp_vars");
324 if (vpp_vars.size() > 0)
326 const std::string class_name =
"ElementValueSampler";
329 params.
set<std::vector<VariableName>>(
"variable") = vpp_vars;
330 params.
set<std::string>(
"sort_by") =
sortBy();
338 closures->addMooseObjectsFlowChannel(*
this);
377 std::string suffix =
":";
378 if (getParam<bool>(
"name_multiple_ht_by_index"))
379 suffix += std::to_string(index + 1);
387 "Heat transfer component '", ht_name,
"' was not added to flow channel '",
name(),
"'");
394std::vector<std::string>
const ExecFlagType EXEC_TIMESTEP_END
const ExecFlagType EXEC_TIMESTEP_BEGIN
const ExecFlagType EXEC_INITIAL
const ExecFlagType EXEC_LINEAR
Base class for 1D components.
static InputParameters validParams()
std::string sortBy() const
virtual void init()
Initializes the component.
virtual const std::vector< SubdomainName > & getSubdomainNames() const
Gets the subdomain names for this component.
void logError(Args &&... args) const
Logs an error.
THMProblem & getTHMProblem() const
Gets the THM problem.
Factory & _factory
The Factory associated with the MooseApp.
virtual void check() const
Check the component integrity.
@ INITIALIZED_PRIMARY
mesh set up, called primary init
virtual void initSecondary()
Perform secondary initialization, which relies on init() being called for all components.
void checkSetupStatus(const EComponentSetupStatus &status) const
Throws an error if the supplied setup status of this component has not been reached.
virtual void addMaterial(const std::string &material_name, const std::string &name, InputParameters ¶meters)
virtual void addVectorPostprocessor(const std::string &pp_name, const std::string &name, InputParameters ¶meters)
virtual void addAuxKernel(const std::string &kernel_name, const std::string &name, InputParameters ¶meters)
InputParameters getValidParams(const std::string &name) const
virtual void check() const override
Check the component integrity.
static MooseEnum getConvHeatTransGeometry(const std::string &name)
Gets a MooseEnum for convective heat transfer geometry type.
std::vector< VariableName > _P_hf_names
heated perimeter names for connected heat transfers
FunctionName _area_function
Function describing the flow channel area.
virtual void init() override
Initializes the component.
virtual std::shared_ptr< FlowModel > buildFlowModel()=0
std::vector< std::shared_ptr< ClosuresBase > > _closures_objects
Closures object(s)
EConvHeatTransGeom
Type of convective heat transfer geometry.
const FunctionName & getAreaFunctionName() const
Get the name of the function describing the flow channel area.
EPipeLocation getPipeLocation() const
Gets the pipe location.
std::shared_ptr< FlowModel > _flow_model
The flow model used by this flow channel.
virtual FunctionName createAreaFunctionAndGetName()
Creates the area function if needed and then stores the name.
static MooseEnum getPipeType(const std::string &name)
Gets a MooseEnum for pipe type.
const bool & _pipe_pars_transferred
std::vector< std::string > getHeatTransferNames() const
Gets the names of all connected heat transfer components.
std::vector< MaterialPropertyName > _q_wall_names
wall heat flux names for connected heat transfers
unsigned int _n_heat_transfer_connections
Number of connected heat transfer components.
void addHeatTransferName(const std::string &ht_name) const
Adds the name of a heat transfer component to the flow channel's list.
FlowChannelBase(const InputParameters ¶ms)
std::vector< VariableName > _T_wall_names
wall temperature auxvariable names for connected heat transfers
virtual void initSecondary() override
Perform secondary initialization, which relies on init() being called for all components.
static const std::map< std::string, EPipeLocation > _pipe_location_to_enum
Map of pipe location to enum.
static const std::map< std::string, EConvHeatTransGeom > _heat_transfer_geom_to_enum
Map of convective heat transfer geometry type to enum.
EPipeLocation
Pipe location.
std::string getHeatTransferNamesSuffix(const std::string &ht_name) const
Gets suffix to add to heat-transfer-related names in a heat transfer component.
virtual void addCommonObjects()
Adds objects which are common for single- and two-phase flow.
static InputParameters validParams()
virtual void addVariables() override
virtual std::shared_ptr< const FlowModel > getFlowModel() const
static const std::map< std::string, EPipeType > _pipe_type_to_enum
Map of pipe type to enum.
std::vector< MaterialPropertyName > _T_wall_mat_names
wall temperature material names for connected heat transfers
std::vector< std::string > _heat_transfer_names
Names of the heat transfer components connected to this component.
virtual void addMooseObjects() override
bool _temperature_mode
True if there is one or more sources specified by wall temperature.
virtual void getHeatTransferVariableNames()
Populates heat connection variable names lists.
static const std::string HEAT_FLUX_WALL
static const std::string AREA
static const std::string AREA_LINEAR
static const std::string HEAT_FLUX_PERIMETER
Interface for specifying gravity at the component level.
static InputParameters validParams()
Base class for heat transfer connections.
const MaterialPropertyName & getWallHeatFluxName() const
Returns wall heat flux name.
const VariableName & getWallTemperatureName() const
Returns wall temperature name.
const VariableName & getHeatedPerimeterName() const
Returns heated perimeter name.
virtual bool isTemperatureType() const =0
Returns whether this heat transfer is specified by temperature, rather than heat flux.
const MaterialPropertyName & getWallTemperatureMatName() const
Returns wall temperature name.
bool isRestarting() const
void mooseError(Args &&... args) const
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.
std::shared_ptr< ClosuresBase > getClosures(const std::string &name) const
Get a pointer to a closures object.
void addSimInitialCondition(const std::string &type, const std::string &name, InputParameters params)
ExecFlagEnum getDefaultExecFlagEnum()
Component1DConnection::EEndType stringToEnum(const std::string &s)