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.");
178 const auto boundary_names = getParam<std::vector<BoundaryName>>(param);
179 for (
const auto & bname : boundary_names)
181 paramError(param,
"The boundaries in '" + param +
"' must be a subset of 'boundary'.");
212 std::vector<BoundaryName> boundary_names;
213 for (
auto & e1 : radiation_patch_names)
215 boundary_names.push_back(e2);
217 params.
set<std::vector<BoundaryName>>(
"boundary") = boundary_names;
220 params.
set<NonlinearVariableName>(
"variable") = getParam<VariableName>(
"temperature");
225 _problem->addBoundaryCondition(
"GrayLambertNeumannBC",
"gray_lamber_neumann_bc_" +
_name, params);
251 params.
set<
bool>(
"print_view_factor_info") = getParam<bool>(
"print_view_factor_info");
252 params.
set<
bool>(
"normalize_view_factor") = getParam<bool>(
"normalize_view_factor");
273 params.
set<
MooseEnum>(
"face_order") = getParam<MooseEnum>(
"ray_tracing_face_order");
274 params.
set<
MooseEnum>(
"face_type") = getParam<MooseEnum>(
"ray_tracing_face_type");
277 params.
set<
unsigned int>(
"polar_quad_order") = getParam<unsigned int>(
"polar_quad_order");
278 params.
set<
unsigned int>(
"azimuthal_quad_order") = getParam<unsigned int>(
"azimuthal_quad_order");
297 const auto & symmetry_names = getParam<std::vector<BoundaryName>>(
"symmetry_boundary");
298 if (symmetry_names.size() > 0)
301 params.
set<std::vector<BoundaryName>>(
"boundary") = symmetry_names;
311 return "ray_study_uo_" +
_name;
317 return "ray_bc_" +
_name;
323 return "symmetry_ray_bc_" +
_name;
329 return "view_factor_uo_" +
_name;
335 return "view_factor_surface_radiation_" +
_name;
344 std::vector<FunctionName> emissivity = getParam<std::vector<FunctionName>>(
"emissivity");
346 mooseError(
"emissivity parameter needs to be the same size as the boundary parameter.");
351 params.
set<std::vector<VariableName>>(
"temperature") = {getParam<VariableName>(
"temperature")};
353 std::vector<FunctionName> extended_emissivity;
355 for (
unsigned int i = 0; i <
nPatch(j); ++i)
356 extended_emissivity.push_back(emissivity[j]);
357 params.
set<std::vector<FunctionName>>(
"emissivity") = extended_emissivity;
370 mooseError(
"fixed_temperature_boundary is provided so fixed_boundary_temperatures must be "
373 std::vector<BoundaryName> fixed_T_boundary_names =
374 getParam<std::vector<BoundaryName>>(
"fixed_temperature_boundary");
376 std::vector<FunctionName> fixed_T_funcs =
377 getParam<std::vector<FunctionName>>(
"fixed_boundary_temperatures");
380 if (fixed_T_funcs.size() != fixed_T_boundary_names.size())
381 mooseError(
"Size of parameter fixed_boundary_temperatures and fixed_temperature_boundary "
384 std::vector<BoundaryName> fixed_T_patch_names;
385 std::vector<FunctionName> fixed_T_function_names;
386 for (
unsigned int k = 0; k < fixed_T_boundary_names.size(); ++k)
388 BoundaryName bnd_name = fixed_T_boundary_names[k];
395 mooseError(
"Fixed temperature sideset ", bnd_name,
" not present in boundary.");
402 for (
auto & e : radiation_patch_names[index])
404 fixed_T_patch_names.push_back(e);
405 fixed_T_function_names.push_back(fixed_T_funcs[k]);
408 params.
set<std::vector<BoundaryName>>(
"fixed_temperature_boundary") = fixed_T_patch_names;
409 params.
set<std::vector<FunctionName>>(
"fixed_boundary_temperatures") = fixed_T_function_names;
424std::vector<std::vector<std::string>>
427 std::vector<std::vector<std::string>> radiation_patch_names(
_boundary_names.size());
429 for (
unsigned int j = 0; j < boundary_ids.size(); ++j)
431 boundary_id_type bid = boundary_ids[j];
432 std::string base_name =
_mesh->getBoundaryName(bid);
433 std::vector<std::string> bnames;
434 for (
unsigned int i = 0; i <
nPatch(j); ++i)
436 std::stringstream ss;
437 ss << base_name <<
"_" << i;
438 bnames.push_back(ss.str());
440 radiation_patch_names[j] = bnames;
442 return radiation_patch_names;
445std::vector<std::vector<std::string>>
448 auto ad_bnd_names = getParam<std::vector<BoundaryName>>(
"adiabatic_boundary");
449 auto ft_bnd_names = getParam<std::vector<BoundaryName>>(
"fixed_temperature_boundary");
450 std::vector<std::vector<std::string>> radiation_patch_names;
452 for (
unsigned int j = 0; j < boundary_ids.size(); ++j)
454 boundary_id_type bid = boundary_ids[j];
458 auto it_a = std::find(ad_bnd_names.begin(), ad_bnd_names.end(), bnd_name);
459 auto it_t = std::find(ft_bnd_names.begin(), ft_bnd_names.end(), bnd_name);
460 if (it_a != ad_bnd_names.end() || it_t != ft_bnd_names.end())
463 std::string base_name =
_mesh->getBoundaryName(bid);
464 std::vector<std::string> bnames;
465 for (
unsigned int i = 0; i <
nPatch(j); ++i)
467 std::stringstream ss;
468 ss << base_name <<
"_" << i;
469 bnames.push_back(ss.str());
471 radiation_patch_names.push_back(bnames);
473 return radiation_patch_names;
476std::vector<BoundaryName>
478 const std::vector<BoundaryName> & boundary_names_or_ids)
const
480 std::vector<BoundaryName> patch_boundary_names;
481 std::vector<BoundaryID> ids =
_mesh->getBoundaryIDs(boundary_names_or_ids);
482 for (
const auto i : index_range(boundary_names_or_ids))
484 const auto boundary_name_or_id = boundary_names_or_ids[i];
486 mooseAssert(it !=
_boundary_names.end(), boundary_name_or_id +
" not found in 'boundary'.");
487 const auto boundary_index = std::distance(
_boundary_names.begin(), it);
488 const auto n_patches =
nPatch(boundary_index);
489 const auto boundary_name =
_mesh->getBoundaryName(ids[i]);
490 for (
const auto j : make_range(n_patches))
492 std::stringstream ss;
493 ss << boundary_name <<
"_" << j;
494 patch_boundary_names.push_back(ss.str());
497 return patch_boundary_names;
500std::vector<BoundaryName>
506std::vector<BoundaryName>
509 std::vector<BoundaryName> patch_boundary_names;
511 patch_boundary_names =
513 return patch_boundary_names;
519 std::vector<unsigned int> n_patches = getParam<std::vector<unsigned int>>(
"n_patches");
520 MultiMooseEnum partitioners = getParam<MultiMooseEnum>(
"partitioners");
523 partitioners.clearSetValues();
525 partitioners.setAdditionalValue(
"metis");
528 MultiMooseEnum direction = getParam<MultiMooseEnum>(
"centroid_partitioner_directions");
532 mooseError(
"n_patches parameter must have same length as boundary parameter.");
535 mooseError(
"partitioners parameter must have same length as boundary parameter.");
537 for (
unsigned int j = 0; j < partitioners.size(); ++j)
540 "centroid partitioner is selected for at least one sideset. "
541 "centroid_partitioner_directions parameter must have same length as boundary parameter.");
544 std::shared_ptr<MeshGeneratorMesh> mg_mesh = std::dynamic_pointer_cast<MeshGeneratorMesh>(
_mesh);
546 mooseError(
"This action adds MeshGenerator objects and therefore only works with a "
547 "MeshGeneratorMesh.");
553 params.
set<
unsigned int>(
"n_patches") = n_patches[j];
556 if (partitioners[j] ==
"centroid")
557 params.
set<
MooseEnum>(
"centroid_partitioner_direction") = direction[j];
569 mooseError(
"Failed to convert mesh generator ", mg->
name(),
" to PatchSidesetGenerator.");
576 std::stringstream ss;
584 const std::string var_type =
"MooseVariable";
587 params.set<
MooseEnum>(
"order") =
"CONSTANT";
588 params.set<
MooseEnum>(
"family") =
"MONOMIAL";
595 const std::string class_name =
"GrayLambertRadiationHeatFluxAux";
601 _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
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()