https://mooseframework.inl.gov
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 
12 #include "FlowModelSinglePhase.h"
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 
85 void
87 {
88  const ADReal Pr = THM::Prandtl(_cp[_qp], _mu[_qp], _k[_qp]);
89 
90  ADReal K;
91  if (_fluid_is_gas)
92  {
94  mooseError(
95  "If wall temperature ever exceeds the fluid temperature, even in iteration, and the "
96  "fluid is a gas, then the parameter 'gas_heating_correction_exponent' must be provided.");
97  K = std::pow(_T[_qp] / _T_wall[_qp], _n);
98  }
99  else
100  {
101  const ADReal cp_wall = _fp.cp_from_p_T(_p[_qp], _T_wall[_qp]);
102  const ADReal mu_wall = _fp.mu_from_p_T(_p[_qp], _T_wall[_qp]);
103  const ADReal k_wall = _fp.k_from_p_T(_p[_qp], _T_wall[_qp]);
104  const ADReal Pr_wall = THM::Prandtl(cp_wall, mu_wall, k_wall);
105  K = std::pow(Pr / Pr_wall, 0.11);
106  }
107 
108  ADReal Re = THM::Reynolds(1.0, _rho[_qp], _vel[_qp], _D_h, _mu[_qp]);
109  if (Re < 1e4)
110  {
111  mooseDoOnce(
112  mooseWarning("This material uses a correlation that is valid for Re > 1e4, but the "
113  "material was evaluated with an Re = " +
115  ". This and all subsequent evaluations will be given a lower bound of 1e4."));
116  Re = 1e4;
117  }
118  const ADReal Re_star =
119  Re * ((1 + _a * _a) * std::log(_a) + (1 - _a * _a)) / (std::pow(1 - _a, 2) * std::log(_a));
120 
121  const ADReal f_ann = std::pow(1.8 * std::log10(Re_star) - 1.5, -2.0);
122  const ADReal k1 = 1.07 + 900.0 / Re - 0.63 / (1.0 + 10.0 * Pr);
123 
124  ADReal F_ann;
125  if (_at_inner_wall)
126  F_ann = 0.75 * std::pow(_a, -0.17);
127  else
128  F_ann = 0.9 - 0.15 * std::pow(_a, 0.6);
129 
130  const ADReal Nu = f_ann / 8.0 * Re * Pr /
131  (k1 + 12.7 * std::sqrt(f_ann / 8.0) * (std::pow(Pr, 2.0 / 3.0) - 1.0)) *
132  (1.0 + std::pow(_D_h / _L, 2.0 / 3.0)) * F_ann * K;
133 
135 }
static const std::string SPECIFIC_HEAT_CONSTANT_PRESSURE
ADWallHTCGnielinskiAnnularMaterial(const InputParameters &parameters)
const ADMaterialProperty< Real > & _mu
Dynamic viscosity.
static const std::string DYNAMIC_VISCOSITY
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
static const std::string TEMPERATURE
auto Prandtl(const T1 &cp, const T2 &mu, const T3 &k)
Compute Prandtl number.
Definition: Numerics.h:133
static const std::string VELOCITY
static const std::string K
Definition: NS.h:170
const ADMaterialProperty< Real > & _cp
Specific heat capacity.
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
auto raw_value(const Eigen::Map< T > &in)
static const std::string THERMAL_CONDUCTIVITY
static const std::string HEAT_TRANSFER_COEFFICIENT_WALL
static const std::string DENSITY
const ADMaterialProperty< Real > & _p
Pressure.
void mooseWarning(Args &&... args) const
void addRequiredParam(const std::string &name, const std::string &doc_string)
static const std::string PRESSURE
unsigned int _qp
const ADMaterialProperty< Real > & _vel
Velocity.
const bool _at_inner_wall
Heat transfer occurs at inner wall.
static InputParameters validParams()
static const std::string TEMPERATURE_WALL
Definition: FlowModel.h:108
Common class for single phase fluid properties.
auto wallHeatTransferCoefficient(const T1 &Nu, const T2 &k, const T3 &D_h)
Compute wall heat transfer coefficient.
std::string stringify(const T &t)
Computes wall heat transfer coefficient for gases and water in an annular flow channel using the Gnie...
const ADMaterialProperty< Real > & _T_wall
Wall temperature.
const Real & _n
Gas heating correction exponent.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const bool _provided_gas_heating_correction_exponent
Provided gas heating correction exponent?
const ADMaterialProperty< Real > & _rho
Density.
const ADMaterialProperty< Real > & _T
Fluid temperature.
void mooseError(Args &&... args) const
registerMooseObject("ThermalHydraulicsApp", ADWallHTCGnielinskiAnnularMaterial)
void addClassDescription(const std::string &doc_string)
const ADMaterialProperty< Real > & _k
Thermal conductivity.
const SinglePhaseFluidProperties & _fp
Fluid properties.
MooseUnits pow(const MooseUnits &, int)
ADMaterialProperty< Real > & _htc_wall
Wall heat transfer coefficient.