https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ADWallHTCGnielinskiAnnularMaterial.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
13#include "Numerics.h"
14
16
19{
21 params.addParam<MaterialPropertyName>(
22 "htc_wall",
24 "Name to give the heat transfer coefficient material property");
25 params.addParam<MaterialPropertyName>(
26 "rho", FlowModelSinglePhase::DENSITY, "Fluid density material property");
27 params.addParam<MaterialPropertyName>(
28 "vel", FlowModelSinglePhase::VELOCITY, "Fluid velocity material property");
29 params.addParam<MaterialPropertyName>("cp",
31 "Fluid isobaric specific heat capacity material property");
32 params.addParam<MaterialPropertyName>(
33 "mu", FlowModelSinglePhase::DYNAMIC_VISCOSITY, "Fluid dynamic viscosity material property");
34 params.addParam<MaterialPropertyName>("k",
36 "Fluid thermal conductivity material property");
37 params.addParam<MaterialPropertyName>(
38 "p", FlowModelSinglePhase::PRESSURE, "Fluid pressure material property");
39 params.addParam<MaterialPropertyName>(
40 "T", FlowModelSinglePhase::TEMPERATURE, "Fluid temperature material property");
41 params.addParam<MaterialPropertyName>(
42 "T_wall", FlowModel::TEMPERATURE_WALL, "Wall temperature material property");
43 params.addRequiredParam<Real>("D_inner", "Inner diameter of the annulus [m]");
44 params.addRequiredParam<Real>("D_outer", "Outer diameter of the annulus [m]");
45 params.addRequiredParam<Real>("channel_length", "Channel length [m]");
46 params.addRequiredParam<bool>("at_inner_wall", "True if heat transfer is at inner wall");
47 params.addRequiredParam<bool>("fluid_is_gas", "True if the fluid is a gas");
48 params.addParam<Real>("gas_heating_correction_exponent",
49 0,
50 "Exponent for the ratio of bulk fluid temperature to wall temperature for "
51 "the Nusselt number correction factor when heating a gas");
52 params.addRequiredParam<UserObjectName>("fluid_properties", "Fluid properties object");
53
54 params.addClassDescription("Computes wall heat transfer coefficient for gases and water in an "
55 "annular flow channel using the Gnielinski correlation");
56
57 return params;
58}
59
61 const InputParameters & parameters)
62 : Material(parameters),
63 _htc_wall(declareADProperty<Real>("htc_wall")),
64 _rho(getADMaterialProperty<Real>("rho")),
65 _vel(getADMaterialProperty<Real>("vel")),
66 _k(getADMaterialProperty<Real>("k")),
67 _mu(getADMaterialProperty<Real>("mu")),
68 _cp(getADMaterialProperty<Real>("cp")),
69 _p(getADMaterialProperty<Real>("p")),
70 _T(getADMaterialProperty<Real>("T")),
71 _T_wall(getADMaterialProperty<Real>("T_wall")),
72 _D_inner(getParam<Real>("D_inner")),
73 _D_outer(getParam<Real>("D_outer")),
74 _D_h(_D_outer - _D_inner),
75 _a(_D_inner / _D_outer),
76 _L(getParam<Real>("channel_length")),
77 _at_inner_wall(getParam<bool>("at_inner_wall")),
78 _fluid_is_gas(getParam<bool>("fluid_is_gas")),
79 _n(getParam<Real>("gas_heating_correction_exponent")),
80 _provided_gas_heating_correction_exponent(isParamSetByUser("gas_heating_correction_exponent")),
81 _fp(getUserObject<SinglePhaseFluidProperties>("fluid_properties"))
82{
83}
84
85void
87{
88 using std::pow, std::log10, std::log, std::sqrt;
89
90 const ADReal Pr = THM::Prandtl(_cp[_qp], _mu[_qp], _k[_qp]);
91
92 ADReal K;
93 if (_fluid_is_gas)
94 {
97 "If wall temperature ever exceeds the fluid temperature, even in iteration, and the "
98 "fluid is a gas, then the parameter 'gas_heating_correction_exponent' must be provided.");
99 K = pow(_T[_qp] / _T_wall[_qp], _n);
100 }
101 else
102 {
103 const ADReal cp_wall = _fp.cp_from_p_T(_p[_qp], _T_wall[_qp]);
104 const ADReal mu_wall = _fp.mu_from_p_T(_p[_qp], _T_wall[_qp]);
105 const ADReal k_wall = _fp.k_from_p_T(_p[_qp], _T_wall[_qp]);
106 const ADReal Pr_wall = THM::Prandtl(cp_wall, mu_wall, k_wall);
107 K = pow(Pr / Pr_wall, 0.11);
108 }
109
111 if (Re < 1e4)
112 {
113 mooseDoOnce(
114 mooseWarning("This material uses a correlation that is valid for Re > 1e4, but the "
115 "material was evaluated with an Re = " +
117 ". This and all subsequent evaluations will be given a lower bound of 1e4."));
118 Re = 1e4;
119 }
120 const ADReal Re_star =
121 Re * ((1 + _a * _a) * log(_a) + (1 - _a * _a)) / (pow(1 - _a, 2) * log(_a));
122
123 const ADReal f_ann = pow(1.8 * log10(Re_star) - 1.5, -2.0);
124 const ADReal k1 = 1.07 + 900.0 / Re - 0.63 / (1.0 + 10.0 * Pr);
125
126 ADReal F_ann;
127 if (_at_inner_wall)
128 F_ann = 0.75 * pow(_a, -0.17);
129 else
130 F_ann = 0.9 - 0.15 * pow(_a, 0.6);
131
132 const ADReal Nu = f_ann / 8.0 * Re * Pr /
133 (k1 + 12.7 * sqrt(f_ann / 8.0) * (pow(Pr, 2.0 / 3.0) - 1.0)) *
134 (1.0 + pow(_D_h / _L, 2.0 / 3.0)) * F_ann * K;
135
136 _htc_wall[_qp] = THM::wallHeatTransferCoefficient(Nu, _k[_qp], _D_h);
137}
DualNumber< Real, DNDerivativeType, true > ADReal
registerMooseObject("ThermalHydraulicsApp", ADWallHTCGnielinskiAnnularMaterial)
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
const double Re
Computes wall heat transfer coefficient for gases and water in an annular flow channel using the Gnie...
ADMaterialProperty< Real > & _htc_wall
Wall heat transfer coefficient.
const ADMaterialProperty< Real > & _T
Fluid temperature.
const ADMaterialProperty< Real > & _cp
Specific heat capacity.
ADWallHTCGnielinskiAnnularMaterial(const InputParameters &parameters)
const ADMaterialProperty< Real > & _vel
Velocity.
const Real & _n
Gas heating correction exponent.
const ADMaterialProperty< Real > & _rho
Density.
const ADMaterialProperty< Real > & _T_wall
Wall temperature.
const bool _at_inner_wall
Heat transfer occurs at inner wall.
const ADMaterialProperty< Real > & _mu
Dynamic viscosity.
const ADMaterialProperty< Real > & _k
Thermal conductivity.
const SinglePhaseFluidProperties & _fp
Fluid properties.
const ADMaterialProperty< Real > & _p
Pressure.
const bool _provided_gas_heating_correction_exponent
Provided gas heating correction exponent?
static const std::string DENSITY
static const std::string VELOCITY
static const std::string HEAT_TRANSFER_COEFFICIENT_WALL
static const std::string DYNAMIC_VISCOSITY
static const std::string SPECIFIC_HEAT_CONSTANT_PRESSURE
static const std::string THERMAL_CONDUCTIVITY
static const std::string TEMPERATURE
static const std::string PRESSURE
static const std::string TEMPERATURE_WALL
Definition FlowModel.h:108
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)
unsigned int _qp
static InputParameters validParams()
void mooseError(Args &&... args) const
void mooseWarning(Args &&... args) const
Common class for single phase fluid properties.
auto raw_value(const Eigen::Map< T > &in)
std::string stringify(const T &t)
auto Prandtl(const T1 &cp, const T2 &mu, const T3 &k)
Compute Prandtl number.
Definition Numerics.h:133
auto Reynolds(const T1 &volume_fraction, const T2 &rho, const T3 &vel, const T4 &D_h, const T5 &mu)
Compute Reynolds number.
Definition Numerics.h:118