Skip to content

Commit 0444c40

Browse files
PraptiPatraclaude
andcommitted
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
1 parent 50ab98f commit 0444c40

6 files changed

Lines changed: 25 additions & 5 deletions

File tree

‎_tutorials/compressible_flow/Sod_Shock_Tube/Sod_Shock_Tube.md‎

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ The folder also contains the Python scripts that generate these files and post-p
3636
- [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
3737
- [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
3838
- [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.
3942

4043
## Tutorial
4144

@@ -66,6 +69,9 @@ The classic non-dimensional Sod states are used here, converted to SI units with
6669
| Velocity | 0 m/s | 0 m/s |
6770
| Temperature ($$T = p/\rho R$$) | 348.432 K | 278.746 K |
6871

72+
![Sod shock tube setup](../../tutorials_files/compressible_flow/Sod_Shock_Tube/images/sod_setup.png)
73+
Figure (2): The shock tube at $$t = 0$$: the two initial states, the diaphragm and the boundary markers of the mesh.
74+
6975
The simulation runs until the non-dimensional time $$t = 0.2$$, which in SI units is
7076

7177
$$
@@ -78,6 +84,9 @@ At this time the waves are well separated but none has reached the ends of the t
7884

7985
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).
8086

87+
![Sod shock tube mesh](../../tutorials_files/compressible_flow/Sod_Shock_Tube/images/sod_mesh.png)
88+
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+
8190
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:
8291

8392
```
@@ -222,14 +231,25 @@ and plots the four flow variables against the exact solution (Figure 1). With th
222231
- The **rarefaction** is reproduced closely, with slight rounding of its corners.
223232
- 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.
224233

234+
![Density contours](../../tutorials_files/compressible_flow/Sod_Shock_Tube/images/sod_contour.png)
235+
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+
225245
### Comparing Schemes, Limiters and Meshes
226246

227247
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.
228248

229249
#### Convective schemes
230250

231251
![Convective schemes](../../tutorials_files/compressible_flow/Sod_Shock_Tube/images/study_schemes.png)
232-
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.
233253

234254
| Scheme | ROE | HLLC | AUSM | SLAU2 | JST |
235255
|---|---|---|---|---|---|
@@ -240,7 +260,7 @@ The four upwind schemes (`ROE`, `HLLC`, `AUSM`, `SLAU2`) give nearly identical r
240260
#### Slope limiters
241261

242262
![Slope limiters](../../tutorials_files/compressible_flow/Sod_Shock_Tube/images/study_limiters.png)
243-
Figure (3): The same regions for ROE with MUSCL and five choices of slope limiter, on 400 cells.
263+
Figure (6): The same regions for ROE with MUSCL and five choices of slope limiter, on 400 cells.
244264

245265
| Limiter | none | `VAN_ALBADA_EDGE` | `VENKATAKRISHNAN` | `BARTH_JESPERSEN` | `VENKATAKRISHNAN_WANG` |
246266
|---|---|---|---|---|---|
@@ -257,21 +277,21 @@ The Venkatakrishnan limiter contains a threshold $$\varepsilon$$: where the diff
257277
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:
258278

259279
![Limiter threshold](../../tutorials_files/compressible_flow/Sod_Shock_Tube/images/study_threshold.png)
260-
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.
261281

262282
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.
263283

264284
#### First and second order
265285

266286
![First vs second order](../../tutorials_files/compressible_flow/Sod_Shock_Tube/images/study_order.png)
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.
268288

269289
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.
270290

271291
#### Mesh convergence
272292

273293
![Mesh convergence](../../tutorials_files/compressible_flow/Sod_Shock_Tube/images/study_convergence.png)
274-
Figure (6): $$L_1$$ density error against cell size for first- and second-order ROE, on meshes of 100 to 1600 cells.
294+
Figure (9): $$L_1$$ density error against cell size for first- and second-order ROE, on meshes of 100 to 1600 cells.
275295

276296
| Cells | 100 | 200 | 400 | 800 | 1600 |
277297
|---|---|---|---|---|---|
81 KB
Binary file not shown.
14.8 KB
Binary file not shown.
237 KB
Loading
82.2 KB
Loading
61 KB
Loading

0 commit comments

Comments
 (0)