https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ConvectiveHeatTransferSideIntegral.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
11
12#include "metaphysicl/raw_type.h"
13
16
17template <bool is_ad>
20{
22 params.addClassDescription("Computes the total convective heat transfer across a boundary.");
23
24 params.addRequiredCoupledVar("T_solid", "The solid temperature.");
25 params.addCoupledVar("T_fluid_var", "The fluid temperature.");
26 params.addCoupledVar("htc_var", "HTC variable");
27 params.addParam<MaterialPropertyName>("T_fluid",
28 "Name of the fluid temperature material property");
29 params.addParam<MaterialPropertyName>("htc", "Name of alpha_wall material property");
30 return params;
31}
32
33template <bool is_ad>
35 const InputParameters & parameters)
36 : SideIntegralPostprocessor(parameters),
37 _T_wall(coupledValue("T_solid")),
38 _T_fluid(isCoupled("T_fluid_var") ? &coupledValue("T_fluid_var") : nullptr),
39 _T_fluid_mat(isParamValid("T_fluid") ? &getGenericMaterialProperty<Real, is_ad>("T_fluid")
40 : nullptr),
41 _hw(isCoupled("htc_var") ? &coupledValue("htc_var") : nullptr),
42 _hw_mat(isParamValid("htc") ? &getGenericMaterialProperty<Real, is_ad>("htc") : nullptr)
43{
44 if (isCoupled("htc_var") == isParamValid("htc"))
45 paramError("htc", "Either htc_var OR htc must be provided (exactly one, not both).");
46
47 if (isCoupled("T_fluid_var") == isParamValid("T_fluid"))
48 paramError("T_fluid",
49 "Either ",
50 "T_fluid",
51 " OR ",
52 "T_fluid_var",
53 " must be provided (exactly one, not both).");
54}
55
56template <bool is_ad>
57Real
59{
60 Real hw;
61 if (_hw)
62 hw = (*_hw)[_qp];
63 else
64 hw = MetaPhysicL::raw_value((*_hw_mat)[_qp]);
65
66 Real Tf;
67 if (_T_fluid)
68 Tf = (*_T_fluid)[_qp];
69 else
70 Tf = MetaPhysicL::raw_value((*_T_fluid_mat)[_qp]);
71
72 return hw * (_T_wall[_qp] - Tf);
73}
74
registerMooseObject("HeatTransferApp", ConvectiveHeatTransferSideIntegral)
Computes the total convective heat transfer across a boundary.
ConvectiveHeatTransferSideIntegralTempl(const InputParameters &parameters)
virtual bool isCoupled(const std::string &var_name, unsigned int i=0) const
void addRequiredCoupledVar(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)
void addCoupledVar(const std::string &name, const std::string &doc_string)
void paramError(const std::string &param, Args... args) const
bool isParamValid(const std::string &name) const
static InputParameters validParams()
auto raw_value(const Eigen::Map< T > &in)