25 params.
addRequiredParam<Real>(
"radius_2d",
"Radius of the 2D heat structure boundary [m]");
29 "Emissivity of the 2D heat structure boundary as a function of temperature [K]");
33 "Emissivity of the 3D heat structure boundary as a function of temperature [K]");
35 "Gap thickness [m] as a function of temperature [K]");
37 "gap_thermal_conductivity",
38 "Gap thermal conductivity [W/(m-K)] as a function of temperature [K]");
40 "gap_htc", 0,
"Gap heat transfer coefficient [W/(m^2-K)] as a function of temperature [K]");
43 "StoreVariableByElemIDSideUserObject containing the temperature values on the 2D boundary");
47 "symmetry_factor>=1.0",
48 "Azimuthal symmetry correction factor (>= 1.0). Equal to 2*pi "
49 "divided by the azimuthal angle covered by the 3D mesh.");
59 _T_3d(adCoupledValue(
"temperature")),
60 _r_2d(getParam<Real>(
"radius_2d")),
61 _emissivity_2d_fn(getFunction(
"emissivity_2d")),
62 _emissivity_3d_fn(getFunction(
"emissivity_3d")),
63 _include_radiation(isParamSetByUser(
"emissivity_2d") && isParamSetByUser(
"emissivity_3d")),
64 _gap_thickness_fn(getFunction(
"gap_thickness")),
65 _k_gap_fn(getFunction(
"gap_thermal_conductivity")),
66 _htc_gap_fn(getFunction(
"gap_htc")),
69 _symmetry_factor(getParam<Real>(
"symmetry_factor"))
87 const auto n_qp_3d =
_qrule->n_points();
92 std::vector<ADReal> heat_flux_3d(n_qp_3d, 0.0);
93 std::vector<ADReal> heat_flux_2d(n_qp_2d, 0.0);
94 for (
unsigned int qp_3d = 0; qp_3d < n_qp_3d; qp_3d++)
98 const auto & T_2d = T_2d_values[qp_2d];
99 const auto & T_3d =
_T_3d[qp_3d];
100 const auto T_gap = 0.5 * (T_2d + T_3d);
105 if (!MooseUtils::absoluteFuzzyGreaterThan(gap_thickness, 0))
108 const auto r_3d =
_r_2d + gap_thickness;
110 const auto heat_flux_cond =
112 auto heat_flux = heat_flux_cond;
115 heat_flux += htc * (T_2d - T_3d);
123 _r_2d, r_3d, emissivity_2d, emissivity_3d, T_2d, T_3d);
126 heat_flux_3d[qp_3d] = heat_flux;
127 heat_flux_2d[qp_2d] -=
139 for (
const auto qp_2d : index_range(heat_flux_2d_existing))
140 heat_flux_2d_existing[qp_2d] += heat_flux_2d[qp_2d];
148 for (
auto & it : other_uo._elem_id_to_heat_flux)
154 for (
const auto qp : index_range(existing))
155 existing[qp] += it.second[qp];
165const std::vector<ADReal> &
168 Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
174 mooseError(
name(),
": Requested heat flux for element ", elem_id,
" was not computed.");
DualNumber< Real, DNDerivativeType, true > ADReal
Real f(Real x)
Test function for Brents method.
registerMooseObject("ThermalHydraulicsApp", HSCoupler2D3DUserObject)
virtual Real value(Real t, const Point &p) const
virtual Real timeDerivative(Real t, const Point &p) const
Computes heat fluxes for HSCoupler2D3D.
virtual void execute() override
MeshAlignment2D3D & _mesh_alignment
Mesh alignment object.
const Real _symmetry_factor
Azimuthal symmetry correction factor (= 2*pi / covered_angle; 1.0 for full circle)
const Function & _emissivity_2d_fn
Emissivity of the 2D heat structure boundary as a function of temperature.
ADReal evaluateTemperatureFunction(const Function &fn, const ADReal &T) const
Evaluates a function of temperature.
const Function & _gap_thickness_fn
Gap thickness as a function of temperature.
virtual void threadJoin(const UserObject &uo) override
const Function & _k_gap_fn
Gap thermal conductivity as a function of temperature.
const StoreVariableByElemIDSideUserObject & _temperature_2d_uo
User object containing the temperature values on the 2D boundary.
static InputParameters validParams()
const Real & _r_2d
Radius of the 2D heat structure boundary.
const std::vector< ADReal > & getHeatFlux(dof_id_type elem_id) const
Gets the heat fluxes for each quadrature point for a given element ID.
std::map< dof_id_type, std::vector< ADReal > > _elem_id_to_heat_flux
Map of the element ID to the heat flux.
const Function & _htc_gap_fn
Gap heat transfer coefficient as a function of temperature.
const Function & _emissivity_3d_fn
Emissivity of the 3D heat structure boundary as a function of temperature.
const bool _include_radiation
Include radiation?
const ADVariableValue & _T_3d
Coupled heated perimeter variable.
HSCoupler2D3DUserObject(const InputParameters ¶meters)
virtual void initialize() override
virtual void finalize() override
Builds mapping between a 2D boundary and a 3D boundary.
const std::vector< Real > & getPrimaryArea(const dof_id_type primary_elem_id) const
Gets the area for each quadrature point on a primary element.
void buildCoupledElemQpIndexMapSecondary(Assembly &assembly)
Builds the map used for getting the coupled quadrature point index.
unsigned int getCoupledPrimaryElemQpIndex(const dof_id_type &secondary_elem_id, const unsigned int &secondary_qp) const
Gets the quadrature point index on the primary element corresponding to the quadrature point index on...
unsigned int getPrimaryNumberOfQuadraturePoints() const
Gets the number of quadrature points for faces on the primary boundary.
dof_id_type getCoupledPrimaryElemID(const dof_id_type &secondary_elem_id) const
Gets the coupled primary element ID for a given secondary element ID.
const std::string & name() const
void mooseError(Args &&... args) const
static InputParameters validParams()
const MooseArray< Real > & _coord
const QBase *const & _qrule
const MooseArray< Real > & _JxW
const Elem *const & _current_elem
Stores variable values at each quadrature point on a side by element ID.
const std::vector< ADReal > & getVariableValues(dof_id_type elem_id) const
Gets the variable values at each quadrature point on the provided element.
const Parallel::Communicator & comm() const
auto cylindricalGapConductionHeatFlux(const T1 &k_gap, const T2 &r_inner, const T3 &r_outer, const T4 &T_inner, const T5 &T_outer)
Computes the conduction heat flux across a cylindrical gap.
auto cylindricalGapRadiationHeatFlux(const T1 &r_inner, const T2 &r_outer, const T3 &emiss_inner, const T4 &emiss_outer, const T5 &T_inner, const T6 &T_outer, const Real &sigma=HeatConduction::Constants::sigma)
Computes the radiation heat flux across a cylindrical gap.
void allGatherADVectorMapSum(const Parallel::Communicator &comm, std::map< dof_id_type, std::vector< ADReal > > &this_map)
Parallel gather of a map of DoF ID to AD vector.