https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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"
12#include "FlowChannel1Phase.h"
14
15registerMooseObject("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 colebrook_white=2", "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
40void
42{
43}
44
45void
47 const FlowChannelBase & /*flow_channel*/) const
48{
49}
50
51void
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 && flow_channel.getTemperatureMode())
65 {
66 for (unsigned int i = 0; i < n_ht_connections; i++)
67 {
68 // wall heat transfer coefficient material
69 addWallHTCMaterial(flow_channel_1phase, i);
70
71 // wall temperature material
72 addWallTemperatureFromAuxMaterial(flow_channel_1phase, i);
73 }
74 }
75}
76void
78{
79 switch (_wall_ff_closure)
80 {
82 {
83 const std::string class_name = "ADWallFrictionChurchillMaterial";
84 InputParameters params = _factory.getValidParams(class_name);
85 params.set<std::vector<SubdomainName>>("block") = flow_channel.getSubdomainNames();
86 params.set<MaterialPropertyName>("rho") = FlowModelSinglePhase::DENSITY;
87 params.set<MaterialPropertyName>("vel") = FlowModelSinglePhase::VELOCITY;
88 params.set<MaterialPropertyName>("D_h") = FlowModelSinglePhase::HYDRAULIC_DIAMETER;
89 params.set<MaterialPropertyName>("f_D") = FlowModelSinglePhase::FRICTION_FACTOR_DARCY;
90 params.set<MaterialPropertyName>("mu") = FlowModelSinglePhase::DYNAMIC_VISCOSITY;
91 params.set<Real>("roughness") = flow_channel.getParam<Real>("roughness");
92 const std::string obj_name = genName(flow_channel.name(), "wall_friction_mat");
93 _sim.addMaterial(class_name, obj_name, params);
94 flow_channel.connectObject(params, obj_name, "roughness");
95 break;
96 }
98 {
99 const std::string class_name = "ADWallFrictionChengMaterial";
100 InputParameters params = _factory.getValidParams(class_name);
101 params.set<std::vector<SubdomainName>>("block") = flow_channel.getSubdomainNames();
102 params.set<MaterialPropertyName>("f_D") = FlowModelSinglePhase::FRICTION_FACTOR_DARCY;
103 params.set<Real>("PoD") = flow_channel.getParam<Real>("PoD");
104 if (flow_channel.getParam<Real>("PoD") == 1.0)
105 {
106 mooseDoOnce(mooseWarning(
107 "You are using a rod bundle correlation with the default Pitch-to-Diameter "
108 "ratio value, P/D=1.0. It can be set using the PoD parameter in the corresponding "
109 "FlowChannel1Phase component"));
110 }
112 {
113 mooseError("The Cheng-Todreas correlation was made to be used in rod bundles, your "
114 "geometry type is "
115 "PIPE, please change heat_transfer_geom to ROD_BUNDLE or HEX_ROD_BUNDLE, or "
116 "choose a correlation valid for PIPES");
117 }
118 else if (flow_channel.getHeatTransferGeometry() ==
120 {
121 params.set<MooseEnum>("bundle_array") = "SQUARE";
122 }
123 else if (flow_channel.getHeatTransferGeometry() ==
125 {
126 params.set<MooseEnum>("bundle_array") = "HEXAGONAL";
127 }
129 {
130 params.set<MooseEnum>("subchannel_type") = "INTERIOR";
131 }
132 else if (flow_channel.getPipeLocation() == FlowChannelBase::EPipeLocation::EDGE)
133 {
134 params.set<MooseEnum>("subchannel_type") = "EDGE";
135 }
137 {
138 params.set<MooseEnum>("subchannel_type") = "CORNER";
139 }
140 const std::string obj_name = genName(flow_channel.name(), "wall_friction_mat");
141 _sim.addMaterial(class_name, obj_name, params);
142 break;
143 }
145 {
146 const std::string class_name = "ADWallFrictionColebrookWhiteMaterial";
147 InputParameters params = _factory.getValidParams(class_name);
148 params.set<std::vector<SubdomainName>>("block") = flow_channel.getSubdomainNames();
149 params.set<MaterialPropertyName>("rho") = FlowModelSinglePhase::DENSITY;
150 params.set<MaterialPropertyName>("vel") = FlowModelSinglePhase::VELOCITY;
151 params.set<MaterialPropertyName>("D_h") = FlowModelSinglePhase::HYDRAULIC_DIAMETER;
152 params.set<MaterialPropertyName>("f_D") = FlowModelSinglePhase::FRICTION_FACTOR_DARCY;
153 params.set<MaterialPropertyName>("mu") = FlowModelSinglePhase::DYNAMIC_VISCOSITY;
154 params.set<Real>("roughness") = flow_channel.getParam<Real>("roughness");
155 const std::string obj_name = genName(flow_channel.name(), "wall_friction_mat");
156 _sim.addMaterial(class_name, obj_name, params);
157 flow_channel.connectObject(params, obj_name, "roughness");
158 break;
159 }
160 default:
161 mooseError("Invalid WallFFClosureType");
162 }
163}
164
165void
166Closures1PhaseTHM::addWallHTCMaterial(const FlowChannel1Phase & flow_channel, unsigned int i) const
167{
168
169 switch (_wall_htc_closure)
170 {
172 {
173 const std::string class_name = "ADWallHeatTransferCoefficient3EqnDittusBoelterMaterial";
174 InputParameters params = _factory.getValidParams(class_name);
175 params.set<MaterialPropertyName>("Hw") = flow_channel.getWallHTCNames1Phase()[i];
176 params.set<MaterialPropertyName>("D_h") = FlowModelSinglePhase::HYDRAULIC_DIAMETER;
177 params.set<MaterialPropertyName>("rho") = FlowModelSinglePhase::DENSITY;
178 params.set<MaterialPropertyName>("vel") = FlowModelSinglePhase::VELOCITY;
179 params.set<MaterialPropertyName>("T") = FlowModelSinglePhase::TEMPERATURE;
180 params.set<MaterialPropertyName>("k") = FlowModelSinglePhase::THERMAL_CONDUCTIVITY;
181 params.set<MaterialPropertyName>("mu") = FlowModelSinglePhase::DYNAMIC_VISCOSITY;
182 params.set<MaterialPropertyName>("cp") =
184 params.set<MaterialPropertyName>("T_wall") = flow_channel.getWallTemperatureNames()[i];
185 params.set<std::vector<SubdomainName>>("block") = flow_channel.getSubdomainNames();
186 _sim.addMaterial(class_name, genName(flow_channel.name(), "whtc_mat", i), params);
187
188 break;
189 }
191 {
192 const std::string class_name = "ADWallHeatTransferCoefficientWolfMcCarthyMaterial";
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 _sim.addMaterial(class_name, genName(flow_channel.name(), "whtc_mat", i), params);
198
199 break;
200 }
202 {
203
204 const std::string class_name = "ADWallHeatTransferCoefficientWeismanMaterial";
205 InputParameters params = _factory.getValidParams(class_name);
206 params.set<MaterialPropertyName>("Hw") = flow_channel.getWallHTCNames1Phase()[i];
207 params.set<MaterialPropertyName>("T_wall") = flow_channel.getWallTemperatureNames()[i];
208 params.set<std::vector<SubdomainName>>("block") = flow_channel.getSubdomainNames();
209 params.set<Real>("PoD") = flow_channel.getParam<Real>("PoD");
210 if (flow_channel.getParam<Real>("PoD") == 1.0)
211 {
212 mooseDoOnce(mooseWarning(
213 "You are using a rod bundle correlation with the default Pitch-to-Diameter "
214 "ratio value, P/D=1.0. It can be set using the PoD parameter in the corresponding "
215 "FlowChannel1Phase component"));
216 }
217
219 {
220 mooseError("Weiman's correlation was made to be used in rod bundles, your geometry type is "
221 "PIPE, please change heat_transfer_geom to ROD_BUNDLE or HEX_ROD_BUNDLE, or "
222 "choose a correlation valid for PIPES");
223 }
224 else if (flow_channel.getHeatTransferGeometry() ==
226 {
227 params.set<MooseEnum>("bundle_array") = "SQUARE";
228 }
229 else if (flow_channel.getHeatTransferGeometry() ==
231 {
232 params.set<MooseEnum>("bundle_array") = "TRIANGULAR";
233 }
234 _sim.addMaterial(class_name, genName(flow_channel.name(), "whtc_mat", i), params);
235 break;
236 }
238 {
239 const std::string class_name = "ADWallHeatTransferCoefficientLyonMaterial";
240 InputParameters params = _factory.getValidParams(class_name);
241 params.set<MaterialPropertyName>("Hw") = flow_channel.getWallHTCNames1Phase()[i];
242 params.set<MaterialPropertyName>("T_wall") = flow_channel.getWallTemperatureNames()[i];
243 params.set<std::vector<SubdomainName>>("block") = flow_channel.getSubdomainNames();
244 _sim.addMaterial(class_name, genName(flow_channel.name(), "whtc_mat", i), params);
245 break;
246 }
248 {
249
250 const std::string class_name = "ADWallHeatTransferCoefficientKazimiMaterial";
251 InputParameters params = _factory.getValidParams(class_name);
252 params.set<MaterialPropertyName>("Hw") = flow_channel.getWallHTCNames1Phase()[i];
253 params.set<MaterialPropertyName>("T_wall") = flow_channel.getWallTemperatureNames()[i];
254 params.set<std::vector<SubdomainName>>("block") = flow_channel.getSubdomainNames();
255 params.set<Real>("PoD") = flow_channel.getParam<Real>("PoD");
256 if (flow_channel.getParam<Real>("PoD") == 1.0)
257 {
258 mooseDoOnce(mooseWarning(
259 "You are using a rod bundle correlation with the default Pitch-to-Diameter "
260 "ratio value, P/D=1.0. It can be set using the PoD parameter in the corresponding "
261 "FlowChannel1Phase component"));
262 }
263 _sim.addMaterial(class_name, genName(flow_channel.name(), "whtc_mat", i), params);
264 break;
265 }
267 {
268
269 const std::string class_name = "ADWallHeatTransferCoefficientMikityukMaterial";
270 InputParameters params = _factory.getValidParams(class_name);
271 params.set<MaterialPropertyName>("Hw") = flow_channel.getWallHTCNames1Phase()[i];
272 params.set<MaterialPropertyName>("T_wall") = flow_channel.getWallTemperatureNames()[i];
273 params.set<std::vector<SubdomainName>>("block") = flow_channel.getSubdomainNames();
274 params.set<Real>("PoD") = flow_channel.getParam<Real>("PoD");
275 if (flow_channel.getParam<Real>("PoD") == 1.0)
276 {
277 mooseDoOnce(mooseWarning(
278 "You are using a rod bundle correlation with the default Pitch-to-Diameter "
279 "ratio value, P/D=1.0. It can be set using the PoD parameter in the corresponding "
280 "FlowChannel1Phase component"));
281 }
282 _sim.addMaterial(class_name, genName(flow_channel.name(), "whtc_mat", i), params);
283 break;
284 }
286 {
287
288 const std::string class_name = "ADWallHeatTransferCoefficientSchadMaterial";
289 InputParameters params = _factory.getValidParams(class_name);
290 params.set<MaterialPropertyName>("Hw") = flow_channel.getWallHTCNames1Phase()[i];
291 params.set<MaterialPropertyName>("T_wall") = flow_channel.getWallTemperatureNames()[i];
292 params.set<std::vector<SubdomainName>>("block") = flow_channel.getSubdomainNames();
293 params.set<Real>("PoD") = flow_channel.getParam<Real>("PoD");
294 if (flow_channel.getParam<Real>("PoD") == 1.0)
295 {
296 mooseDoOnce(mooseWarning(
297 "You are using a rod bundle correlation with the default Pitch-to-Diameter "
298 "ratio value, P/D=1.0. It can be set using the PoD parameter in the corresponding "
299 "FlowChannel1Phase component"));
300 }
301 _sim.addMaterial(class_name, genName(flow_channel.name(), "whtc_mat", i), params);
302 break;
303 }
305 {
306
307 const std::string class_name = "ADWallHeatTransferCoefficientGnielinskiMaterial";
308 InputParameters params = _factory.getValidParams(class_name);
309 params.set<MaterialPropertyName>("Hw") = flow_channel.getWallHTCNames1Phase()[i];
310 params.set<MaterialPropertyName>("T_wall") = flow_channel.getWallTemperatureNames()[i];
311 params.set<std::vector<SubdomainName>>("block") = flow_channel.getSubdomainNames();
312 _sim.addMaterial(class_name, genName(flow_channel.name(), "whtc_mat", i), params);
313 break;
314 }
315 default:
316 mooseError("Invalid WallHTCClosureType");
317 }
318}
registerMooseObject("ThermalHydraulicsApp", Closures1PhaseTHM)
Base class for 1-phase closures.
static InputParameters validParams()
void addWallFrictionFunctionMaterial(const FlowChannel1Phase &flow_channel) const
Adds material that computes wall friction factor from a specified function.
THM 1-phase closures.
const WallHTCClosureType _wall_htc_closure
Wall heat transfer coefficient closure.
virtual void checkHeatTransfer(const HeatTransferBase &heat_transfer, const FlowChannelBase &flow_channel) const override
Checks for errors associated with a heat transfer component.
void addWallFFMaterial(const FlowChannel1Phase &flow_channel) const
Adds material that computes wall friction factor.
Closures1PhaseTHM(const InputParameters &params)
void addWallHTCMaterial(const FlowChannel1Phase &flow_channel, unsigned int i) const
Adds wall heat transfer coefficient material.
WallHTCClosureType
Fluid heat transfer coefficient closure type.
WallFFClosureType
Fluid friction factor closure type.
const WallFFClosureType _wall_ff_closure
Wall friction factor closure.
static InputParameters validParams()
virtual void addMooseObjectsFlowChannel(const FlowChannelBase &flow_channel) override
Adds MOOSE objects associated with a flow channel component.
virtual void checkFlowChannel(const FlowChannelBase &flow_channel) const override
Checks for errors associated with a flow channel component.
Factory & _factory
Factory associated with the MooseApp.
void addWallTemperatureFromAuxMaterial(const FlowChannelBase &flow_channel, unsigned int i=0) const
Adds a material for wall temperature from an aux variable.
THMProblem & _sim
Simulation.
virtual const std::vector< SubdomainName > & getSubdomainNames() const
Gets the subdomain names for this component.
Definition Component.C:345
void connectObject(const InputParameters &obj_params, const std::string &obj_name, const std::string &param) const
Connects a controllable parameter of the component to a controllable parameter of a constituent objec...
Definition Component.C:98
virtual void addMaterial(const std::string &material_name, const std::string &name, InputParameters &parameters)
InputParameters getValidParams(const std::string &name) const
std::vector< MaterialPropertyName > getWallHTCNames1Phase() const
Gets 1-phase wall heat transfer coefficient names for connected heat transfers.
Single-component, single-phase flow channel.
A base class for flow channels.
static MooseEnum getPipeLocation(const std::string &name)
Gets a MooseEnum for pipe location.
@ ROD_BUNDLE
square array rod bundle geometry
@ HEX_ROD_BUNDLE
hexagonal array rod bundle geometry
@ PIPE
pipe geometry
unsigned int getNumberOfHeatTransferConnections() const
Gets the number of heat transfer connections.
std::vector< VariableName > getWallTemperatureNames() const
Gets wall temperature names for connected heat transfers.
EConvHeatTransGeom getHeatTransferGeometry() const
Gets heat transfer geometry.
bool getTemperatureMode() const
Gets temperature mode flag.
static const std::string DENSITY
static const std::string HYDRAULIC_DIAMETER
static const std::string VELOCITY
static const std::string DYNAMIC_VISCOSITY
static const std::string FRICTION_FACTOR_DARCY
static const std::string SPECIFIC_HEAT_CONSTANT_PRESSURE
static const std::string THERMAL_CONDUCTIVITY
static const std::string TEMPERATURE
Base class for heat transfer connections.
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)
T & set(const std::string &name, bool quiet_mode=false)
const std::string & name() const
void mooseError(Args &&... args) const
void mooseWarning(Args &&... args) const
const T & getParam(const std::string &name) const
bool isParamValid(const std::string &name) const
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.