https://mooseframework.inl.gov
Loading...
Searching...
No Matches
HeatStructure2DRadiationCouplerRZ.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
12#include "HeatConductionNames.h"
13#include "THMMesh.h"
14
16
19{
21
22 params.addRequiredParam<Real>("primary_emissivity", "Emissivity for the primary side");
23 params.addRequiredParam<Real>("secondary_emissivity", "Emissivity for the secondary side");
24 params.addParam<Real>("stefan_boltzmann_constant",
26 "Stefan Boltzmann constant [W/(m^2-K^4)]. This constant is provided as a "
27 "parameter to allow different precisions.");
28
30 "Couples boundaries of two 2D cylindrical heat structures via radiation");
31
32 return params;
33}
34
36 const InputParameters & parameters)
37 : HeatStructure2DCouplerBase(parameters),
38
39 _emissivities({getParam<Real>("primary_emissivity"), getParam<Real>("secondary_emissivity")})
40{
41}
42
43void
45{
47
48 if (hasComponentByName<HeatStructureBase>(_hs_names[0]) &&
49 hasComponentByName<HeatStructureBase>(_hs_names[1]) && _hs_side_types.size() == 2)
50 {
51 _view_factors.resize(2);
52 if (_areas[0] > _areas[1])
53 {
54 _view_factors[0] = _areas[1] / _areas[0];
55 _view_factors[1] = 1.0;
56 }
57 else
58 {
59 _view_factors[0] = 1.0;
60 _view_factors[1] = _areas[0] / _areas[1];
61 }
62 }
63}
64
65void
67{
69
70 if (!_is_cylindrical[0] || !_is_cylindrical[1])
71 logError("The primary and secondary heat structures must be of a type inherited from "
72 "'HeatStructureCylindricalBase'.");
73
75 logError("The primary and secondary boundaries must be aligned.");
76
77 if (hasComponentByName<HeatStructureBase>(_hs_names[0]) &&
78 hasComponentByName<HeatStructureBase>(_hs_names[1]))
79 {
80 const HeatStructureBase & primary_hs = getComponentByName<HeatStructureBase>(_hs_names[0]);
81 const HeatStructureBase & secondary_hs = getComponentByName<HeatStructureBase>(_hs_names[1]);
82 if (primary_hs.hasBoundary(_hs_boundaries[0]) && secondary_hs.hasBoundary(_hs_boundaries[1]))
83 {
88 logError("The primary and secondary boundaries must be radial boundaries.");
89 }
90 }
91}
92
93void
95{
97
98 for (unsigned int i = 0; i < 2; i++)
99 {
100 const unsigned int j = i == 0 ? 1 : 0;
101
102 const auto & hs_cyl = getComponentByName<HeatStructureCylindricalBase>(_hs_names[i]);
103
104 const std::string class_name = "HeatStructure2DRadiationCouplerRZBC";
105 InputParameters params = _factory.getValidParams(class_name);
106 params.set<NonlinearVariableName>("variable") = HeatConductionModel::TEMPERATURE;
107 params.set<std::string>("coupled_variable") = HeatConductionModel::TEMPERATURE;
108 params.set<std::vector<BoundaryName>>("boundary") = {_hs_boundaries[i]};
109 params.set<MeshAlignment *>("_mesh_alignment") = &_mesh_alignment;
110 params.set<Real>("emissivity") = _emissivities[i];
111 params.set<Real>("coupled_emissivity") = _emissivities[j];
112 params.set<Real>("view_factor") = _view_factors[i];
113 params.set<Real>("area") = _areas[i];
114 params.set<Real>("coupled_area") = _areas[j];
115 params.set<Real>("stefan_boltzmann_constant") = getParam<Real>("stefan_boltzmann_constant");
116 params.set<Point>("axis_point") = hs_cyl.getPosition();
117 params.set<RealVectorValue>("axis_dir") = hs_cyl.getDirection();
118 getTHMProblem().addBoundaryCondition(class_name, genName(name(), class_name, i), params);
119 }
120}
registerMooseObject("ThermalHydraulicsApp", HeatStructure2DRadiationCouplerRZ)
const std::string name
Definition Setup.h:21
bool hasBoundary(const BoundaryName &boundary_name) const
Returns true if this component has the supplied boundary.
virtual void addMooseObjects()
Definition Component.h:115
void logError(Args &&... args) const
Logs an error.
Definition Component.h:226
THMProblem & getTHMProblem() const
Gets the THM problem.
Definition Component.C:135
Factory & _factory
The Factory associated with the MooseApp.
Definition Component.h:497
virtual void addBoundaryCondition(const std::string &bc_name, const std::string &name, InputParameters &parameters)
InputParameters getValidParams(const std::string &name) const
static const std::string TEMPERATURE
Couples boundaries of two 2D heat structures.
std::vector< Component2D::ExternalBoundaryType > _hs_side_types
Heat structure side types for each boundary.
virtual void check() const override
Check the component integrity.
MeshAlignment _mesh_alignment
Mesh alignment.
const std::vector< std::string > _hs_names
Primary and secondary heat structure names.
static InputParameters validParams()
std::vector< bool > _is_cylindrical
Flag for each heat structure deriving from HeatStructureCylindricalBase.
const std::vector< BoundaryName > _hs_boundaries
Primary and secondary heat structure boundaries.
virtual void init() override
Initializes the component.
std::vector< Real > _areas
Areas for the primary and secondary sides.
Couples boundaries of two 2D cylindrical heat structures via radiation.
const std::vector< Real > _emissivities
Emissivities for the primary and secondary sides.
virtual void init() override
Initializes the component.
virtual void check() const override
Check the component integrity.
HeatStructure2DRadiationCouplerRZ(const InputParameters &parameters)
std::vector< Real > _view_factors
View factors for the primary and secondary sides.
Base class for 2D generated heat structures.
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
T & set(const std::string &name, bool quiet_mode=false)
bool meshesAreAligned() const
Returns true if the primary and secondary meshes are aligned.
Builds mapping between two aligned subdomains/boundaries.
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.