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);
101 RealVectorValue direction = flow_channel.
getDirection().unit();
102 Real x_dir_norm = std::abs(direction * RealVectorValue(1, 0, 0));
103 Real y_dir_norm = std::abs(direction * RealVectorValue(0, 1, 0));
104 Real z_dir_norm = std::abs(direction * RealVectorValue(0, 0, 1));
105 if (x_dir_norm == 1 && y_dir_norm == 0 && z_dir_norm == 0)
107 else if (x_dir_norm == 0 && y_dir_norm == 1 && z_dir_norm == 0)
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.");
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.");
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;
registerMooseObject("ThermalHydraulicsApp", HeatTransferFromHeatStructure3D1Phase)
const ExecFlagType EXEC_INITIAL
const ExecFlagType EXEC_LINEAR
const ExecFlagType EXEC_NONLINEAR
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.
const std::vector< dof_id_type > & getElementIDs() const
Gets the element IDs corresponding to this component.
void addDependency(const std::string &dependency)
Adds a component name to the list of dependencies.
THMProblem & getTHMProblem() const
Gets the THM problem.
Factory & _factory
The Factory associated with the MooseApp.
virtual void check() const
Check the component integrity.
virtual void initSecondary()
Perform secondary initialization, which relies on init() being called for all components.
virtual Real getNumElems() const
virtual Real getLength() const
virtual RealVectorValue getDirection() const
virtual Point getPosition() const
virtual std::vector< std::shared_ptr< UserObject > > addUserObject(const std::string &user_object_name, const std::string &name, InputParameters ¶meters)
virtual void addBoundaryCondition(const std::string &bc_name, const std::string &name, InputParameters ¶meters)
virtual void addKernel(const std::string &kernel_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
Single-component, single-phase flow channel.
std::vector< std::shared_ptr< ClosuresBase > > getClosuresObjects() const
Get the used closures object(s)
void addHeatTransferName(const std::string &ht_name) const
Adds the name of a heat transfer component to the flow channel's list.
std::string getHeatTransferNamesSuffix(const std::string &ht_name) const
Gets suffix to add to heat-transfer-related names in a heat transfer component.
static const std::string HEAT_TRANSFER_COEFFICIENT_WALL
static const std::string TEMPERATURE
static const std::string RHOEA
static const std::string HEAT_FLUX_WALL
static const std::string TEMPERATURE_WALL
static const std::string HEAT_FLUX_PERIMETER
static const libMesh::FEType & feType()
Get the FE type used for heat conduction.
static const std::string TEMPERATURE
Heat structure component that loads the mesh from an ExodusII file.
FunctionName getInitialT() const
Gets the initial temperature function name.
MaterialPropertyName _Hw_1phase_name
1-phase wall heat transfer coefficient name
virtual void addMooseObjects() override
MaterialPropertyName _q_wall_name
wall heat flux name
VariableName _P_hf_name
heated perimeter name
VariableName _T_wall_name
wall temperature name
FunctionName _P_hf_fn_name
heated perimeter function name
std::vector< SubdomainName > _flow_channel_subdomains
Subdomains corresponding to the connected flow channel.
Connects a 1-phase flow channel and a 3D heat structure.
MooseEnum _layered_average_uo_direction
Direction for layered average user objects.
virtual void addMooseObjects() override
virtual EAxisAlignment getFlowChannelAxisAlignment(const std::string &flow_channel_name) const
virtual void setupMesh() override
Performs mesh setup such as creating mesh or naming mesh sets.
virtual void check() const override
Check the component integrity.
const std::vector< std::string > & _flow_channel_names
name of the connected flow channel
EAxisAlignment
enum for axis alignment
virtual void initSecondary() override
Perform secondary initialization, which relies on init() being called for all components.
HeatTransferFromHeatStructure3D1Phase(const InputParameters ¶meters)
static InputParameters validParams()
std::vector< std::shared_ptr< ClosuresBase > > _flow_channel_closures
Closures associated with each flow channel.
const BoundaryName & _boundary
Boundary names for which the boundary component applies.
const std::string & _hs_name
Heat structure name.
virtual const libMesh::FEType & getFEType() override
Get the FE type for wall temperature variable.
MeshAlignment1D3D _mesh_alignment
Mesh alignment object.
virtual void addVariables() override
unsigned int _num_layers
Number of layers in the flow channel direction.
virtual void init() override
Initializes the component.
Base class for heat transfer connections from temperature for 1-phase flow.
static InputParameters validParams()
Builds mapping between a 1D subdomain and a 3D boundary.
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.
bool hasCoupledSecondaryElemIDs(const dof_id_type &primary_elem_id) const
Returns true if the given primary element ID has coupled secondary elements.
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.
bool isRestarting() 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.
virtual void augmentSparsity(const dof_id_type &elem_id1, const dof_id_type &elem_id2)
Hint how to augment sparsity pattern between two elements.
void addFunctionIC(const VariableName &var_name, const std::string &func_name, const std::vector< SubdomainName > &block_names)
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.
ExecFlagEnum getDefaultExecFlagEnum()