https://mooseframework.inl.gov
SCMHTCClosureBase.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 
10 #include "SCMHTCClosureBase.h"
11 #include "SCM.h"
12 #include "SubChannelApp.h"
13 
14 #include <cmath>
15 
18 {
20  return params;
21 }
22 
24  : SCMClosureBase(parameters)
25 {
27  _Dpin_soln =
28  std::make_unique<SolutionHandle>(_subproblem.getVariable(0, SubChannelApp::PIN_DIAMETER));
29 }
30 
33 {
35  info.Re = nusselt_args.Re;
36  info.Pr = nusselt_args.Pr;
37 
38  const auto pitch = _subchannel_mesh.getPitch();
39  Real D;
40  const bool is_duct = (nusselt_args.i_pin == std::numeric_limits<unsigned int>::max());
41  if (!is_duct)
42  {
43  if (_Dpin_soln)
44  {
45  const auto * pin_node = _subchannel_mesh.getPinNode(nusselt_args.i_pin, nusselt_args.iz);
46  if ((*_Dpin_soln)(pin_node) > 0)
47  D = (*_Dpin_soln)(pin_node);
48  else
49  mooseError(name(),
50  "The diameter of the pin is equal or smaller than zero, "
51  "please initialize the auxiliary variable Dpin.");
52  }
53  else
55  }
56  else
58 
59  info.poD = pitch / D;
60  info.subch_type = _subchannel_mesh.getSubchannelType(nusselt_args.i_ch);
61 
62  info.laminar_Nu = (info.subch_type == EChannelType::CENTER)
63  ? 3.73
64  : (info.subch_type == EChannelType::EDGE ? 3.59 : 3.52);
66  info.ReL = 320 * std::pow(10.0, (info.poD - 1.0));
67  info.ReT = 1e4 * std::pow(10.0, 0.7 * (info.poD - 1.0));
68 
69  return info;
70 }
71 
72 Real
74  const NusseltStruct & nusselt_args,
75  const Real k) const
76 {
77  // Compute HTC
78  auto Nu = computeNusseltNumber(friction_args, nusselt_args);
79  auto Dh_i = 4.0 * friction_args.S / friction_args.w_perim;
80  const auto htc = Nu * k / Dh_i;
81  if (!std::isfinite(htc) || htc < 0.0)
82  mooseError(name(), ": The heat transfer coefficient must be non-negative and finite.");
83  return htc;
84 }
85 
86 Real
88  const Real turbulent_nusselt) const
89 {
90  if (info.Re <= info.ReL)
91  return info.laminar_Nu;
92 
93  if (info.Re >= info.ReT)
94  return turbulent_nusselt;
95 
96  const Real weight = (info.Re - info.ReL) / (info.ReT - info.ReL);
97  return weight * turbulent_nusselt + (1.0 - weight) * info.laminar_Nu;
98 }
static InputParameters validParams()
virtual const Real & getPinDiameter() const
Return undeformed Pin diameter.
MPI_Info info
NusseltPreInfo computeNusseltNumberPreInfo(const NusseltStruct &nusselt_info) const
Computes all the data needed before computing the nusselt number. It&#39;s used by all closure models...
virtual const Real & getPitch() const
Return the undeformed pitch between 2 subchannels.
virtual EChannelType getSubchannelType(unsigned int index) const =0
Return the type of the subchannel for given subchannel index.
static const std::string PIN_DIAMETER
Definition: SubChannelApp.h:36
virtual Node * getPinNode(unsigned int i_pin, unsigned int iz) const =0
Get the pin mesh node for a given pin index and elevation index.
structure with the needed information to compute the friction factor at a specific subchannel cell ...
structure that holds the needed data to calculate intermediate data needed to calculate the Nusselt n...
const std::string & name() const
static InputParameters validParams()
dof_id_type weight(const MeshBase &mesh, const processor_id_type pid)
static const std::string pitch
SCMHTCClosureBase(const InputParameters &parameters)
virtual Real computeNusseltNumber(const FrictionStruct &friction_info, const NusseltStruct &nusselt_info) const =0
Computes the nusselt number for the local conditions.
std::unique_ptr< SolutionHandle > _Dpin_soln
virtual const MooseVariableFieldBase & getVariable(const THREAD_ID tid, const std::string &var_name, Moose::VarKindType expected_var_type=Moose::VarKindType::VAR_ANY, Moose::VarFieldType expected_var_field_type=Moose::VarFieldType::VAR_FIELD_ANY) const=0
virtual bool hasVariable(const std::string &var_name) const=0
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const SubChannelMesh & _subchannel_mesh
Reference to the subchannel mesh.
Base class for SCM closures.
void mooseError(Args &&... args) const
Real computeHTC(const FrictionStruct &friction_info, const NusseltStruct &nusselt_info, const Real conduction_k) const
Computes the convective heat transfer coefficient for the local conditions.
MooseUnits pow(const MooseUnits &, int)
static const std::string k
Definition: NS.h:134
Real blendTurbulentNusseltNumber(const NusseltPreInfo &nusselt_info, const Real turbulent_nusselt) const
Blends turbulent Nusselt number through the transition range using the base laminar value...
structure with the needed information to compute the Nusselt number at a specific subchannel cell and...