Skip to content

Commit 57667b2

Browse files
authored
Merge pull request #2423 from su2code/tutorial_bend_Design
Update regression tests for tutorials
2 parents a6067c5 + cff3b38 commit 57667b2

File tree

3 files changed

+54
-9
lines changed

3 files changed

+54
-9
lines changed

TestCases/TestCase.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,14 @@ def run_filediff(self, with_tsan=False, with_asan=False):
361361

362362
# Assert that both files have the same number of lines
363363
if len(fromlines) != len(tolines):
364-
diff = ["ERROR: Number of lines in " + fromfile + " and " + tofile + " differ: " + len(fromlines) + " vs " + len(tolines) + "."]
364+
stringerr = "ERROR: Number of lines in " + str(fromfile) + " and " + str(tofile) + " differ: " + str(len(fromlines)) + " vs " + str(len(tolines)) + "."
365+
diff = [stringerr]
366+
print("generated file = ")
367+
for i_line in tolines:
368+
print(i_line)
369+
for i_line in fromlines:
370+
print(i_line)
371+
365372
passed = False
366373

367374
# Loop through all lines
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ITER, avg_dp
2+
1, 89.03358290403737

TestCases/tutorials.py

Lines changed: 44 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,34 @@ def main():
9191
sp_pinArray_2d_dp_hf_tp.test_vals = [-4.640621, 1.436697, -0.707302, 208.023676]
9292
test_list.append(sp_pinArray_2d_dp_hf_tp)
9393

94+
# 90 degree pipe bend with wall functions from the experiments of Sudo et al.
95+
sudo_tutorial = TestCase('sudo_bend')
96+
sudo_tutorial.cfg_dir = "../Tutorials/incompressible_flow/Inc_Turbulent_Bend_Wallfunctions"
97+
sudo_tutorial.cfg_file = "sudo.cfg"
98+
sudo_tutorial.test_iter = 10
99+
sudo_tutorial.test_vals = [-14.579462, -13.203791, -13.601782, -12.616876, -14.005299, -10.817605, 15.000000, -2.296083]
100+
sudo_tutorial.command = TestCase.Command("mpirun -n 2", "SU2_CFD")
101+
test_list.append(sudo_tutorial)
102+
103+
# design-primal: 90 degree pipe bend with wall functions from the experiments of Sudo et al.
104+
sudo_design_primal = TestCase('sudo_bend_design_primal')
105+
sudo_design_primal.cfg_dir = "../Tutorials/design/Inc_Turbulent_Bend_Wallfunctions"
106+
sudo_design_primal.cfg_file = "sudo_primal.cfg"
107+
sudo_design_primal.test_iter = 10
108+
sudo_design_primal.test_vals = [-13.474698, -12.487574, -12.441102, -11.418111, -12.552674, -9.712569, 89.034000]
109+
sudo_design_primal.command = TestCase.Command("mpirun -n 2", "SU2_CFD")
110+
test_list.append(sudo_design_primal)
111+
112+
# design-adjoint: 90 degree pipe bend with wall functions from the experiments of Sudo et al.
113+
sudo_design_adjoint = TestCase('sudo_bend_design_adjoint')
114+
sudo_design_adjoint.cfg_dir = "../Tutorials/design/Inc_Turbulent_Bend_Wallfunctions"
115+
sudo_design_adjoint.cfg_file = "sudo_adjoint.cfg"
116+
sudo_design_adjoint.test_iter = 10
117+
sudo_design_adjoint.test_vals = [-4.133194, -3.691046, -2.581693, -3.476472, -3.837900, -6.900137]
118+
sudo_design_adjoint.command = TestCase.Command("mpirun -n 2", "SU2_CFD_AD")
119+
test_list.append(sudo_design_adjoint)
120+
121+
94122
### Species Transport
95123

96124
# 3 species (2 eq) primitive venturi mixing
@@ -120,14 +148,6 @@ def main():
120148
kenics_mixer_tutorial.command = TestCase.Command("mpirun -n 2", "SU2_CFD")
121149
test_list.append(kenics_mixer_tutorial)
122150

123-
# 90 degree pipe bend with wall functions from the experiments of Sudo et al.
124-
sudo_tutorial = TestCase('sudo_bend')
125-
sudo_tutorial.cfg_dir = "../Tutorials/incompressible_flow/Inc_Turbulent_Bend_Wallfunctions"
126-
sudo_tutorial.cfg_file = "sudo.cfg"
127-
sudo_tutorial.test_iter = 10
128-
sudo_tutorial.test_vals = [-14.579462, -13.203791, -13.601782, -12.616876, -14.005299, -10.817605, 15.000000, -2.296083]
129-
sudo_tutorial.command = TestCase.Command("mpirun -n 2", "SU2_CFD")
130-
test_list.append(sudo_tutorial)
131151

132152
### Incompressible Combustion
133153

@@ -324,6 +344,22 @@ def main():
324344

325345
pass_list = [ test.run_test() for test in test_list ]
326346

347+
348+
# design-FADO: 90 degree pipe bend optimization
349+
sudo_design_fado = TestCase('sudo_bend_design_fado')
350+
sudo_design_fado.command = TestCase.Command(exec = "python", param = "optimization.py")
351+
sudo_design_fado.cfg_dir = "../Tutorials/design/Inc_Turbulent_Bend_Wallfunctions"
352+
sudo_design_fado.cfg_file = "sudo.cfg"
353+
sudo_design_fado.multizone = False
354+
sudo_design_fado.test_iter = 10
355+
sudo_design_fado.timeout = 1600
356+
sudo_design_fado.reference_file = "../../../TestCases/Tutorials/design/Inc_Turbulent_Bend_Wallfunctions/optim.csv.ref"
357+
sudo_design_fado.test_file = "optim.csv"
358+
sudo_design_fado.comp_threshold = 1e-6
359+
sudo_design_fado.tol_file_percent = 0.1
360+
pass_list.append(sudo_design_fado.run_filediff())
361+
test_list.append(sudo_design_fado)
362+
327363
# Tests summary
328364
print('==================================================================')
329365
print('Summary of the parallel tests')

0 commit comments

Comments
 (0)