You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 0444c40
Browse filesBrowse the repository at this point in the historyBrowse files
Add setup, mesh and contour figures to the Sod tutorial
- Figure 2: sketch of the tube with the initial states, the diaphragm
and the boundary markers.
- Figure 3: the whole 400 x 1 mesh and a close-up of the cells around
the diaphragm.
- Figure 4: density contours on the strip at t_end and in the x-t plane,
with the exact wave paths.
The figures are made by plot_overview.py in the tutorial folder. The
later figures are renumbered 5 to 9, and the resources section lists
plot_overview.py and the regression restart file solution_flow_00990.csv.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FTVvXsobGthJWp6eFiG4HC
Copy file name to clipboardExpand all lines: _tutorials/compressible_flow/Sod_Shock_Tube/Sod_Shock_Tube.md
+25-5Lines changed: 25 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,6 +36,9 @@ The folder also contains the Python scripts that generate these files and post-p
36
36
-[make_ic.py](https://github.com/su2code/Tutorials/tree/master/compressible_flow/Sod_Shock_Tube/make_ic.py): writes the initial condition for a given mesh
37
37
-[compare_exact.py](https://github.com/su2code/Tutorials/tree/master/compressible_flow/Sod_Shock_Tube/compare_exact.py): computes the exact solution and compares it with the SU2 result
38
38
-[run_study.py](https://github.com/su2code/Tutorials/tree/master/compressible_flow/Sod_Shock_Tube/run_study.py) and [plot_study.py](https://github.com/su2code/Tutorials/tree/master/compressible_flow/Sod_Shock_Tube/plot_study.py): repeat the case for several schemes, limiters and meshes, and plot the comparison
39
+
-[plot_overview.py](https://github.com/su2code/Tutorials/tree/master/compressible_flow/Sod_Shock_Tube/plot_overview.py): draws the setup sketch, the mesh and the contour plots shown on this page
40
+
41
+
The file `solution_flow_00990.csv` is the solution at time step 990. It is not needed for the tutorial: the SU2 regression tests restart from it and run only the last 10 time steps.
39
42
40
43
## Tutorial
41
44
@@ -66,6 +69,9 @@ The classic non-dimensional Sod states are used here, converted to SI units with
66
69
| Velocity | 0 m/s | 0 m/s |
67
70
| Temperature ($$T = p/\rho R$$) | 348.432 K | 278.746 K |
Figure (2): The shock tube at $$t = 0$$: the two initial states, the diaphragm and the boundary markers of the mesh.
74
+
69
75
The simulation runs until the non-dimensional time $$t = 0.2$$, which in SI units is
70
76
71
77
$$
@@ -78,6 +84,9 @@ At this time the waves are well separated but none has reached the ends of the t
78
84
79
85
SU2 always solves on a 2D (or 3D) mesh, so the one-dimensional tube is represented by a thin strip: 400 square quadrilateral cells along $$x$$, and a single cell in $$y$$. Each cell is 2.5 mm wide, and the mesh has 401 × 2 = 802 points. The four boundary markers are `left` and `right` (the closed ends of the tube) and `lower` and `upper` (the sides of the strip).
Figure (3): Top: the whole mesh, with the $$y$$ direction stretched so that the strip is visible; the shaded band is shown below. Bottom: close-up of the 16 cells around the diaphragm, at the true aspect ratio. SU2 stores the solution at the mesh points (dots).
89
+
81
90
The mesh is written by `make_mesh.py`, which takes the number of cells as an argument. This makes it easy to repeat the case on coarser or finer meshes:
82
91
83
92
```
@@ -222,14 +231,25 @@ and plots the four flow variables against the exact solution (Figure 1). With th
222
231
- The **rarefaction** is reproduced closely, with slight rounding of its corners.
223
232
- Small undershoots remain just after the contact (1.4 %) and the shock (2.9 %). The Venkatakrishnan-type limiters are smooth, and they allow small over- and undershoots in exchange for not clipping smooth extrema.
Figure (4): Density contours. Top: the density field on the strip at $$t_{end}$$. Bottom: the density at every point and time step, in the $$x$$-$$t$$ plane, with the exact paths of the rarefaction head and tail, the contact and the shock (white lines).
236
+
237
+
The contour plot on the strip is uniform in $$y$$, which confirms that the symmetry boundaries keep the flow one-dimensional. The $$x$$-$$t$$ diagram shows the structure of the whole solution at once. All waves start from the diaphragm at $$t = 0$$ and travel at constant speed, so they appear as straight lines: the rarefaction is a fan between its head and its nearly vertical tail, and the contact and the shock move to the right. The computed density follows the exact wave paths at all times. To make this figure, run
238
+
239
+
```
240
+
python3 plot_overview.py
241
+
```
242
+
243
+
which runs the case once more in the folder `xt/`, with a restart file written every 10 time steps, and saves `sod_setup.png`, `sod_mesh.png` and `sod_contour.png`.
244
+
225
245
### Comparing Schemes, Limiters and Meshes
226
246
227
247
Because the exact solution is known, this case is a convenient test bench for the numerical settings. The scripts `run_study.py` and `plot_study.py` in the tutorial folder repeat the simulation for every combination shown below and produce the figures in this section. Each run takes a few seconds. On every mesh the time step is scaled with the cell size, so all runs use the same CFL number.
Figure (2): Density near the rarefaction tail, the contact and the shock, and velocity near the shock, for five convective schemes on 400 cells. The upwind schemes use MUSCL with the Venkatakrishnan-Wang limiter.
252
+
Figure (5): Density near the rarefaction tail, the contact and the shock, and velocity near the shock, for five convective schemes on 400 cells. The upwind schemes use MUSCL with the Venkatakrishnan-Wang limiter.
233
253
234
254
| Scheme | ROE | HLLC | AUSM | SLAU2 | JST |
235
255
|---|---|---|---|---|---|
@@ -240,7 +260,7 @@ The four upwind schemes (`ROE`, `HLLC`, `AUSM`, `SLAU2`) give nearly identical r
@@ -257,21 +277,21 @@ The Venkatakrishnan limiter contains a threshold $$\varepsilon$$: where the diff
257
277
In this tutorial the variables are dimensional, with pressures of order $$10^4$$ Pa, so $$\varepsilon^2 = 1.25 \times 10^{-4}$$ is negligible and plain `VENKATAKRISHNAN` behaves almost exactly like Barth-Jespersen. With ROE this works well. With HLLC or AUSM, however, it produces a sawtooth behind the tail of the rarefaction, where the exact solution is constant:
Figure (4): Density behind the rarefaction tail for HLLC with the two Venkatakrishnan limiters.
280
+
Figure (7): Density behind the rarefaction tail for HLLC with the two Venkatakrishnan limiters.
261
281
262
282
The tail of the rarefaction moves at $$u^* - a^* \approx -22$$ m/s, so it is almost stationary and anything created there stays in place. In this nearly flat region the limiter, without an effective threshold, switches on and off from one point to the next. HLLC and AUSM do not damp the resulting odd-even pattern, which reaches $$\pm 0.025$$ kg/m$$^3$$ on 400 cells and grows to $$\pm 0.033$$ kg/m$$^3$$ on 800 cells, so it does not disappear with mesh refinement. With `VENKATAKRISHNAN_WANG` it is gone for every scheme. This is why the configuration file of this tutorial uses `VENKATAKRISHNAN_WANG`. If you use plain `VENKATAKRISHNAN` in a dimensional simulation, check that `VENKAT_LIMITER_COEFF` gives a meaningful threshold for your variables.
263
283
264
284
#### First and second order
265
285
266
286

267
-
Figure (5): Density for first-order ROE (`MUSCL_FLOW= NO`) and second-order ROE (`MUSCL_FLOW= YES`) on 400 cells.
287
+
Figure (8): Density for first-order ROE (`MUSCL_FLOW= NO`) and second-order ROE (`MUSCL_FLOW= YES`) on 400 cells.
268
288
269
289
Without MUSCL reconstruction, the scheme is first order. Every wave is visibly smeared, and the error is almost four times larger ($$L_1 = 8.10 \times 10^{-3}$$ against $$2.16 \times 10^{-3}$$). The contact suffers most: it is spread over 23 cells instead of 8.
0 commit comments