29 params.
set<std::string>(
"flow_channel",
true) =
"";
31 "flow_channels",
"List of flow channel component names to connect to");
33 "boundary",
"The name of the heat structure boundary this heat transfer is applied on.");
35 params.
addClassDescription(
"Connects multiple 1-phase flow channels and a 3D heat structure");
43 _flow_channel_names(getParam<
std::vector<
std::string>>(
"flow_channels")),
44 _boundary(getParam<BoundaryName>(
"boundary")),
45 _hs_name(getParam<
std::string>(
"hs")),
46 _mesh_alignment(constMesh()),
47 _layered_average_uo_direction(
MooseEnum(
"x y z"))
63 if (hasComponentByName<HeatStructureFromFile3D>(
_hs_name))
65 std::vector<dof_id_type> fchs_elem_ids;
69 if (hasComponentByName<FlowChannel1Phase>(fch_name))
71 const FlowChannel1Phase & flow_channel = getComponentByName<FlowChannel1Phase>(fch_name);
72 fchs_elem_ids.insert(fchs_elem_ids.end(),
78 const auto & hs = getComponentByName<HeatStructureFromFile3D>(
_hs_name);
83 for (
const auto & fc_elem_id : fchs_elem_ids)
88 for (
const auto & hs_elem_id : hs_elem_ids)
98 const std::string & flow_channel_name)
const 100 const FlowChannel1Phase & flow_channel = getComponentByName<FlowChannel1Phase>(flow_channel_name);
105 if (x_dir_norm == 1 && y_dir_norm == 0 && z_dir_norm == 0)
106 return EAxisAlignment::X;
107 else if (x_dir_norm == 0 && y_dir_norm == 1 && z_dir_norm == 0)
108 return EAxisAlignment::Y;
109 else if (x_dir_norm == 0 && y_dir_norm == 0 && z_dir_norm == 1)
114 "The flow channel '", flow_channel_name,
"' must be aligned with the x-, y-, or z- axis.");
115 return EAxisAlignment::INVALID;
124 std::vector<EAxisAlignment> fch_axis_alignment;
125 std::vector<unsigned int> fch_num_elems;
126 std::vector<Real> fch_lengths;
129 checkComponentOfTypeExistsByName<FlowChannel1Phase>(fch_name);
131 if (hasComponentByName<FlowChannel1Phase>(fch_name))
133 const FlowChannel1Phase & flow_channel = getComponentByName<FlowChannel1Phase>(fch_name);
145 fch_num_elems.push_back(flow_channel.
getNumElems());
147 fch_lengths.push_back(flow_channel.
getLength());
152 if (fch_axis_alignment.size() > 1)
154 for (
unsigned int i = 1; i < fch_axis_alignment.size(); i++)
155 if (fch_axis_alignment[i] != fch_axis_alignment[0])
158 "' has a different axis alignment (",
159 fch_axis_alignment[i],
160 "). Make sure all flow channels are aligned with the same axis.");
162 if (fch_axis_alignment.size() > 0 && fch_axis_alignment[0] != EAxisAlignment::INVALID)
166 if (fch_num_elems.size() > 1)
168 for (
unsigned int i = 1; i < fch_num_elems.size(); i++)
169 if (fch_num_elems[i] != fch_num_elems[0])
174 " elements which is inconsistent with the rest of the flow channels. Make sure " 175 "all flow channels have the same number of elements.");
177 if (fch_num_elems.size() > 0)
181 if (fch_lengths.size() > 1)
183 for (
unsigned int i = 1; i < fch_lengths.size(); i++)
184 if (fch_lengths[i] != fch_lengths[0])
187 "' has length equal to ",
189 " which is inconsistent with the rest of the flow channels. Make sure all flow " 190 "channels have the length.");
201 if (hasComponentByName<FlowChannel1Phase>(fch_name))
203 const FlowChannel1Phase & flow_channel = getComponentByName<FlowChannel1Phase>(fch_name);
222 clsr->checkHeatTransfer(*
this, getComponentByName<FlowChannel1Phase>(
_flow_channel_names[i]));
225 if (hasComponentByName<HeatStructureFromFile3D>(
_hs_name))
227 const auto & hs = getComponentByName<HeatStructureFromFile3D>(
_hs_name);
232 logError(
"The component '",
_hs_name,
"' is not a HeatStructureFromFile3D component.");
275 std::vector<Point> fch_positions;
278 const FlowChannel1Phase & flow_channel = getComponentByName<FlowChannel1Phase>(fch_name);
279 fch_positions.push_back(flow_channel.
getPosition());
282 const UserObjectName T_wall_avg_uo_name =
genName(
name(),
"T_wall_avg_uo");
284 const std::string class_name =
"NearestPointLayeredSideAverage";
287 params.
set<std::vector<BoundaryName>>(
"boundary") = {
_boundary};
291 params.
set<std::vector<Point>>(
"points") = fch_positions;
295 std::string class_name =
"SpatialUserObjectAux";
300 params.
set<UserObjectName>(
"user_object") = T_wall_avg_uo_name;
304 const std::string class_name =
"ADOneD3EqnEnergyHeatFluxFromHeatStructure3D";
307 params.
set<std::vector<VariableName>>(
"P_hf") = {
_P_hf_name};
309 params.
set<UserObjectName>(
"user_object") = T_wall_avg_uo_name;
315 const UserObjectName heat_transfer_uo_name =
genName(
name(),
"heat_flux_uo");
317 const std::string class_name =
"ADHeatTransferFromHeatStructure3D1PhaseUserObject";
321 params.
set<std::vector<VariableName>>(
"P_hf") = {
_P_hf_name};
328 const std::string class_name =
"ADConvectionHeatTransfer3DBC";
330 params.
set<std::vector<BoundaryName>>(
"boundary") = {
_boundary};
332 params.
set<UserObjectName>(
"ht_uo") = heat_transfer_uo_name;
virtual void initSecondary() override
Perform secondary initialization, which relies on init() being called for all components.
virtual Point getPosition() const
virtual void setupMesh() override
Performs mesh setup such as creating mesh or naming mesh sets.
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.
unsigned int _num_layers
Number of layers in the flow channel direction.
VariableName _T_wall_name
wall temperature name
static const std::string TEMPERATURE
THMProblem & getTHMProblem() const
Gets the THM problem.
void addDependency(const std::string &dependency)
Adds a component name to the list of dependencies.
std::vector< std::shared_ptr< ClosuresBase > > getClosuresObjects() const
Get the used closures object(s)
Heat structure component that loads the mesh from an ExodusII file.
const std::vector< dof_id_type > & getElementIDs() const
Gets the element IDs corresponding to this component.
void initialize(const std::vector< dof_id_type > &primary_elem_ids, const std::vector< std::tuple< dof_id_type, unsigned short int >> &secondary_boundary_info)
Extracts mesh information and builds the mapping.
FunctionName getInitialT() const
Gets the initial temperature function name.
virtual RealVectorValue getDirection() const
InputParameters getValidParams(const std::string &name) const
static const std::string HEAT_TRANSFER_COEFFICIENT_WALL
registerMooseObject("ThermalHydraulicsApp", HeatTransferFromHeatStructure3D1Phase)
EAxisAlignment
enum for axis alignment
virtual void addVariables() override
virtual void addAuxKernel(const std::string &kernel_name, const std::string &name, InputParameters ¶meters)
virtual void addKernel(const std::string &kernel_name, const std::string &name, InputParameters ¶meters)
virtual Real getLength() const
MaterialPropertyName _Hw_1phase_name
1-phase wall heat transfer coefficient name
virtual const libMesh::FEType & getFEType() override
Get the FE type for wall temperature variable.
bool isRestarting() const
virtual void addMooseObjects() override
virtual const std::string & name() const
HeatTransferFromHeatStructure3D1Phase(const InputParameters ¶meters)
const std::vector< std::string > & _flow_channel_names
name of the connected flow channel
void addFunctionIC(const VariableName &var_name, const std::string &func_name, const std::vector< SubdomainName > &block_names)
virtual void addBoundaryCondition(const std::string &bc_name, const std::string &name, InputParameters ¶meters)
ExecFlagEnum getDefaultExecFlagEnum()
void logError(Args &&... args) const
Logs an error.
virtual void init() override
Initializes the component.
VariableName _P_hf_name
heated perimeter name
virtual void check() const
Check the component integrity.
virtual void check() const override
Check the component integrity.
void addSimVariable(bool nl, const VariableName &name, libMesh::FEType fe_type, Real scaling_factor=1.0)
Queues a variable of type MooseVariableScalar to be added to the nonlinear or aux system...
TypeVector< Real > unit() const
Single-component, single-phase flow channel.
static const std::string TEMPERATURE_WALL
virtual EAxisAlignment getFlowChannelAxisAlignment(const std::string &flow_channel_name) const
static const std::string TEMPERATURE
void addHeatTransferName(const std::string &ht_name) const
Adds the name of a heat transfer component to the flow channel's list.
static InputParameters validParams()
virtual void addMooseObjects() override
MooseEnum _layered_average_uo_direction
Direction for layered average user objects.
virtual void init()
Initializes the component.
const ExecFlagType EXEC_LINEAR
virtual void initSecondary()
Perform secondary initialization, which relies on init() being called for all components.
Base class for heat transfer connections from temperature for 1-phase flow.
static const libMesh::FEType & feType()
Get the FE type used for heat conduction.
std::vector< std::shared_ptr< ClosuresBase > > _flow_channel_closures
Closures associated with each flow channel.
const ExecFlagType EXEC_NONLINEAR
static const std::string HEAT_FLUX_PERIMETER
static const std::string Z
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
MaterialPropertyName _q_wall_name
wall heat flux name
static InputParameters validParams()
Factory & _factory
The Factory associated with the MooseApp.
virtual std::vector< std::shared_ptr< UserObject > > addUserObject(const std::string &user_object_name, const std::string &name, InputParameters ¶meters)
FunctionName _P_hf_fn_name
heated perimeter function name
static const std::string HEAT_FLUX_WALL
MeshAlignment1D3D _mesh_alignment
Mesh alignment object.
std::string getHeatTransferNamesSuffix(const std::string &ht_name) const
Gets suffix to add to heat-transfer-related names in a heat transfer component.
virtual Real getNumElems() const
const BoundaryName & _boundary
Boundary names for which the boundary component applies.
static const std::string RHOEA
const std::vector< dof_id_type > & getCoupledSecondaryElemIDs(const dof_id_type &primary_elem_id) const
Gets the coupled secondary element IDs for a given primary element ID.
virtual const std::vector< SubdomainName > & getSubdomainNames() const
Gets the subdomain names for this component.
std::vector< SubdomainName > _flow_channel_subdomains
Subdomains corresponding to the connected flow channel.
Connects a 1-phase flow channel and a 3D heat structure.
Builds mapping between a 1D subdomain and a 3D boundary.
virtual void augmentSparsity(const dof_id_type &elem_id1, const dof_id_type &elem_id2)
Hint how to augment sparsity pattern between two elements.
const std::string & _hs_name
Heat structure name.
bool hasCoupledSecondaryElemIDs(const dof_id_type &primary_elem_id) const
Returns true if the given primary element ID has coupled secondary elements.
const ExecFlagType EXEC_INITIAL