Line data Source code
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 :
17 : InputParameters
18 486 : Closures1PhaseTHM::validParams()
19 : {
20 486 : InputParameters params = Closures1PhaseBase::validParams();
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 972 : "dittus_boelter");
25 972 : params.addParam<MooseEnum>(
26 : "wall_htc_closure", wall_htc_closure, "Heat transfer coefficient closure");
27 972 : MooseEnum wall_ff_closure("cheng_todreas=0 churchill=1", "churchill");
28 972 : params.addParam<MooseEnum>("wall_ff_closure", wall_ff_closure, "Friction factor closure");
29 486 : params.addClassDescription("Closures for 1-phase flow channels");
30 486 : return params;
31 486 : }
32 :
33 243 : Closures1PhaseTHM::Closures1PhaseTHM(const InputParameters & params)
34 : : Closures1PhaseBase(params),
35 243 : _wall_htc_closure(getParam<MooseEnum>("wall_htc_closure").getEnum<WallHTCClosureType>()),
36 729 : _wall_ff_closure(getParam<MooseEnum>("wall_ff_closure").getEnum<WallFFClosureType>())
37 : {
38 243 : }
39 :
40 : void
41 513 : Closures1PhaseTHM::checkFlowChannel(const FlowChannelBase & /*flow_channel*/) const
42 : {
43 513 : }
44 :
45 : void
46 264 : Closures1PhaseTHM::checkHeatTransfer(const HeatTransferBase & /*heat_transfer*/,
47 : const FlowChannelBase & /*flow_channel*/) const
48 : {
49 264 : }
50 :
51 : void
52 513 : Closures1PhaseTHM::addMooseObjectsFlowChannel(const FlowChannelBase & flow_channel)
53 : {
54 : const FlowChannel1Phase & flow_channel_1phase =
55 513 : dynamic_cast<const FlowChannel1Phase &>(flow_channel);
56 :
57 : // wall friction material
58 1026 : if (flow_channel.isParamValid("f"))
59 19 : addWallFrictionFunctionMaterial(flow_channel_1phase);
60 : else
61 494 : addWallFFMaterial(flow_channel_1phase);
62 :
63 : const unsigned int n_ht_connections = flow_channel_1phase.getNumberOfHeatTransferConnections();
64 513 : if (n_ht_connections > 0)
65 : {
66 :
67 528 : for (unsigned int i = 0; i < n_ht_connections; i++)
68 : {
69 : // wall heat transfer coefficient material
70 264 : addWallHTCMaterial(flow_channel_1phase, i);
71 :
72 : // wall temperature material
73 264 : if (flow_channel.getTemperatureMode())
74 264 : addWallTemperatureFromAuxMaterial(flow_channel_1phase, i);
75 : else
76 0 : addTemperatureWallFromHeatFluxMaterial(flow_channel_1phase, i);
77 : }
78 : }
79 513 : }
80 : void
81 494 : Closures1PhaseTHM::addWallFFMaterial(const FlowChannel1Phase & flow_channel) const
82 : {
83 494 : switch (_wall_ff_closure)
84 : {
85 : case WallFFClosureType::CHURCHILL:
86 : {
87 475 : const std::string class_name = "ADWallFrictionChurchillMaterial";
88 475 : InputParameters params = _factory.getValidParams(class_name);
89 950 : params.set<std::vector<SubdomainName>>("block") = flow_channel.getSubdomainNames();
90 950 : params.set<MaterialPropertyName>("rho") = FlowModelSinglePhase::DENSITY;
91 950 : params.set<MaterialPropertyName>("vel") = FlowModelSinglePhase::VELOCITY;
92 950 : params.set<MaterialPropertyName>("D_h") = FlowModelSinglePhase::HYDRAULIC_DIAMETER;
93 950 : params.set<MaterialPropertyName>("f_D") = FlowModelSinglePhase::FRICTION_FACTOR_DARCY;
94 950 : params.set<MaterialPropertyName>("mu") = FlowModelSinglePhase::DYNAMIC_VISCOSITY;
95 950 : params.set<Real>("roughness") = flow_channel.getParam<Real>("roughness");
96 950 : const std::string obj_name = genName(flow_channel.name(), "wall_friction_mat");
97 475 : _sim.addMaterial(class_name, obj_name, params);
98 950 : flow_channel.connectObject(params, obj_name, "roughness");
99 : break;
100 475 : }
101 : case WallFFClosureType::CHENG_TODREAS:
102 : {
103 19 : const std::string class_name = "ADWallFrictionChengMaterial";
104 19 : InputParameters params = _factory.getValidParams(class_name);
105 38 : params.set<std::vector<SubdomainName>>("block") = flow_channel.getSubdomainNames();
106 38 : params.set<MaterialPropertyName>("f_D") = FlowModelSinglePhase::FRICTION_FACTOR_DARCY;
107 38 : params.set<Real>("PoD") = flow_channel.getParam<Real>("PoD");
108 38 : if (flow_channel.getParam<Real>("PoD") == 1.0)
109 : {
110 0 : 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 19 : if (flow_channel.getHeatTransferGeometry() == FlowChannelBase::EConvHeatTransGeom::PIPE)
116 : {
117 0 : 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 19 : else if (flow_channel.getHeatTransferGeometry() ==
123 : FlowChannelBase::EConvHeatTransGeom::ROD_BUNDLE)
124 : {
125 0 : params.set<MooseEnum>("bundle_array") = "SQUARE";
126 : }
127 19 : else if (flow_channel.getHeatTransferGeometry() ==
128 : FlowChannelBase::EConvHeatTransGeom::HEX_ROD_BUNDLE)
129 : {
130 38 : params.set<MooseEnum>("bundle_array") = "HEXAGONAL";
131 : }
132 19 : if (flow_channel.getPipeLocation() == FlowChannelBase::EPipeLocation::INTERIOR)
133 : {
134 38 : params.set<MooseEnum>("subchannel_type") = "INTERIOR";
135 : }
136 0 : else if (flow_channel.getPipeLocation() == FlowChannelBase::EPipeLocation::EDGE)
137 : {
138 0 : params.set<MooseEnum>("subchannel_type") = "EDGE";
139 : }
140 0 : else if (flow_channel.getPipeLocation() == FlowChannelBase::EPipeLocation::CORNER)
141 : {
142 0 : params.set<MooseEnum>("subchannel_type") = "CORNER";
143 : }
144 38 : const std::string obj_name = genName(flow_channel.name(), "wall_friction_mat");
145 19 : _sim.addMaterial(class_name, obj_name, params);
146 : break;
147 19 : }
148 0 : default:
149 0 : mooseError("Invalid WallFFClosureType");
150 : }
151 494 : }
152 :
153 : void
154 264 : Closures1PhaseTHM::addWallHTCMaterial(const FlowChannel1Phase & flow_channel, unsigned int i) const
155 : {
156 :
157 264 : switch (_wall_htc_closure)
158 : {
159 : case WallHTCClosureType::DITTUS_BOELTER:
160 : {
161 131 : const std::string class_name = "ADWallHeatTransferCoefficient3EqnDittusBoelterMaterial";
162 131 : InputParameters params = _factory.getValidParams(class_name);
163 262 : params.set<MaterialPropertyName>("Hw") = flow_channel.getWallHTCNames1Phase()[i];
164 262 : params.set<MaterialPropertyName>("D_h") = FlowModelSinglePhase::HYDRAULIC_DIAMETER;
165 262 : params.set<MaterialPropertyName>("rho") = FlowModelSinglePhase::DENSITY;
166 262 : params.set<MaterialPropertyName>("vel") = FlowModelSinglePhase::VELOCITY;
167 262 : params.set<MaterialPropertyName>("T") = FlowModelSinglePhase::TEMPERATURE;
168 262 : params.set<MaterialPropertyName>("k") = FlowModelSinglePhase::THERMAL_CONDUCTIVITY;
169 262 : params.set<MaterialPropertyName>("mu") = FlowModelSinglePhase::DYNAMIC_VISCOSITY;
170 262 : params.set<MaterialPropertyName>("cp") =
171 131 : FlowModelSinglePhase::SPECIFIC_HEAT_CONSTANT_PRESSURE;
172 262 : params.set<MaterialPropertyName>("T_wall") = flow_channel.getWallTemperatureNames()[i];
173 131 : params.set<std::vector<SubdomainName>>("block") = flow_channel.getSubdomainNames();
174 131 : _sim.addMaterial(class_name, genName(flow_channel.name(), "whtc_mat", i), params);
175 :
176 : break;
177 131 : }
178 : case WallHTCClosureType::WOLF_MCCARTHY:
179 : {
180 19 : const std::string class_name = "ADWallHeatTransferCoefficientWolfMcCarthyMaterial";
181 19 : InputParameters params = _factory.getValidParams(class_name);
182 38 : params.set<MaterialPropertyName>("Hw") = flow_channel.getWallHTCNames1Phase()[i];
183 38 : params.set<MaterialPropertyName>("T_wall") = flow_channel.getWallTemperatureNames()[i];
184 19 : params.set<std::vector<SubdomainName>>("block") = flow_channel.getSubdomainNames();
185 19 : _sim.addMaterial(class_name, genName(flow_channel.name(), "whtc_mat", i), params);
186 :
187 : break;
188 19 : }
189 : case WallHTCClosureType::WEISMAN:
190 : {
191 :
192 19 : const std::string class_name = "ADWallHeatTransferCoefficientWeismanMaterial";
193 19 : InputParameters params = _factory.getValidParams(class_name);
194 38 : params.set<MaterialPropertyName>("Hw") = flow_channel.getWallHTCNames1Phase()[i];
195 38 : params.set<MaterialPropertyName>("T_wall") = flow_channel.getWallTemperatureNames()[i];
196 19 : params.set<std::vector<SubdomainName>>("block") = flow_channel.getSubdomainNames();
197 38 : params.set<Real>("PoD") = flow_channel.getParam<Real>("PoD");
198 38 : if (flow_channel.getParam<Real>("PoD") == 1.0)
199 : {
200 0 : 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 19 : if (flow_channel.getHeatTransferGeometry() == FlowChannelBase::EConvHeatTransGeom::PIPE)
207 : {
208 0 : 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 19 : else if (flow_channel.getHeatTransferGeometry() ==
213 : FlowChannelBase::EConvHeatTransGeom::ROD_BUNDLE)
214 : {
215 0 : params.set<MooseEnum>("bundle_array") = "SQUARE";
216 : }
217 19 : else if (flow_channel.getHeatTransferGeometry() ==
218 : FlowChannelBase::EConvHeatTransGeom::HEX_ROD_BUNDLE)
219 : {
220 38 : params.set<MooseEnum>("bundle_array") = "TRIANGULAR";
221 : }
222 19 : _sim.addMaterial(class_name, genName(flow_channel.name(), "whtc_mat", i), params);
223 : break;
224 19 : }
225 : case WallHTCClosureType::LYON:
226 : {
227 19 : const std::string class_name = "ADWallHeatTransferCoefficientLyonMaterial";
228 19 : InputParameters params = _factory.getValidParams(class_name);
229 38 : params.set<MaterialPropertyName>("Hw") = flow_channel.getWallHTCNames1Phase()[i];
230 38 : params.set<MaterialPropertyName>("T_wall") = flow_channel.getWallTemperatureNames()[i];
231 19 : params.set<std::vector<SubdomainName>>("block") = flow_channel.getSubdomainNames();
232 19 : _sim.addMaterial(class_name, genName(flow_channel.name(), "whtc_mat", i), params);
233 : break;
234 19 : }
235 : case WallHTCClosureType::KAZIMI_CARELLI:
236 : {
237 :
238 19 : const std::string class_name = "ADWallHeatTransferCoefficientKazimiMaterial";
239 19 : InputParameters params = _factory.getValidParams(class_name);
240 38 : params.set<MaterialPropertyName>("Hw") = flow_channel.getWallHTCNames1Phase()[i];
241 38 : params.set<MaterialPropertyName>("T_wall") = flow_channel.getWallTemperatureNames()[i];
242 19 : params.set<std::vector<SubdomainName>>("block") = flow_channel.getSubdomainNames();
243 38 : params.set<Real>("PoD") = flow_channel.getParam<Real>("PoD");
244 38 : if (flow_channel.getParam<Real>("PoD") == 1.0)
245 : {
246 0 : 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 19 : _sim.addMaterial(class_name, genName(flow_channel.name(), "whtc_mat", i), params);
252 : break;
253 19 : }
254 : case WallHTCClosureType::MIKITYUK:
255 : {
256 :
257 19 : const std::string class_name = "ADWallHeatTransferCoefficientMikityukMaterial";
258 19 : InputParameters params = _factory.getValidParams(class_name);
259 38 : params.set<MaterialPropertyName>("Hw") = flow_channel.getWallHTCNames1Phase()[i];
260 38 : params.set<MaterialPropertyName>("T_wall") = flow_channel.getWallTemperatureNames()[i];
261 19 : params.set<std::vector<SubdomainName>>("block") = flow_channel.getSubdomainNames();
262 38 : params.set<Real>("PoD") = flow_channel.getParam<Real>("PoD");
263 38 : if (flow_channel.getParam<Real>("PoD") == 1.0)
264 : {
265 0 : 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 19 : _sim.addMaterial(class_name, genName(flow_channel.name(), "whtc_mat", i), params);
271 : break;
272 19 : }
273 : case WallHTCClosureType::SCHAD:
274 : {
275 :
276 19 : const std::string class_name = "ADWallHeatTransferCoefficientSchadMaterial";
277 19 : InputParameters params = _factory.getValidParams(class_name);
278 38 : params.set<MaterialPropertyName>("Hw") = flow_channel.getWallHTCNames1Phase()[i];
279 38 : params.set<MaterialPropertyName>("T_wall") = flow_channel.getWallTemperatureNames()[i];
280 19 : params.set<std::vector<SubdomainName>>("block") = flow_channel.getSubdomainNames();
281 38 : params.set<Real>("PoD") = flow_channel.getParam<Real>("PoD");
282 38 : if (flow_channel.getParam<Real>("PoD") == 1.0)
283 : {
284 0 : 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 19 : _sim.addMaterial(class_name, genName(flow_channel.name(), "whtc_mat", i), params);
290 : break;
291 19 : }
292 : case WallHTCClosureType::GNIELINSKI:
293 : {
294 :
295 19 : const std::string class_name = "ADWallHeatTransferCoefficientGnielinskiMaterial";
296 19 : InputParameters params = _factory.getValidParams(class_name);
297 38 : params.set<MaterialPropertyName>("Hw") = flow_channel.getWallHTCNames1Phase()[i];
298 38 : params.set<MaterialPropertyName>("T_wall") = flow_channel.getWallTemperatureNames()[i];
299 19 : params.set<std::vector<SubdomainName>>("block") = flow_channel.getSubdomainNames();
300 19 : _sim.addMaterial(class_name, genName(flow_channel.name(), "whtc_mat", i), params);
301 : break;
302 19 : }
303 0 : default:
304 0 : mooseError("Invalid WallHTCClosureType");
305 : }
306 264 : }
307 : void
308 0 : Closures1PhaseTHM::addTemperatureWallFromHeatFluxMaterial(const FlowChannel1Phase & flow_channel,
309 : unsigned int i) const
310 : {
311 0 : const std::string class_name = "TemperatureWallFromHeatFlux3EqnTHMMaterial";
312 0 : InputParameters params = _factory.getValidParams(class_name);
313 0 : params.set<std::vector<SubdomainName>>("block") = flow_channel.getSubdomainNames();
314 0 : params.set<MaterialPropertyName>("T_wall") = flow_channel.getWallTemperatureNames()[i];
315 0 : params.set<MaterialPropertyName>("D_h") = FlowModelSinglePhase::HYDRAULIC_DIAMETER;
316 0 : params.set<MaterialPropertyName>("rho") = FlowModelSinglePhase::DENSITY;
317 0 : params.set<MaterialPropertyName>("vel") = FlowModelSinglePhase::VELOCITY;
318 0 : params.set<MaterialPropertyName>("T") = FlowModelSinglePhase::TEMPERATURE;
319 0 : params.set<MaterialPropertyName>("k") = FlowModelSinglePhase::THERMAL_CONDUCTIVITY;
320 0 : params.set<MaterialPropertyName>("mu") = FlowModelSinglePhase::DYNAMIC_VISCOSITY;
321 0 : params.set<MaterialPropertyName>("cp") = FlowModelSinglePhase::SPECIFIC_HEAT_CONSTANT_PRESSURE;
322 0 : params.set<MaterialPropertyName>("q_wall") = flow_channel.getWallHeatFluxNames()[i];
323 0 : _sim.addMaterial(class_name, genName(flow_channel.name(), "T_from_q_wall_mat", i), params);
324 0 : }
|