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