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");
54 _T_3d(adCoupledValue(
"temperature")),
55 _r_2d(getParam<
Real>(
"radius_2d")),
56 _emissivity_2d_fn(getFunction(
"emissivity_2d")),
57 _emissivity_3d_fn(getFunction(
"emissivity_3d")),
58 _include_radiation(isParamSetByUser(
"emissivity_2d") && isParamSetByUser(
"emissivity_3d")),
59 _gap_thickness_fn(getFunction(
"gap_thickness")),
60 _k_gap_fn(getFunction(
"gap_thermal_conductivity")),
61 _htc_gap_fn(getFunction(
"gap_htc")),
81 const auto n_qp_3d =
_qrule->n_points();
86 std::vector<ADReal> heat_flux_3d(n_qp_3d, 0.0);
87 std::vector<ADReal> heat_flux_2d(n_qp_2d, 0.0);
88 for (
unsigned int qp_3d = 0; qp_3d < n_qp_3d; qp_3d++)
92 const auto & T_2d = T_2d_values[qp_2d];
93 const auto & T_3d =
_T_3d[qp_3d];
94 const auto T_gap = 0.5 * (T_2d + T_3d);
102 const auto r_3d =
_r_2d + gap_thickness;
104 const auto heat_flux_cond =
106 auto heat_flux = heat_flux_cond;
109 heat_flux += htc * (T_2d - T_3d);
117 _r_2d, r_3d, emissivity_2d, emissivity_3d, T_2d, T_3d);
120 heat_flux_3d[qp_3d] = heat_flux;
121 heat_flux_2d[qp_2d] -=
_JxW[qp_3d] *
_coord[qp_3d] * heat_flux / area_2d[qp_2d];
132 for (
const auto qp_2d :
index_range(heat_flux_2d_existing))
133 heat_flux_2d_existing[qp_2d] += heat_flux_2d[qp_2d];
141 for (
auto & it : other_uo._elem_id_to_heat_flux)
148 existing[qp] += it.second[qp];
158 const std::vector<ADReal> &
161 Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
167 mooseError(
name(),
": Requested heat flux for element ", elem_id,
" was not computed.");
HSCoupler2D3DUserObject(const InputParameters ¶meters)
virtual void execute() override
const Function & _emissivity_3d_fn
Emissivity of the 3D heat structure boundary as a function of temperature.
const std::vector< ADReal > & getVariableValues(dof_id_type elem_id) const
Gets the variable values at each quadrature point on the provided element.
static InputParameters validParams()
const bool _include_radiation
Include radiation?
virtual Real timeDerivative(Real t, const Point &p) const
const Function & _gap_thickness_fn
Gap thickness as a function of temperature.
MeshAlignment2D3D & _mesh_alignment
Mesh alignment object.
const Function & _htc_gap_fn
Gap heat transfer coefficient as a function of temperature.
const ADVariableValue & _T_3d
Coupled heated perimeter variable.
Stores variable values at each quadrature point on a side by element ID.
const Parallel::Communicator & comm() const
DualNumber< Real, DNDerivativeType, true > ADReal
virtual const std::string & name() const
const MooseArray< Real > & _JxW
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...
const Function & _k_gap_fn
Gap thermal conductivity as a function of temperature.
Real f(Real x)
Test function for Brents method.
virtual void finalize() override
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.
const MooseArray< Real > & _coord
const std::vector< ADReal > & getHeatFlux(dof_id_type elem_id) const
Gets the heat fluxes for each quadrature point for a given element ID.
virtual void initialize() override
void buildCoupledElemQpIndexMapSecondary(Assembly &assembly)
Builds the map used for getting the coupled quadrature point index.
Computes heat fluxes for HSCoupler2D3D.
ADReal evaluateTemperatureFunction(const Function &fn, const ADReal &T) const
Evaluates a function of temperature.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const std::vector< Real > & getPrimaryArea(const dof_id_type primary_elem_id) const
Gets the area for each quadrature point on a primary element.
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.
const Real & _r_2d
Radius of the 2D heat structure boundary.
const QBase *const & _qrule
unsigned int getPrimaryNumberOfQuadraturePoints() const
Gets the number of quadrature points for faces on the primary boundary.
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.
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 StoreVariableByElemIDSideUserObject & _temperature_2d_uo
User object containing the temperature values on the 2D boundary.
void mooseError(Args &&... args) const
std::map< dof_id_type, std::vector< ADReal > > _elem_id_to_heat_flux
Map of the element ID to the heat flux.
virtual void threadJoin(const UserObject &uo) override
const Elem *const & _current_elem
const Function & _emissivity_2d_fn
Emissivity of the 2D heat structure boundary as a function of temperature.
virtual Real value(Real t, const Point &p) const
registerMooseObject("ThermalHydraulicsApp", HSCoupler2D3DUserObject)
Builds mapping between a 2D boundary and a 3D boundary.
for(PetscInt i=0;i< nvars;++i)
auto index_range(const T &sizable)
bool absoluteFuzzyGreaterThan(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
static InputParameters validParams()