-
Notifications
You must be signed in to change notification settings - Fork 857
/
Copy pathtutorials.py
344 lines (298 loc) · 17.4 KB
/
tutorials.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
#!/usr/bin/env python
## \file parallel_regression.py
# \brief Python script for automated regression testing of SU2 examples
# \author A. Aranake, A. Campos, T. Economon, T. Lukaczyk, S. Padron
# \version 8.1.0 "Harrier"
#
# SU2 Project Website: https://su2code.github.io
#
# The SU2 Project is maintained by the SU2 Foundation
# (http://su2foundation.org)
#
# Copyright 2012-2024, SU2 Contributors (cf. AUTHORS.md)
#
# SU2 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# SU2 is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with SU2. If not, see <http://www.gnu.org/licenses/>.
# make print(*args) function available in PY2.6+, does'nt work on PY < 2.6
from __future__ import print_function
import sys
from TestCase import TestCase
def main():
'''This program runs SU2 and ensures that the output matches specified values.
This will be used to do checks when code is pushed to github
to make sure nothing is broken. '''
test_list = []
######################################
### RUN TUTORIAL CASES ###
######################################
### CHT
# CHT incompressible unsteady
cht_incompressible_unsteady = TestCase('cht_incompressible_unsteady')
cht_incompressible_unsteady.cfg_dir = "../Tutorials/multiphysics/unsteady_cht/"
cht_incompressible_unsteady.cfg_file = "cht_2d_3cylinders.cfg"
cht_incompressible_unsteady.test_iter = 2
cht_incompressible_unsteady.test_vals = [-2.659390, -2.533160, -0.080399, -0.080399, -0.080399, -12.421450, 0.000000, 0, 0, 0, 0, 2.3824e+02] #last columns
cht_incompressible_unsteady.multizone = True
cht_incompressible_unsteady.unsteady = True
test_list.append(cht_incompressible_unsteady)
# CHT incompressible, 2D, 3 pins in crossflow
cht_incompressible = TestCase('cht_incompressible')
cht_incompressible.cfg_dir = "../Tutorials/multiphysics/steady_cht"
cht_incompressible.cfg_file = "cht_2d_3cylinders.cfg"
cht_incompressible.test_iter = 10
cht_incompressible.test_vals = [-2.128826, -0.588813, -0.588813, -0.588813] #last 4 columns
cht_incompressible.command = TestCase.Command(exec = "SU2_CFD")
cht_incompressible.multizone = True
test_list.append(cht_incompressible)
# Solid-to-solid and solid-to-fluid CHT with contact resistance
cht_CR = TestCase('cht_solid_solid')
cht_CR.cfg_dir = "../Tutorials/multiphysics/contact_resistance_cht"
cht_CR.cfg_file = "master.cfg"
cht_CR.test_iter = 80
cht_CR.test_vals = [ -8.857438, -9.377593, -10.097769, -2.122358]
cht_CR.multizone = True
test_list.append(cht_CR)
### Incompressible Flow
# 2D pin case massflow periodic with heatflux BC and prescribed extracted outlet heat
sp_pinArray_2d_mf_hf = TestCase('sp_pinArray_2d_mf_hf')
sp_pinArray_2d_mf_hf.cfg_dir = "../Tutorials/incompressible_flow/Inc_Streamwise_Periodic"
sp_pinArray_2d_mf_hf.cfg_file = "sp_pinArray_2d_mf_hf.cfg"
sp_pinArray_2d_mf_hf.test_iter = 25
sp_pinArray_2d_mf_hf.test_vals = [-4.613682, 1.471278, -0.748987, 241.667177]
test_list.append(sp_pinArray_2d_mf_hf)
# 2D pin case pressure drop periodic with heatflux BC and temperature periodicity
sp_pinArray_2d_dp_hf_tp = TestCase('sp_pinArray_2d_dp_hf_tp')
sp_pinArray_2d_dp_hf_tp.cfg_dir = "../Tutorials/incompressible_flow/Inc_Streamwise_Periodic"
sp_pinArray_2d_dp_hf_tp.cfg_file = "sp_pinArray_2d_dp_hf_tp.cfg"
sp_pinArray_2d_dp_hf_tp.test_iter = 25
sp_pinArray_2d_dp_hf_tp.test_vals = [-4.640621, 1.436697, -0.707302, 208.023676]
test_list.append(sp_pinArray_2d_dp_hf_tp)
### Species Transport
# 3 species (2 eq) primitive venturi mixing
species3_primitiveVenturi = TestCase('species3_primitiveVenturi')
species3_primitiveVenturi.cfg_dir = "../Tutorials/incompressible_flow/Inc_Species_Transport"
species3_primitiveVenturi.cfg_file = "species3_primitiveVenturi.cfg"
species3_primitiveVenturi.test_iter = 50
species3_primitiveVenturi.test_vals = [-5.869509, -5.252493, -5.127926, -5.912790, -1.767067, -6.152558, -6.304196, 5.000000, -0.933280, 5.000000, -2.314730, 5.000000, -0.680255, 1.649865, 0.500678, 0.596475, 0.552712]
test_list.append(species3_primitiveVenturi)
# 3 species (2 eq) primitive venturi mixing
DAspecies3_primitiveVenturi = TestCase('DAspecies3_primitiveVenturi')
DAspecies3_primitiveVenturi.cfg_dir = "../Tutorials/incompressible_flow/Inc_Species_Transport"
DAspecies3_primitiveVenturi.cfg_file = "DAspecies3_primitiveVenturi.cfg"
DAspecies3_primitiveVenturi.test_iter = 50
DAspecies3_primitiveVenturi.test_vals = [-7.584508, -7.211527, -6.740742, -6.896386, -11.472089, -10.865347, -10.096770]
DAspecies3_primitiveVenturi.test_vals_aarch64 = [-7.865411, -7.548131, -7.347978, -7.217536, -11.822422, -10.968444, -10.193225]
DAspecies3_primitiveVenturi.command = TestCase.Command("mpirun -n 2", "SU2_CFD_AD")
test_list.append(DAspecies3_primitiveVenturi)
# 2 species (1 eq) kenics static mixer for composition-dependent model
kenics_mixer_tutorial = TestCase('kenics_mixer_tutorial')
kenics_mixer_tutorial.cfg_dir = "../Tutorials/incompressible_flow/Inc_Species_Transport_Composition_Dependent_Model"
kenics_mixer_tutorial.cfg_file = "kenics_mixer_tutorial.cfg"
kenics_mixer_tutorial.test_iter = 10
kenics_mixer_tutorial.test_vals = [-7.489796, -6.823473, -6.838032, -5.157793, -7.911512, -3.166212, -7.447901, 5.000000, -1.862212, 4.000000, -5.131048, 3.000000, -6.380193, 0.025472, 0.000000, 0.025472, 0.000000, 64.105000, 8.479200, 48.099000, 7.526700]
kenics_mixer_tutorial.command = TestCase.Command("mpirun -n 2", "SU2_CFD")
test_list.append(kenics_mixer_tutorial)
# 90 degree pipe bend with wall functions from the experiments of Sudo et al.
sudo_tutorial = TestCase('sudo_bend')
sudo_tutorial.cfg_dir = "../Tutorials/incompressible_flow/Inc_Turbulent_Bend_Wallfunctions"
sudo_tutorial.cfg_file = "sudo.cfg"
sudo_tutorial.test_iter = 10
sudo_tutorial.test_vals = [-14.579462, -13.203791, -13.601782, -12.616876, -14.005299, -10.817605, 15.000000, -2.296083]
sudo_tutorial.command = TestCase.Command("mpirun -n 2", "SU2_CFD")
test_list.append(sudo_tutorial)
### Incompressible Combustion
# Pre-mixed, laminar hydrogen flame with heat loss
premixed_hydrogen = TestCase('premixed_hydrogen')
premixed_hydrogen.cfg_dir = "../Tutorials/incompressible_flow/Inc_Combustion/1__premixed_hydrogen"
premixed_hydrogen.cfg_file = "H2_burner.cfg"
premixed_hydrogen.test_iter = 10
premixed_hydrogen.test_vals = [-9.809794, -10.369804, -11.044267, -4.332945, -11.883789]
test_list.append(premixed_hydrogen)
### Compressible Flow
# Inviscid Bump
tutorial_inv_bump = TestCase('inviscid_bump_tutorial')
tutorial_inv_bump.cfg_dir = "../Tutorials/compressible_flow/Inviscid_Bump"
tutorial_inv_bump.cfg_file = "inv_channel.cfg"
tutorial_inv_bump.test_iter = 0
tutorial_inv_bump.test_vals = [-1.548003, 3.983585, 0.020973, 0.071064]
test_list.append(tutorial_inv_bump)
# Inviscid Wedge
tutorial_inv_wedge = TestCase('inviscid_wedge_tutorial')
tutorial_inv_wedge.cfg_dir = "../Tutorials/compressible_flow/Inviscid_Wedge"
tutorial_inv_wedge.cfg_file = "inv_wedge_HLLC.cfg"
tutorial_inv_wedge.test_iter = 0
tutorial_inv_wedge.test_vals = [-0.864206, 4.850246, -0.245674, 0.043209]
tutorial_inv_wedge.no_restart = True
test_list.append(tutorial_inv_wedge)
# Inviscid ONERA M6
tutorial_inv_onera = TestCase('inviscid_onera_tutorial')
tutorial_inv_onera.cfg_dir = "../Tutorials/compressible_flow/Inviscid_ONERAM6"
tutorial_inv_onera.cfg_file = "inv_ONERAM6.cfg"
tutorial_inv_onera.test_iter = 0
tutorial_inv_onera.test_vals = [-5.504789, -4.895776, 0.249157, 0.118834]
tutorial_inv_onera.no_restart = True
test_list.append(tutorial_inv_onera)
# Laminar Cylinder
tutorial_lam_cylinder = TestCase('laminar_cylinder_tutorial')
tutorial_lam_cylinder.cfg_dir = "../Tutorials/compressible_flow/Laminar_Cylinder"
tutorial_lam_cylinder.cfg_file = "lam_cylinder.cfg"
tutorial_lam_cylinder.test_iter = 0
tutorial_lam_cylinder.test_vals = [-6.162141, -0.699617, 0.125776, 69.613563]
tutorial_lam_cylinder.no_restart = True
test_list.append(tutorial_lam_cylinder)
# Laminar Flat Plate
tutorial_lam_flatplate = TestCase('laminar_flatplate_tutorial')
tutorial_lam_flatplate.cfg_dir = "../Tutorials/compressible_flow/Laminar_Flat_Plate"
tutorial_lam_flatplate.cfg_file = "lam_flatplate.cfg"
tutorial_lam_flatplate.test_iter = 0
tutorial_lam_flatplate.test_vals = [-2.821818, 2.657591, -0.400044, 0.029365] #last 4 columns
tutorial_lam_flatplate.no_restart = True
test_list.append(tutorial_lam_flatplate)
# Turbulent Flat Plate
tutorial_turb_flatplate = TestCase('turbulent_flatplate_tutorial')
tutorial_turb_flatplate.cfg_dir = "../Tutorials/compressible_flow/Turbulent_Flat_Plate"
tutorial_turb_flatplate.cfg_file = "turb_SA_flatplate.cfg"
tutorial_turb_flatplate.test_iter = 0
tutorial_turb_flatplate.test_vals = [-2.258584, -4.901015, -0.429373, 0.201034]
tutorial_turb_flatplate.no_restart = True
test_list.append(tutorial_turb_flatplate)
# Transitional FlatPlate
tutorial_trans_flatplate = TestCase('transitional_flatplate_tutorial')
tutorial_trans_flatplate.cfg_dir = "../Tutorials/compressible_flow/Transitional_Flat_Plate"
tutorial_trans_flatplate.cfg_file = "transitional_BC_model_ConfigFile.cfg"
tutorial_trans_flatplate.test_iter = 0
tutorial_trans_flatplate.test_vals = [-22.021786, -15.330766, 0.000000, 0.023952] #last 4 columns
tutorial_trans_flatplate.no_restart = True
test_list.append(tutorial_trans_flatplate)
# Transitional FlatPlate T3A
tutorial_trans_flatplate_T3A = TestCase('transitional_flatplate_tutorial_T3A')
tutorial_trans_flatplate_T3A.cfg_dir = "../Tutorials/compressible_flow/Transitional_Flat_Plate/Langtry_and_Menter/T3A"
tutorial_trans_flatplate_T3A.cfg_file = "transitional_LM_model_ConfigFile.cfg"
tutorial_trans_flatplate_T3A.test_iter = 20
tutorial_trans_flatplate_T3A.test_vals = [-5.837399, -2.092246, -3.983493, -0.302381, -1.920868, 1.667180, -3.496278, 0.391608]
tutorial_trans_flatplate_T3A.test_vals_aarch64 = [-5.837368, -2.092246, -3.984172, -0.302357, -1.928108, 1.667157, -3.496279, 0.391610]
tutorial_trans_flatplate_T3A.no_restart = True
test_list.append(tutorial_trans_flatplate_T3A)
# Transitional FlatPlate T3Am
tutorial_trans_flatplate_T3Am = TestCase('transitional_flatplate_tutorial_T3Am')
tutorial_trans_flatplate_T3Am.cfg_dir = "../Tutorials/compressible_flow/Transitional_Flat_Plate/Langtry_and_Menter/T3A-"
tutorial_trans_flatplate_T3Am.cfg_file = "transitional_LM_model_ConfigFile.cfg"
tutorial_trans_flatplate_T3Am.test_iter = 20
tutorial_trans_flatplate_T3Am.test_vals = [-6.063700, -1.945073, -3.946836, -0.549147, -3.863792, 2.664440, -2.517610, 1.112977]
tutorial_trans_flatplate_T3Am.test_vals_aarch64 = [-6.063726, -1.945088, -3.946923, -0.549166, -3.863794, 2.664439, -2.517601, 1.112978]
tutorial_trans_flatplate_T3Am.no_restart = True
test_list.append(tutorial_trans_flatplate_T3Am)
# Transitional E387 SA
tutorial_trans_e387_sa = TestCase('tutorial_trans_e387_sa')
tutorial_trans_e387_sa.cfg_dir = "../Tutorials/compressible_flow/Transitional_Airfoil/Langtry_and_Menter/E387"
tutorial_trans_e387_sa.cfg_file = "transitional_SA_LM_model_ConfigFile.cfg"
tutorial_trans_e387_sa.test_iter = 20
tutorial_trans_e387_sa.test_vals = [-6.527027, -5.081560, -0.795267, 1.022556, 0.150189, 2.000000, -9.580669]
tutorial_trans_e387_sa.no_restart = True
test_list.append(tutorial_trans_e387_sa)
# Transitional E387 SST
tutorial_trans_e387_sst = TestCase('tutorial_trans_e387_sst')
tutorial_trans_e387_sst.cfg_dir = "../Tutorials/compressible_flow/Transitional_Airfoil/Langtry_and_Menter/E387"
tutorial_trans_e387_sst.cfg_file = "transitional_SST_LM_model_ConfigFile.cfg"
tutorial_trans_e387_sst.test_iter = 20
tutorial_trans_e387_sst.test_vals = [-6.532424, -5.085816, -0.789725, 1.078014, 0.188274, 2.000000, -9.567012]
tutorial_trans_e387_sst.no_restart = True
test_list.append(tutorial_trans_e387_sst)
# Turbulent ONERA M6
tutorial_turb_oneram6 = TestCase('turbulent_oneram6_tutorial')
tutorial_turb_oneram6.cfg_dir = "../Tutorials/compressible_flow/Turbulent_ONERAM6"
tutorial_turb_oneram6.cfg_file = "turb_ONERAM6.cfg"
tutorial_turb_oneram6.test_iter = 0
tutorial_turb_oneram6.test_vals = [-4.564441, -11.524295, 0.327905, 0.097340]
test_list.append(tutorial_turb_oneram6)
# NICD Nozzle
tutorial_nicfd_nozzle = TestCase('nicfd_nozzle')
tutorial_nicfd_nozzle.cfg_dir = "../Tutorials/compressible_flow/NICFD_nozzle"
tutorial_nicfd_nozzle.cfg_file = "NICFD_nozzle.cfg"
tutorial_nicfd_nozzle.test_iter = 20
tutorial_nicfd_nozzle.test_vals = [-2.056675, -2.124123, 3.687027, 0.000000, 0.000000]
tutorial_nicfd_nozzle.no_restart = True
test_list.append(tutorial_nicfd_nozzle)
# Unsteady NACA0012
tutorial_unst_naca0012 = TestCase('unsteady_naca0012')
tutorial_unst_naca0012.cfg_dir = "../Tutorials/compressible_flow/Unsteady_NACA0012"
tutorial_unst_naca0012.cfg_file = "unsteady_naca0012.cfg"
tutorial_unst_naca0012.test_iter = 520
tutorial_unst_naca0012.test_vals = [520.000000, 0.000000, -5.291711, 0.000000, 0.305248, 0.810326, 0.001814, 0.006573]
tutorial_unst_naca0012.test_vals_aarch64 = [520.000000, 0.000000, -5.298777, 0.000000, 0.288956, 0.736706, 0.002419, 0.007134]
tutorial_unst_naca0012.unsteady = True
test_list.append(tutorial_unst_naca0012)
# PROPELLER VARIBLE LOAD
propeller_var_load = TestCase('propeller_variable_load')
propeller_var_load.cfg_dir = "../Tutorials/compressible_flow/ActuatorDisk_VariableLoad"
propeller_var_load.cfg_file = "propeller_variable_load.cfg"
propeller_var_load.test_iter = 20
propeller_var_load.test_vals = [-1.830276, -4.535127, -0.000323, 0.171623]
propeller_var_load.timeout = 3200
test_list.append(propeller_var_load)
### Design
# Inviscid NACA 0012 Design
tutorial_design_inv_naca0012 = TestCase('design_inv_naca0012')
tutorial_design_inv_naca0012.cfg_dir = "../Tutorials/design/Inviscid_2D_Unconstrained_NACA0012"
tutorial_design_inv_naca0012.cfg_file = "inv_NACA0012_basic.cfg"
tutorial_design_inv_naca0012.test_iter = 0
tutorial_design_inv_naca0012.test_vals = [-3.918503, -3.332494, 0.134359, 0.218097]
tutorial_design_inv_naca0012.no_restart = True
test_list.append(tutorial_design_inv_naca0012)
# Turbulent RAE 2822 Design
tutorial_design_turb_rae2822 = TestCase('design_turb_rae2822')
tutorial_design_turb_rae2822.cfg_dir = "../Tutorials/design/Turbulent_2D_Constrained_RAE2822"
tutorial_design_turb_rae2822.cfg_file = "turb_SA_RAE2822.cfg"
tutorial_design_turb_rae2822.test_iter = 0
tutorial_design_turb_rae2822.test_vals = [-1.700114, -4.941834, 0.218348, 0.190357]
tutorial_design_turb_rae2822.no_restart = True
test_list.append(tutorial_design_turb_rae2822)
# Multi Objective Design
tutorial_design_multiobj = TestCase('design_multiobj')
tutorial_design_multiobj.cfg_dir = "../Tutorials/design/Multi_Objective_Shape_Design"
tutorial_design_multiobj.cfg_file = "inv_wedge_ROE_multiobj_combo.cfg"
tutorial_design_multiobj.test_iter = 0
tutorial_design_multiobj.test_vals = [2.657333, -3.020635, 370220.000000, 0.000000]
tutorial_design_multiobj.no_restart = True
test_list.append(tutorial_design_multiobj)
######################################
### RUN TESTS ###
######################################
# set suitable defaults unless something else has been specified
# command: "mpirun -n 2 SU2_CFD"
# timeout: 1600
# tol: 0.00001
for test in test_list:
if test.command.empty():
test.command = TestCase.Command("mpirun -n 2", "SU2_CFD")
if test.timeout == 0:
test.timeout = 1600
if test.tol == 0.0:
test.tol = 0.00001
pass_list = [ test.run_test() for test in test_list ]
# Tests summary
print('==================================================================')
print('Summary of the parallel tests')
print('python version:', sys.version)
for i, test in enumerate(test_list):
if (pass_list[i]):
print(' passed - %s'%test.tag)
else:
print('* FAILED - %s'%test.tag)
if all(pass_list):
sys.exit(0)
else:
sys.exit(1)
# done
if __name__ == '__main__':
main()