From 47c2f6fbcbfa8ea18111d586ce00598a94c3b115 Mon Sep 17 00:00:00 2001 From: Prapti Patra Date: Wed, 2 Dec 2026 07:05:35 +0000 Subject: [PATCH 1/4] Add Sod shock tube tutorial to the tutorial regression tests Adds the Sod shock tube case (su2code/Tutorials#91) to TestCases/tutorials.py. The test runs the full 1000 explicit time steps (about 1.4 s on 2 ranks) and checks the physical time and the density RMS residual at the last step. --- TestCases/tutorials.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/TestCases/tutorials.py b/TestCases/tutorials.py index e34b59eabbed..2bfce076fd52 100644 --- a/TestCases/tutorials.py +++ b/TestCases/tutorials.py @@ -199,6 +199,15 @@ def main(): tutorial_inv_wedge.no_restart = True test_list.append(tutorial_inv_wedge) + # Sod shock tube + tutorial_sod_shock_tube = TestCase('sod_shock_tube_tutorial') + tutorial_sod_shock_tube.cfg_dir = "../Tutorials/compressible_flow/Sod_Shock_Tube" + tutorial_sod_shock_tube.cfg_file = "sod.cfg" + tutorial_sod_shock_tube.test_iter = 1000 + tutorial_sod_shock_tube.test_vals = [0.000632, -2.501790] + tutorial_sod_shock_tube.unsteady = True + test_list.append(tutorial_sod_shock_tube) + # Inviscid ONERA M6 tutorial_inv_onera = TestCase('inviscid_onera_tutorial') tutorial_inv_onera.cfg_dir = "../Tutorials/compressible_flow/Inviscid_ONERAM6" From 05cf4223205527c39029b56b8198245d9c519387 Mon Sep 17 00:00:00 2001 From: Prapti Patra Date: Wed, 2 Dec 2026 07:13:19 +0000 Subject: [PATCH 2/4] Use single spaces around = in the Sod regression entry Fixes the four CodeFactor E221 warnings (multiple spaces before operator). No change in behaviour. --- TestCases/tutorials.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/TestCases/tutorials.py b/TestCases/tutorials.py index 2bfce076fd52..ed80780ebe5a 100644 --- a/TestCases/tutorials.py +++ b/TestCases/tutorials.py @@ -200,12 +200,12 @@ def main(): test_list.append(tutorial_inv_wedge) # Sod shock tube - tutorial_sod_shock_tube = TestCase('sod_shock_tube_tutorial') - tutorial_sod_shock_tube.cfg_dir = "../Tutorials/compressible_flow/Sod_Shock_Tube" - tutorial_sod_shock_tube.cfg_file = "sod.cfg" + tutorial_sod_shock_tube = TestCase('sod_shock_tube_tutorial') + tutorial_sod_shock_tube.cfg_dir = "../Tutorials/compressible_flow/Sod_Shock_Tube" + tutorial_sod_shock_tube.cfg_file = "sod.cfg" tutorial_sod_shock_tube.test_iter = 1000 tutorial_sod_shock_tube.test_vals = [0.000632, -2.501790] - tutorial_sod_shock_tube.unsteady = True + tutorial_sod_shock_tube.unsteady = True test_list.append(tutorial_sod_shock_tube) # Inviscid ONERA M6 From ff685349460da3c6f65d8bc7bf20d5320abe57d8 Mon Sep 17 00:00:00 2001 From: Prapti Patra Date: Fri, 4 Dec 2026 06:27:40 +0000 Subject: [PATCH 3/4] Run the Sod tutorial test for 10 steps from a restart The restart at time step 990 goes in the TestCases repository (tutorials/sod_shock_tube/solution_flow_00990.csv). The density residual at step 1000 is the same as for the full run from the initial condition. --- TestCases/tutorials.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/TestCases/tutorials.py b/TestCases/tutorials.py index ed80780ebe5a..6f4aa782b152 100644 --- a/TestCases/tutorials.py +++ b/TestCases/tutorials.py @@ -28,6 +28,7 @@ # make print(*args) function available in PY2.6+, does'nt work on PY < 2.6 from __future__ import print_function +import os import sys from TestCase import TestCase @@ -199,12 +200,24 @@ def main(): tutorial_inv_wedge.no_restart = True test_list.append(tutorial_inv_wedge) - # Sod shock tube + # Sod shock tube, last 10 time steps from a restart at step 990. The restart file is in the + # TestCases repository, so write a copy of the tutorial config that reads it from there. + # CUR_TIME counts from the restart, so it shows 10 time steps. + sod_dir = "../Tutorials/compressible_flow/Sod_Shock_Tube" + if os.path.isfile(sod_dir + "/sod.cfg"): + with open(sod_dir + "/sod.cfg") as f: + sod_cfg = f.read() + sod_cfg = sod_cfg.replace("RESTART_ITER= 1\n", "RESTART_ITER= 991\n") + sod_cfg = sod_cfg.replace("SOLUTION_FILENAME= solution_flow\n", + "SOLUTION_FILENAME= %s\n" % os.path.abspath("tutorials/sod_shock_tube/solution_flow")) + with open(sod_dir + "/sod_restart.cfg", "w") as f: + f.write(sod_cfg) + tutorial_sod_shock_tube = TestCase('sod_shock_tube_tutorial') - tutorial_sod_shock_tube.cfg_dir = "../Tutorials/compressible_flow/Sod_Shock_Tube" - tutorial_sod_shock_tube.cfg_file = "sod.cfg" + tutorial_sod_shock_tube.cfg_dir = sod_dir + tutorial_sod_shock_tube.cfg_file = "sod_restart.cfg" tutorial_sod_shock_tube.test_iter = 1000 - tutorial_sod_shock_tube.test_vals = [0.000632, -2.501790] + tutorial_sod_shock_tube.test_vals = [0.000006, -2.501790] tutorial_sod_shock_tube.unsteady = True test_list.append(tutorial_sod_shock_tube) From 30ddfcf4eacfac24f6bcb9cf6e60f63b2af58d4e Mon Sep 17 00:00:00 2001 From: Prapti Patra Date: Sat, 5 Dec 2026 13:19:05 +0000 Subject: [PATCH 4/4] Read the Sod restart file from the tutorial folder The restart at time step 990 is now in the Tutorials repository, next to sod.cfg (su2code/Tutorials#91), instead of in TestCases. The test config only needs RESTART_ITER= 991; SOLUTION_FILENAME stays as in sod.cfg. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01FTVvXsobGthJWp6eFiG4HC --- TestCases/tutorials.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/TestCases/tutorials.py b/TestCases/tutorials.py index 6f4aa782b152..fb11c8265b53 100644 --- a/TestCases/tutorials.py +++ b/TestCases/tutorials.py @@ -200,18 +200,15 @@ def main(): tutorial_inv_wedge.no_restart = True test_list.append(tutorial_inv_wedge) - # Sod shock tube, last 10 time steps from a restart at step 990. The restart file is in the - # TestCases repository, so write a copy of the tutorial config that reads it from there. + # Sod shock tube, last 10 time steps from the restart at step 990 (solution_flow_00990.csv in + # the tutorial folder). Write a copy of the tutorial config that restarts from that file. # CUR_TIME counts from the restart, so it shows 10 time steps. sod_dir = "../Tutorials/compressible_flow/Sod_Shock_Tube" if os.path.isfile(sod_dir + "/sod.cfg"): with open(sod_dir + "/sod.cfg") as f: sod_cfg = f.read() - sod_cfg = sod_cfg.replace("RESTART_ITER= 1\n", "RESTART_ITER= 991\n") - sod_cfg = sod_cfg.replace("SOLUTION_FILENAME= solution_flow\n", - "SOLUTION_FILENAME= %s\n" % os.path.abspath("tutorials/sod_shock_tube/solution_flow")) with open(sod_dir + "/sod_restart.cfg", "w") as f: - f.write(sod_cfg) + f.write(sod_cfg.replace("RESTART_ITER= 1\n", "RESTART_ITER= 991\n")) tutorial_sod_shock_tube = TestCase('sod_shock_tube_tutorial') tutorial_sod_shock_tube.cfg_dir = sod_dir