59 _Tup(
ScalarCoupleable::coupledGenericScalarValue<is_ad>(
"inlet_temperature")),
60 _Tdown(
ScalarCoupleable::coupledGenericScalarValue<is_ad>(
"outlet_temperature")),
62 _is_implicit(this->template getParam<bool>(
"is_implicit")),
63 _Pref(this->template getFunctor<
GenericReal<is_ad>>(
"reference_pressure")),
64 _area(this->template getFunctor<
GenericReal<is_ad>>(
"area")),
65 _perimeter(this->template getFunctor<
GenericReal<is_ad>>(
"perimeter")),
66 _length(this->template getFunctor<
GenericReal<is_ad>>(
"length"))
79 const auto in = 1.0 / 2.0 * (1 - abs(_m[i]) / _m[i]) * _Tdown[i] +
80 1.0 / 2.0 * (1 + abs(_m[i]) / _m[i]) * _Tup[i];
81 const auto mu = _fp.mu_from_p_T(_Pref(qp, state), (Base::_u[i] + in) / 2);
82 const auto rho = _fp.rho_from_p_T(_Pref(qp, state), (Base::_u[i] + in) / 2);
83 const auto cp = _fp.cp_from_p_T(_Pref(qp, state), (Base::_u[i] + in) / 2);
84 const auto k = _fp.k_from_p_T(_Pref(qp, state), (Base::_u[i] + in) / 2);
87 const auto Dh = 4.0 * _area(qp, state) / _perimeter(qp, state);
88 const auto G = abs(_m[i]) / _area(qp, state);
89 const auto Re = G * Dh /
mu;
90 const auto Pr =
mu * cp / k;
92 const auto h = 0.023 *
pow(
Re, 0.8) *
pow(Pr, 0.4) * k / Dh;
93 const auto q = h * _perimeter(qp, state) / 2.0 * (2.0 * _Tw[i] - Base::_u[i] - in);
95 energy_residual += (_m[i] / 2.0 * (1 - abs(_m[i]) / _m[i]) * _Tdown[i] -
96 _m[i] / 2.0 * (1 + abs(_m[i]) / _m[i]) * _Tup[i] + abs(_m[i]) * Base::_u[i]) /
97 _length(qp, state) / _area(qp, state) /
rho;
99 energy_residual -= q / _area(qp, state) /
rho / cp;
101 return energy_residual;
108 if constexpr (!is_ad)
110 Real energy_jacob = 0;
115 const auto in = 1.0 / 2.0 * (1 - abs(_m[i]) / _m[i]) * _Tdown[i] +
116 1.0 / 2.0 * (1 + abs(_m[i]) / _m[i]) * _Tup[i];
117 const auto mu = _fp.mu_from_p_T(_Pref(qp, state), (Base::_u[i] + in) / 2);
118 const auto rho = _fp.rho_from_p_T(_Pref(qp, state), (Base::_u[i] + in) / 2);
119 const auto cp = _fp.cp_from_p_T(_Pref(qp, state), (Base::_u[i] + in) / 2);
120 const auto k = _fp.k_from_p_T(_Pref(qp, state), (Base::_u[i] + in) / 2);
123 const auto Dh = 4.0 * _area(qp, state) / _perimeter(qp, state);
124 const auto G = abs(_m[i]) / _area(qp, state);
125 const auto Re = G * Dh /
mu;
126 const auto Pr =
mu * cp / k;
128 const auto h = 0.023 *
pow(
Re, 0.8) *
pow(Pr, 0.4) * k / Dh;
129 const auto q = -h * _perimeter(qp, state) / 2.0;
131 energy_jacob += abs(_m[i]) / _length(qp, state) / _area(qp, state) /
rho;
133 energy_jacob -= q / _area(qp, state) /
rho / cp;
139 mooseError(
"computeQpJacobian() should not be called in AD mode");