Loading [MathJax]/extensions/tex2jax.js
https://mooseframework.inl.gov
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
Closures1PhaseTHM.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 "Closures1PhaseTHM.h"
11 #include "FlowModelSinglePhase.h"
12 #include "FlowChannel1Phase.h"
13 #include "HeatTransfer1PhaseBase.h"
14 
15 registerMooseObject("ThermalHydraulicsApp", Closures1PhaseTHM);
16 
19 {
21 
22  MooseEnum wall_htc_closure("dittus_boelter=0 kazimi_carelli=1 lyon=2 mikityuk=3 schad=4 "
23  "weisman=5 wolf_mccarthy=6 gnielinski=7",
24  "dittus_boelter");
25  params.addParam<MooseEnum>(
26  "wall_htc_closure", wall_htc_closure, "Heat transfer coefficient closure");
27  MooseEnum wall_ff_closure("cheng_todreas=0 churchill=1", "churchill");
28  params.addParam<MooseEnum>("wall_ff_closure", wall_ff_closure, "Friction factor closure");
29  params.addClassDescription("Closures for 1-phase flow channels");
30  return params;
31 }
32 
34  : Closures1PhaseBase(params),
35  _wall_htc_closure(getParam<MooseEnum>("wall_htc_closure").getEnum<WallHTCClosureType>()),
36  _wall_ff_closure(getParam<MooseEnum>("wall_ff_closure").getEnum<WallFFClosureType>())
37 {
38 }
39 
40 void
42 {
43 }
44 
45 void
47  const FlowChannelBase & /*flow_channel*/) const
48 {
49 }
50 
51 void
53 {
54  const FlowChannel1Phase & flow_channel_1phase =
55  dynamic_cast<const FlowChannel1Phase &>(flow_channel);
56 
57  // wall friction material
58  if (flow_channel.isParamValid("f"))
59  addWallFrictionFunctionMaterial(flow_channel_1phase);
60  else
61  addWallFFMaterial(flow_channel_1phase);
62 
63  const unsigned int n_ht_connections = flow_channel_1phase.getNumberOfHeatTransferConnections();
64  if (n_ht_connections > 0)
65  {
66 
67  for (unsigned int i = 0; i < n_ht_connections; i++)
68  {
69  // wall heat transfer coefficient material
70  addWallHTCMaterial(flow_channel_1phase, i);
71 
72  // wall temperature material
73  if (flow_channel.getTemperatureMode())
74  addWallTemperatureFromAuxMaterial(flow_channel_1phase, i);
75  else
76  addTemperatureWallFromHeatFluxMaterial(flow_channel_1phase, i);
77  }
78  }
79 }
80 void
82 {
83  switch (_wall_ff_closure)
84  {
86  {
87  const std::string class_name = "ADWallFrictionChurchillMaterial";
88  InputParameters params = _factory.getValidParams(class_name);
89  params.set<std::vector<SubdomainName>>("block") = flow_channel.getSubdomainNames();
90  params.set<MaterialPropertyName>("rho") = FlowModelSinglePhase::DENSITY;
91  params.set<MaterialPropertyName>("vel") = FlowModelSinglePhase::VELOCITY;
92  params.set<MaterialPropertyName>("D_h") = FlowModelSinglePhase::HYDRAULIC_DIAMETER;
93  params.set<MaterialPropertyName>("f_D") = FlowModelSinglePhase::FRICTION_FACTOR_DARCY;
94  params.set<MaterialPropertyName>("mu") = FlowModelSinglePhase::DYNAMIC_VISCOSITY;
95  params.set<Real>("roughness") = flow_channel.getParam<Real>("roughness");
96  const std::string obj_name = genName(flow_channel.name(), "wall_friction_mat");
97  _sim.addMaterial(class_name, obj_name, params);
98  flow_channel.connectObject(params, obj_name, "roughness");
99  break;
100  }
102  {
103  const std::string class_name = "ADWallFrictionChengMaterial";
104  InputParameters params = _factory.getValidParams(class_name);
105  params.set<std::vector<SubdomainName>>("block") = flow_channel.getSubdomainNames();
106  params.set<MaterialPropertyName>("f_D") = FlowModelSinglePhase::FRICTION_FACTOR_DARCY;
107  params.set<Real>("PoD") = flow_channel.getParam<Real>("PoD");
108  if (flow_channel.getParam<Real>("PoD") == 1.0)
109  {
110  mooseDoOnce(mooseWarning(
111  "You are using a rod bundle correlation with the default Pitch-to-Diameter "
112  "ratio value, P/D=1.0. It can be set using the PoD parameter in the corresponding "
113  "FlowChannel1Phase component"));
114  }
115  if (flow_channel.getHeatTransferGeometry() == FlowChannelBase::EConvHeatTransGeom::PIPE)
116  {
117  mooseError("The Cheng-Todreas correlation was made to be used in rod bundles, your "
118  "geometry type is "
119  "PIPE, please change heat_transfer_geom to ROD_BUNDLE or HEX_ROD_BUNDLE, or "
120  "choose a correlation valid for PIPES");
121  }
122  else if (flow_channel.getHeatTransferGeometry() ==
123  FlowChannelBase::EConvHeatTransGeom::ROD_BUNDLE)
124  {
125  params.set<MooseEnum>("bundle_array") = "SQUARE";
126  }
127  else if (flow_channel.getHeatTransferGeometry() ==
128  FlowChannelBase::EConvHeatTransGeom::HEX_ROD_BUNDLE)
129  {
130  params.set<MooseEnum>("bundle_array") = "HEXAGONAL";
131  }
132  if (flow_channel.getPipeLocation() == FlowChannelBase::EPipeLocation::INTERIOR)
133  {
134  params.set<MooseEnum>("subchannel_type") = "INTERIOR";
135  }
136  else if (flow_channel.getPipeLocation() == FlowChannelBase::EPipeLocation::EDGE)
137  {
138  params.set<MooseEnum>("subchannel_type") = "EDGE";
139  }
140  else if (flow_channel.getPipeLocation() == FlowChannelBase::EPipeLocation::CORNER)
141  {
142  params.set<MooseEnum>("subchannel_type") = "CORNER";
143  }
144  const std::string obj_name = genName(flow_channel.name(), "wall_friction_mat");
145  _sim.addMaterial(class_name, obj_name, params);
146  break;
147  }
148  default:
149  mooseError("Invalid WallFFClosureType");
150  }
151 }
152 
153 void
154 Closures1PhaseTHM::addWallHTCMaterial(const FlowChannel1Phase & flow_channel, unsigned int i) const
155 {
156 
157  switch (_wall_htc_closure)
158  {
160  {
161  const std::string class_name = "ADWallHeatTransferCoefficient3EqnDittusBoelterMaterial";
162  InputParameters params = _factory.getValidParams(class_name);
163  params.set<MaterialPropertyName>("Hw") = flow_channel.getWallHTCNames1Phase()[i];
164  params.set<MaterialPropertyName>("D_h") = FlowModelSinglePhase::HYDRAULIC_DIAMETER;
165  params.set<MaterialPropertyName>("rho") = FlowModelSinglePhase::DENSITY;
166  params.set<MaterialPropertyName>("vel") = FlowModelSinglePhase::VELOCITY;
167  params.set<MaterialPropertyName>("T") = FlowModelSinglePhase::TEMPERATURE;
168  params.set<MaterialPropertyName>("k") = FlowModelSinglePhase::THERMAL_CONDUCTIVITY;
169  params.set<MaterialPropertyName>("mu") = FlowModelSinglePhase::DYNAMIC_VISCOSITY;
170  params.set<MaterialPropertyName>("cp") =
172  params.set<MaterialPropertyName>("T_wall") = flow_channel.getWallTemperatureNames()[i];
173  params.set<std::vector<SubdomainName>>("block") = flow_channel.getSubdomainNames();
174  _sim.addMaterial(class_name, genName(flow_channel.name(), "whtc_mat", i), params);
175 
176  break;
177  }
179  {
180  const std::string class_name = "ADWallHeatTransferCoefficientWolfMcCarthyMaterial";
181  InputParameters params = _factory.getValidParams(class_name);
182  params.set<MaterialPropertyName>("Hw") = flow_channel.getWallHTCNames1Phase()[i];
183  params.set<MaterialPropertyName>("T_wall") = flow_channel.getWallTemperatureNames()[i];
184  params.set<std::vector<SubdomainName>>("block") = flow_channel.getSubdomainNames();
185  _sim.addMaterial(class_name, genName(flow_channel.name(), "whtc_mat", i), params);
186 
187  break;
188  }
190  {
191 
192  const std::string class_name = "ADWallHeatTransferCoefficientWeismanMaterial";
193  InputParameters params = _factory.getValidParams(class_name);
194  params.set<MaterialPropertyName>("Hw") = flow_channel.getWallHTCNames1Phase()[i];
195  params.set<MaterialPropertyName>("T_wall") = flow_channel.getWallTemperatureNames()[i];
196  params.set<std::vector<SubdomainName>>("block") = flow_channel.getSubdomainNames();
197  params.set<Real>("PoD") = flow_channel.getParam<Real>("PoD");
198  if (flow_channel.getParam<Real>("PoD") == 1.0)
199  {
200  mooseDoOnce(mooseWarning(
201  "You are using a rod bundle correlation with the default Pitch-to-Diameter "
202  "ratio value, P/D=1.0. It can be set using the PoD parameter in the corresponding "
203  "FlowChannel1Phase component"));
204  }
205 
206  if (flow_channel.getHeatTransferGeometry() == FlowChannelBase::EConvHeatTransGeom::PIPE)
207  {
208  mooseError("Weiman's correlation was made to be used in rod bundles, your geometry type is "
209  "PIPE, please change heat_transfer_geom to ROD_BUNDLE or HEX_ROD_BUNDLE, or "
210  "choose a correlation valid for PIPES");
211  }
212  else if (flow_channel.getHeatTransferGeometry() ==
213  FlowChannelBase::EConvHeatTransGeom::ROD_BUNDLE)
214  {
215  params.set<MooseEnum>("bundle_array") = "SQUARE";
216  }
217  else if (flow_channel.getHeatTransferGeometry() ==
218  FlowChannelBase::EConvHeatTransGeom::HEX_ROD_BUNDLE)
219  {
220  params.set<MooseEnum>("bundle_array") = "TRIANGULAR";
221  }
222  _sim.addMaterial(class_name, genName(flow_channel.name(), "whtc_mat", i), params);
223  break;
224  }
226  {
227  const std::string class_name = "ADWallHeatTransferCoefficientLyonMaterial";
228  InputParameters params = _factory.getValidParams(class_name);
229  params.set<MaterialPropertyName>("Hw") = flow_channel.getWallHTCNames1Phase()[i];
230  params.set<MaterialPropertyName>("T_wall") = flow_channel.getWallTemperatureNames()[i];
231  params.set<std::vector<SubdomainName>>("block") = flow_channel.getSubdomainNames();
232  _sim.addMaterial(class_name, genName(flow_channel.name(), "whtc_mat", i), params);
233  break;
234  }
236  {
237 
238  const std::string class_name = "ADWallHeatTransferCoefficientKazimiMaterial";
239  InputParameters params = _factory.getValidParams(class_name);
240  params.set<MaterialPropertyName>("Hw") = flow_channel.getWallHTCNames1Phase()[i];
241  params.set<MaterialPropertyName>("T_wall") = flow_channel.getWallTemperatureNames()[i];
242  params.set<std::vector<SubdomainName>>("block") = flow_channel.getSubdomainNames();
243  params.set<Real>("PoD") = flow_channel.getParam<Real>("PoD");
244  if (flow_channel.getParam<Real>("PoD") == 1.0)
245  {
246  mooseDoOnce(mooseWarning(
247  "You are using a rod bundle correlation with the default Pitch-to-Diameter "
248  "ratio value, P/D=1.0. It can be set using the PoD parameter in the corresponding "
249  "FlowChannel1Phase component"));
250  }
251  _sim.addMaterial(class_name, genName(flow_channel.name(), "whtc_mat", i), params);
252  break;
253  }
255  {
256 
257  const std::string class_name = "ADWallHeatTransferCoefficientMikityukMaterial";
258  InputParameters params = _factory.getValidParams(class_name);
259  params.set<MaterialPropertyName>("Hw") = flow_channel.getWallHTCNames1Phase()[i];
260  params.set<MaterialPropertyName>("T_wall") = flow_channel.getWallTemperatureNames()[i];
261  params.set<std::vector<SubdomainName>>("block") = flow_channel.getSubdomainNames();
262  params.set<Real>("PoD") = flow_channel.getParam<Real>("PoD");
263  if (flow_channel.getParam<Real>("PoD") == 1.0)
264  {
265  mooseDoOnce(mooseWarning(
266  "You are using a rod bundle correlation with the default Pitch-to-Diameter "
267  "ratio value, P/D=1.0. It can be set using the PoD parameter in the corresponding "
268  "FlowChannel1Phase component"));
269  }
270  _sim.addMaterial(class_name, genName(flow_channel.name(), "whtc_mat", i), params);
271  break;
272  }
274  {
275 
276  const std::string class_name = "ADWallHeatTransferCoefficientSchadMaterial";
277  InputParameters params = _factory.getValidParams(class_name);
278  params.set<MaterialPropertyName>("Hw") = flow_channel.getWallHTCNames1Phase()[i];
279  params.set<MaterialPropertyName>("T_wall") = flow_channel.getWallTemperatureNames()[i];
280  params.set<std::vector<SubdomainName>>("block") = flow_channel.getSubdomainNames();
281  params.set<Real>("PoD") = flow_channel.getParam<Real>("PoD");
282  if (flow_channel.getParam<Real>("PoD") == 1.0)
283  {
284  mooseDoOnce(mooseWarning(
285  "You are using a rod bundle correlation with the default Pitch-to-Diameter "
286  "ratio value, P/D=1.0. It can be set using the PoD parameter in the corresponding "
287  "FlowChannel1Phase component"));
288  }
289  _sim.addMaterial(class_name, genName(flow_channel.name(), "whtc_mat", i), params);
290  break;
291  }
293  {
294 
295  const std::string class_name = "ADWallHeatTransferCoefficientGnielinskiMaterial";
296  InputParameters params = _factory.getValidParams(class_name);
297  params.set<MaterialPropertyName>("Hw") = flow_channel.getWallHTCNames1Phase()[i];
298  params.set<MaterialPropertyName>("T_wall") = flow_channel.getWallTemperatureNames()[i];
299  params.set<std::vector<SubdomainName>>("block") = flow_channel.getSubdomainNames();
300  _sim.addMaterial(class_name, genName(flow_channel.name(), "whtc_mat", i), params);
301  break;
302  }
303  default:
304  mooseError("Invalid WallHTCClosureType");
305  }
306 }
307 void
309  unsigned int i) const
310 {
311  const std::string class_name = "TemperatureWallFromHeatFlux3EqnTHMMaterial";
312  InputParameters params = _factory.getValidParams(class_name);
313  params.set<std::vector<SubdomainName>>("block") = flow_channel.getSubdomainNames();
314  params.set<MaterialPropertyName>("T_wall") = flow_channel.getWallTemperatureNames()[i];
315  params.set<MaterialPropertyName>("D_h") = FlowModelSinglePhase::HYDRAULIC_DIAMETER;
316  params.set<MaterialPropertyName>("rho") = FlowModelSinglePhase::DENSITY;
317  params.set<MaterialPropertyName>("vel") = FlowModelSinglePhase::VELOCITY;
318  params.set<MaterialPropertyName>("T") = FlowModelSinglePhase::TEMPERATURE;
319  params.set<MaterialPropertyName>("k") = FlowModelSinglePhase::THERMAL_CONDUCTIVITY;
320  params.set<MaterialPropertyName>("mu") = FlowModelSinglePhase::DYNAMIC_VISCOSITY;
321  params.set<MaterialPropertyName>("cp") = FlowModelSinglePhase::SPECIFIC_HEAT_CONSTANT_PRESSURE;
322  params.set<MaterialPropertyName>("q_wall") = flow_channel.getWallHeatFluxNames()[i];
323  _sim.addMaterial(class_name, genName(flow_channel.name(), "T_from_q_wall_mat", i), params);
324 }
virtual void addMooseObjectsFlowChannel(const FlowChannelBase &flow_channel) override
Adds MOOSE objects associated with a flow channel component.
void addWallHTCMaterial(const FlowChannel1Phase &flow_channel, unsigned int i) const
Adds wall heat transfer coefficient material.
THMProblem & _sim
Simulation.
Definition: ClosuresBase.h:100
static const std::string SPECIFIC_HEAT_CONSTANT_PRESSURE
virtual void checkFlowChannel(const FlowChannelBase &flow_channel) const override
Checks for errors associated with a flow channel component.
const WallFFClosureType _wall_ff_closure
Wall friction factor closure.
virtual void checkHeatTransfer(const HeatTransferBase &heat_transfer, const FlowChannelBase &flow_channel) const override
Checks for errors associated with a heat transfer component.
std::string genName(const std::string &prefix, unsigned int id, const std::string &suffix="") const
Build a name from a prefix, number and possible suffix.
static const std::string DYNAMIC_VISCOSITY
void addWallFFMaterial(const FlowChannel1Phase &flow_channel) const
Adds material that computes wall friction factor.
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
EConvHeatTransGeom getHeatTransferGeometry() const
Gets heat transfer geometry.
static const std::string VELOCITY
unsigned int getNumberOfHeatTransferConnections() const
Gets the number of heat transfer connections.
virtual void addMaterial(const std::string &material_name, const std::string &name, InputParameters &parameters)
THM 1-phase closures.
T & set(const std::string &name, bool quiet_mode=false)
static InputParameters validParams()
InputParameters getValidParams(const std::string &name) const
static const std::string THERMAL_CONDUCTIVITY
static MooseEnum getPipeLocation(const std::string &name)
Gets a MooseEnum for pipe location.
static const std::string DENSITY
A base class for flow channels.
std::vector< VariableName > getWallTemperatureNames() const
Gets wall temperature names for connected heat transfers.
std::vector< MaterialPropertyName > getWallHeatFluxNames() const
Gets wall heat flux names for connected heat transfers.
virtual const std::string & name() const
void mooseWarning(Args &&... args) const
bool isParamValid(const std::string &name) const
void addWallTemperatureFromAuxMaterial(const FlowChannelBase &flow_channel, unsigned int i=0) const
Adds a material for wall temperature from an aux variable.
Definition: ClosuresBase.C:64
A class representing a 1-phase flow channel.
WallFFClosureType
Fluid friction factor closure type.
void addTemperatureWallFromHeatFluxMaterial(const FlowChannel1Phase &flow_channel, unsigned int i) const
Adds computation of wall temperature when heat flux is specified.
const T & getParam(const std::string &name) const
Closures1PhaseTHM(const InputParameters &params)
Base class for heat transfer connections.
static const std::string FRICTION_FACTOR_DARCY
Base class for 1-phase closures.
Factory & _factory
Factory associated with the MooseApp.
Definition: ClosuresBase.h:103
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void connectObject(const InputParameters &params, const std::string &mooseName, const std::string &name) const
Connect with control logic.
Definition: Component.C:98
WallHTCClosureType
Fluid heat transfer coefficient closure type.
static const std::string HYDRAULIC_DIAMETER
void mooseError(Args &&... args) const
registerMooseObject("ThermalHydraulicsApp", Closures1PhaseTHM)
void addClassDescription(const std::string &doc_string)
const WallHTCClosureType _wall_htc_closure
Wall heat transfer coefficient closure.
std::vector< MaterialPropertyName > getWallHTCNames1Phase() const
Gets 1-phase wall heat transfer coefficient names for connected heat transfers.
void addWallFrictionFunctionMaterial(const FlowChannel1Phase &flow_channel) const
Adds material that computes wall friction factor from a specified function.
virtual const std::vector< SubdomainName > & getSubdomainNames() const
Gets the subdomain names for this component.
Definition: Component.C:307
bool getTemperatureMode() const
Gets temperature mode flag.
static InputParameters validParams()