31 "This action sets up the net radiation calculation between specified sidesets.");
34 "boundary",
"The boundaries that participate in the radiative exchange.");
36 params.
addParam<std::vector<BoundaryName>>(
39 "The adiabatic boundaries that participate in the radiative exchange.");
41 params.
addParam<std::vector<BoundaryName>>(
42 "fixed_temperature_boundary",
44 "The fixed temperature boundaries that participate in the radiative exchange.");
46 params.
addParam<std::vector<FunctionName>>(
47 "fixed_boundary_temperatures", {},
"The temperatures of the fixed boundary.");
50 "Number of radiation patches per sideset.");
52 "default=-3 metis=-2 parmetis=-1 linear=0 centroid hilbert_sfc morton_sfc",
"default");
53 partitioning.addValidName(
"grid");
57 "Specifies a mesh partitioner to use when preparing the radiation patches.");
62 "Specifies the sort direction if using the centroid partitioner. "
63 "Available options: x, y, z, radial");
65 params.
addRequiredParam<VariableName>(
"temperature",
"The coupled temperature variable.");
67 "Emissivities for each boundary.");
69 MooseEnum view_factor_calculator(
"analytical ray_tracing",
"ray_tracing");
71 "view_factor_calculator", view_factor_calculator,
"The view factor calculator being used.");
74 "print_view_factor_info",
false,
"Flag to print information about computed view factors.");
75 params.
addParam<
bool>(
"normalize_view_factor",
77 "Determines if view factors are normalized to sum to one (consistent with "
78 "their definition).");
80 std::vector<BoundaryName> empty = {};
81 params.
addParam<std::vector<BoundaryName>>(
84 "The sidesets that represent symmetry lines/planes for the problem. These sidesets do not "
85 "participate in the radiative exchange"
86 "so they should not be listed in the sidesets parameter.");
90 "ray_tracing_face_type", qtypes,
"The face quadrature rule type used for ray tracing.");
92 MooseEnum qorders(
"CONSTANT FIRST SECOND THIRD FOURTH FIFTH SIXTH SEVENTH EIGHTH NINTH TENTH "
93 "ELEVENTH TWELFTH THIRTEENTH FOURTEENTH FIFTEENTH SIXTEENTH SEVENTEENTH "
94 "EIGHTTEENTH NINTEENTH TWENTIETH",
97 "ray_tracing_face_order", qorders,
"The face quadrature rule order used for ray tracing.");
102 "Order of the polar quadrature [polar angle is between ray and normal]. Must be even. Only "
103 "used if view_factor_calculator = ray_tracing.");
105 "azimuthal_quad_order",
107 "Order of the azimuthal quadrature per quadrant [azimuthal angle is measured in "
108 "a plane perpendicular to the normal]. Only used if view_factor_calculator = "
111 params.
addParam<
bool>(
"add_heat_flux_aux",
false,
"If true, add a heat flux aux variable");
113 "heat_flux_variable",
114 "Heat flux aux variable name; this must be provided if 'add_heat_flux_aux' is true");
115 params.
addParam<std::vector<SubdomainName>>(
116 "heat_flux_aux_block",
"Subdomains to use for heat flux aux if 'add_heat_flux_aux' is true");
123 _boundary_names(getParam<
std::vector<BoundaryName>>(
"boundary")),
124 _view_factor_calculator(getParam<
MooseEnum>(
"view_factor_calculator")),
125 _add_heat_flux_aux(getParam<bool>(
"add_heat_flux_aux"))
127 const auto & symmetry_names = getParam<std::vector<BoundaryName>>(
"symmetry_boundary");
131 for (
const auto & param_name : {
"polar_quad_order",
132 "azimuthal_quad_order",
133 "ray_tracing_face_type",
134 "ray_tracing_face_order"})
137 "Only used for view_factor_calculator = ray_tracing. It is ignored for this "
140 if (symmetry_names.size())
142 "Symmetry boundaries are only supported with view_factor_calculator = "
149 if (std::find(symmetry_names.begin(), symmetry_names.end(),
name) != symmetry_names.end())
153 " is present in parameter boundary and symmetry_boundary.");
162 "If 'add_heat_flux_aux' is true, then this parameter must be provided.");
168 "If 'add_heat_flux_aux' is true, then this parameter must be provided.");
171 const auto & fixed_temperature_boundaries =
172 getParam<std::vector<BoundaryName>>(
"fixed_temperature_boundary");
173 const auto & fixed_boundary_temperatures =
174 getParam<std::vector<FunctionName>>(
"fixed_boundary_temperatures");
176 if (fixed_temperature_boundaries.size() != fixed_boundary_temperatures.size())
178 "The number of entries must match the number of entries in "
179 "'fixed_temperature_boundary'.");
188 const auto boundary_names = getParam<std::vector<BoundaryName>>(param);
189 for (
const auto & bname : boundary_names)
191 paramError(param,
"The boundaries in '" + param +
"' must be a subset of 'boundary'.");
225 std::vector<BoundaryName> boundary_names;
226 for (
auto & e1 : radiation_patch_names)
228 boundary_names.push_back(e2);
230 params.
set<std::vector<BoundaryName>>(
"boundary") = boundary_names;
233 params.
set<NonlinearVariableName>(
"variable") = getParam<VariableName>(
"temperature");
238 _problem->addBoundaryCondition(
"GrayLambertNeumannBC",
"gray_lamber_neumann_bc_" +
_name, params);
244 const auto & fixed_temperature_boundaries =
245 getParam<std::vector<BoundaryName>>(
"fixed_temperature_boundary");
246 const auto & fixed_boundary_temperatures =
247 getParam<std::vector<FunctionName>>(
"fixed_boundary_temperatures");
248 const auto & temperature = getParam<VariableName>(
"temperature");
250 for (
unsigned int i = 0; i < fixed_temperature_boundaries.size(); ++i)
253 params.
set<FunctionName>(
"function") = fixed_boundary_temperatures[i];
254 params.
set<NonlinearVariableName>(
"variable") = temperature;
255 params.
set<std::vector<BoundaryName>>(
"boundary") = {fixed_temperature_boundaries[i]};
257 _problem->addBoundaryCondition(
"FunctionDirichletBC",
258 "fixed_temperature_bc_" +
_name +
"_" +
259 fixed_temperature_boundaries[i],
287 params.
set<
bool>(
"print_view_factor_info") = getParam<bool>(
"print_view_factor_info");
288 params.
set<
bool>(
"normalize_view_factor") = getParam<bool>(
"normalize_view_factor");
309 params.
set<
MooseEnum>(
"face_order") = getParam<MooseEnum>(
"ray_tracing_face_order");
310 params.
set<
MooseEnum>(
"face_type") = getParam<MooseEnum>(
"ray_tracing_face_type");
313 params.
set<
unsigned int>(
"polar_quad_order") = getParam<unsigned int>(
"polar_quad_order");
314 params.
set<
unsigned int>(
"azimuthal_quad_order") = getParam<unsigned int>(
"azimuthal_quad_order");
333 const auto & symmetry_names = getParam<std::vector<BoundaryName>>(
"symmetry_boundary");
334 if (symmetry_names.size() > 0)
337 params.
set<std::vector<BoundaryName>>(
"boundary") = symmetry_names;
347 return "ray_study_uo_" +
_name;
353 return "ray_bc_" +
_name;
359 return "symmetry_ray_bc_" +
_name;
365 return "view_factor_uo_" +
_name;
371 return "view_factor_surface_radiation_" +
_name;
380 std::vector<FunctionName> emissivity = getParam<std::vector<FunctionName>>(
"emissivity");
382 mooseError(
"emissivity parameter needs to be the same size as the boundary parameter.");
387 params.
set<std::vector<VariableName>>(
"temperature") = {getParam<VariableName>(
"temperature")};
389 std::vector<FunctionName> extended_emissivity;
391 for (
unsigned int i = 0; i <
nPatch(j); ++i)
392 extended_emissivity.push_back(emissivity[j]);
393 params.
set<std::vector<FunctionName>>(
"emissivity") = extended_emissivity;
402 const auto & fixed_T_boundary_names =
403 getParam<std::vector<BoundaryName>>(
"fixed_temperature_boundary");
406 if (!fixed_T_boundary_names.empty())
408 const auto & fixed_T_funcs = getParam<std::vector<FunctionName>>(
"fixed_boundary_temperatures");
410 std::vector<BoundaryName> fixed_T_patch_names;
411 std::vector<FunctionName> fixed_T_function_names;
412 for (
unsigned int k = 0; k < fixed_T_boundary_names.size(); ++k)
414 BoundaryName bnd_name = fixed_T_boundary_names[k];
421 mooseError(
"Fixed temperature sideset ", bnd_name,
" not present in boundary.");
428 for (
auto & e : radiation_patch_names[index])
430 fixed_T_patch_names.push_back(e);
431 fixed_T_function_names.push_back(fixed_T_funcs[k]);
434 params.
set<std::vector<BoundaryName>>(
"fixed_temperature_boundary") = fixed_T_patch_names;
435 params.
set<std::vector<FunctionName>>(
"fixed_boundary_temperatures") = fixed_T_function_names;
450std::vector<std::vector<std::string>>
453 std::vector<std::vector<std::string>> radiation_patch_names(
_boundary_names.size());
455 for (
unsigned int j = 0; j < boundary_ids.size(); ++j)
457 boundary_id_type bid = boundary_ids[j];
458 std::string base_name =
_mesh->getBoundaryName(bid);
459 std::vector<std::string> bnames;
460 for (
unsigned int i = 0; i <
nPatch(j); ++i)
462 std::stringstream ss;
463 ss << base_name <<
"_" << i;
464 bnames.push_back(ss.str());
466 radiation_patch_names[j] = bnames;
468 return radiation_patch_names;
471std::vector<std::vector<std::string>>
474 auto ad_bnd_names = getParam<std::vector<BoundaryName>>(
"adiabatic_boundary");
475 auto ft_bnd_names = getParam<std::vector<BoundaryName>>(
"fixed_temperature_boundary");
476 std::vector<std::vector<std::string>> radiation_patch_names;
478 for (
unsigned int j = 0; j < boundary_ids.size(); ++j)
480 boundary_id_type bid = boundary_ids[j];
484 auto it_a = std::find(ad_bnd_names.begin(), ad_bnd_names.end(), bnd_name);
485 auto it_t = std::find(ft_bnd_names.begin(), ft_bnd_names.end(), bnd_name);
486 if (it_a != ad_bnd_names.end() || it_t != ft_bnd_names.end())
489 std::string base_name =
_mesh->getBoundaryName(bid);
490 std::vector<std::string> bnames;
491 for (
unsigned int i = 0; i <
nPatch(j); ++i)
493 std::stringstream ss;
494 ss << base_name <<
"_" << i;
495 bnames.push_back(ss.str());
497 radiation_patch_names.push_back(bnames);
499 return radiation_patch_names;
502std::vector<BoundaryName>
504 const std::vector<BoundaryName> & boundary_names_or_ids)
const
506 std::vector<BoundaryName> patch_boundary_names;
507 std::vector<BoundaryID> ids =
_mesh->getBoundaryIDs(boundary_names_or_ids);
508 for (
const auto i : index_range(boundary_names_or_ids))
510 const auto boundary_name_or_id = boundary_names_or_ids[i];
512 mooseAssert(it !=
_boundary_names.end(), boundary_name_or_id +
" not found in 'boundary'.");
513 const auto boundary_index = std::distance(
_boundary_names.begin(), it);
514 const auto n_patches =
nPatch(boundary_index);
515 const auto boundary_name =
_mesh->getBoundaryName(ids[i]);
516 for (
const auto j : make_range(n_patches))
518 std::stringstream ss;
519 ss << boundary_name <<
"_" << j;
520 patch_boundary_names.push_back(ss.str());
523 return patch_boundary_names;
526std::vector<BoundaryName>
532std::vector<BoundaryName>
535 std::vector<BoundaryName> patch_boundary_names;
537 patch_boundary_names =
539 return patch_boundary_names;
545 std::vector<unsigned int> n_patches = getParam<std::vector<unsigned int>>(
"n_patches");
546 MultiMooseEnum partitioners = getParam<MultiMooseEnum>(
"partitioners");
549 partitioners.clearSetValues();
551 partitioners.setAdditionalValue(
"metis");
554 MultiMooseEnum direction = getParam<MultiMooseEnum>(
"centroid_partitioner_directions");
558 mooseError(
"n_patches parameter must have same length as boundary parameter.");
561 mooseError(
"partitioners parameter must have same length as boundary parameter.");
563 for (
unsigned int j = 0; j < partitioners.size(); ++j)
566 "centroid partitioner is selected for at least one sideset. "
567 "centroid_partitioner_directions parameter must have same length as boundary parameter.");
570 std::shared_ptr<MeshGeneratorMesh> mg_mesh = std::dynamic_pointer_cast<MeshGeneratorMesh>(
_mesh);
572 mooseError(
"This action adds MeshGenerator objects and therefore only works with a "
573 "MeshGeneratorMesh.");
579 params.
set<
unsigned int>(
"n_patches") = n_patches[j];
582 if (partitioners[j] ==
"centroid")
583 params.
set<
MooseEnum>(
"centroid_partitioner_direction") = direction[j];
595 mooseError(
"Failed to convert mesh generator ", mg->
name(),
" to PatchSidesetGenerator.");
602 std::stringstream ss;
610 const std::string var_type =
"MooseVariable";
613 params.set<
MooseEnum>(
"order") =
"CONSTANT";
614 params.set<
MooseEnum>(
"family") =
"MONOMIAL";
621 const std::string class_name =
"GrayLambertRadiationHeatFluxAux";
627 _problem->addAuxKernel(class_name,
"radiation_heat_flux_aux_kernel", params);
const ExecFlagType EXEC_TIMESTEP_END
const ExecFlagType EXEC_INITIAL
const ExecFlagType EXEC_LINEAR
registerMooseAction("HeatTransferApp", RadiationTransferAction, "append_mesh_generator")
std::shared_ptr< MooseMesh > & _mesh
static InputParameters validParams()
std::shared_ptr< FEProblemBase > & _problem
const std::string & _current_task
InputParameters getValidParams(const std::string &name) const
const MeshGenerator & appendMeshGenerator(const std::string &type, const std::string &name, InputParameters params)
const MeshGenerator & getMeshGenerator(const std::string &name) const
void paramWarning(const std::string ¶m, Args... args) const
const std::string & name() const
void paramError(const std::string ¶m, Args... args) const
void mooseError(Args &&... args) const
const InputParameters & _pars
const std::string & _name
const T & getParam(const std::string &name) const
bool isParamValid(const std::string &name) const
unsigned int size() const
Subdivides a sidesets into smaller patches each of which is going to be a new patch.
unsigned int nPatches() const
std::vector< std::vector< std::string > > radiationPatchNames() const
virtual void act() override
std::string rayBCName() const
static InputParameters validParams()
const bool _add_heat_flux_aux
Whether to add heat flux aux.
void addHeatFluxAuxVariable() const
std::string symmetryRayBCName() const
const MooseEnum _view_factor_calculator
the type of view factor calculation being performed
std::vector< std::vector< std::string > > bcRadiationPatchNames() const
UserObjectName radiationObjectName() const
void addHeatFluxAuxKernel() const
std::vector< BoundaryName > radiationPatchBoundaryNames() const
VariableName _heat_flux_variable
Heat flux aux name.
std::vector< BoundaryName > adiabaticPatchBoundaryNames() const
const std::vector< BoundaryName > _boundary_names
the boundary names participating in the radiative heat transfer
UserObjectName viewFactorObjectName() const
MeshGeneratorName meshGeneratorName(unsigned int j) const
void addViewFactorObject() const
std::vector< BoundaryName > patchBoundaryNames(const std::vector< BoundaryName > &boundary_names) const
void addRadiationObject() const
void checkBoundaryParameterIsSubset(const std::string ¶m) const
Checks that param boundaries are in the 'boundary' parameter.
RadiationTransferAction(const InputParameters ¶ms)
UserObjectName rayStudyName() const
std::vector< SubdomainName > _heat_flux_aux_block
Blocks to use for heat flux aux.
unsigned int nPatch(unsigned int j) const
provides the updated number of patches for this boundary
void addRadiationBCs() const
void addRayStudyObject() const
void addFixedTemperatureBCs() const
Base class for the RayBC syntax.
Base class for Ray tracing studies that will generate Rays and then propagate all of them to terminat...
const T & getUserObject(const std::string ¶m_name, bool is_dependency=true) const
RayTracingStudy used to generate Rays for view factor computation using the angular quadrature method...
ExecFlagEnum getDefaultExecFlagEnum()