Skip to content

Updating Documented Examples#459

Open
marina-pitt24 wants to merge 38 commits intocholla-hydro:devfrom
marina-pitt24:new_docs
Open

Updating Documented Examples#459
marina-pitt24 wants to merge 38 commits intocholla-hydro:devfrom
marina-pitt24:new_docs

Conversation

@marina-pitt24
Copy link

1D Square
1D Shock
1D Blast
1D Shu Osher

@mabruzzo
Copy link
Collaborator

mabruzzo commented Oct 8, 2025

To get this working, you are going to need to add "sphinxcontrib-video" to the list of python-dependencies are installed as part of our "docs" dependency-group (this list is tracked as part of the dependency-groups.docs parameter in pyproject.toml.

Here is an exact link to the line in pyproject.toml where this list is defined

**Important:** This test must be run with diode boundaries [disabled](https://github.com/alwinm/cholla/tree/main-diode) in order to perform as expected (thank you @alwinm!). This branch also uses the Van Leer integrator.

## Parameter file: (**modified** from `cholla/examples/1D/Shu_Osher.txt`)
Modified to add yl_bcnd, yu_bcnd, zl_bcnd, and zu_bcnd=0. Xmin changed to -1.0 and xlen to 2.0.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this has been fixed, so this line is no longer needed.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line should be removed - the parameter file in the repository matches the one shown here. Also remove the header formatting of the parameter file line so it is not so large, and matches the formatting in the 1d blast test, for example.

This test initializes a square wave density pertubation. The setup consists of an initial density and pressure of 1.0 and 0.01, respectively. A square wave is initialized with amplitude 1.5. Gamma is set to 1.666666666666667. This test was performed with the hydro build (`cholla/builds/make.type.hydro`) and Van Leer integrator. Full initial conditions can be found in `cholla/src/grid/initial_conditions.cpp`under `Square_Wave()`.

## Parameter file: (modified from`cholla/examples/1D/square_wave.txt`)
Modified to add yl_bcnd, yu_bcnd, zl_bcnd, and zu_bcnd=0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same two comments here

This test is similar to the Sod shock tube but has higher initial pressure and density differences. This shows the ability of a code to limit oscillatory behavior in areas of high density and pressure contrasts. The setup consists of a density and pressure of 10.0 and 100.0, respectively, for 0 \< x \< 0.5 and density= pressure = 1.0 for 0.5 \< x \< 1.0. Gamma is set to 1.4. This test was performed with the hydro build (`cholla/builds/make.type.hydro`) and Van Leer integrator. Full initial conditions can be found in `cholla/src/grid/initial_conditions.cpp`under `Riemann()`.

## Parameter file: (modified from`cholla/examples/1D/strong_shock.txt`)
Modified to add yl_bcnd, yu_bcnd, zl_bcnd, and zu_bcnd=0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same two comments here.

@evaneschneider
Copy link
Collaborator

Looking good so far (and the movies show up now, hooray!). A couple notes:
-There are some missing figures and movies, I assume that's just because you haven't finished editing the markdown files yet, but I made notes of them above.
-There are a couple of places where I think the text needs to be updated relative to what was on the wiki (noted with comments). Also, is the piece about turning off the diode boundaries for the Shu Osher test still true? I.e. is that something that had to be applied to run the current example?
-On the square wave example, I think the part at the end about the wave structure washing out after a long time evolution is good, and that's probably a good place to give an example of how different reconstruction methods can affect the solution as well (i.e. this effect should be much less pronounced if you are using PPMP with contact discontinuity steeping turned on).

@@ -0,0 +1,23 @@
# 1D Shu and Osher test
This test (Shu & Osher, 1989) highlights the ability of a code to resolve small scale smooth flow and shocks simultaneously. Further, it shows how lower resolution solutions can cut off some of the amplitude of maxima due to the slope limiters. Parameters are from Stone et al., 2008, Section 8.1. The test consists of left and right states separated at x = -0.8. On the left, density is set to 3.857143, pressure to 10.33333, and velocity to 2.629369. On the right, density is sinusoidally varying: $\rho(x)$ = 1.0 + 0.2 $\sin(5.0\pi x)$. Pressure is set to 1.0 and the velocity is 0.0. Gamma is set to 1.4. This test is performed with the hydro build (`cholla/builds/make.type.hydro`). Full initial conditions can be found in `cholla/src/grid/initial_conditions.cpp`under `Shu_Osher()`.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The warning about diode boundaries that is in the wiki page for this test should be added here. See https://github.com/cholla-hydro/cholla/wiki/1D-Shu-Osher

# 1D Sod Shock Tube
This test highlights the ability of a code to resolve shocks and contact discontinuities over a narrow region. Parameters from Sod (1978). The setup consists of a density and pressure of 1.0 for x \< 0 and 0.1 for x \> 0.5. Gamma is set to 1.4. This test was performed with the hydro build (`cholla/builds/make.type.hydro`) and Van Leer integrator. Full initial conditions can be found in `cholla/src/grid/initial_conditions.cpp`under `Riemann()`.

## Parameter file: ({repository-file}`examples/1D/sod.txt`)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update the formatting here to match that on the 1D blast page (link to the parameter file on a line with normal font size).

# value of gamma
gamma=1.4
```
Upon completion, you should obtain two output files.The initial and final density, pressure, velocity, and internal energy (in code units) of the solution is shown below. Examples of how to extract and plot data can be found in `cholla/python_scripts/plot_sod.ipynb`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only the density, velocity, and pressure are shown now.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, is that the correct path for the plotting example? Or do you want to reference the new markdown pages you added in the Python Analysis Examples tab?

This test initializes a compression/rarefaction wave across the grid. The setup consists of an initial density and pressure of 1.0 and 0.6, respectively. A sound wave is initialized as a sinusoidal wave with amplitude 1e-4 and wavelength of 1.0. Gamma is set to 1.666666666666667. This test was performed with the hydro build (`cholla/builds/make.type.hydro`) and Van Leer integrator. Full initial conditions can be found in `cholla/src/grid/initial_conditions.cpp`under `Sound_Wave()`.

## Parameter file: ({repository-file}`examples/1D/sound_wave.txt`)
Modified to add yl_bcnd, yu_bcnd, zl_bcnd, and zu_bcnd=0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can remove the line about modification; please also update the formatting of the parameter file line to match that in the 1D blast page.

gamma=1.666666666666667

```
Upon completion, you should obtain five output files. By changing the outstep to 0.005, we can obtain the evolution of the density, pressure, velocity, and internal energy (here at 4 fps). Examples of how to extract and plot data can be found in `cholla/python_scripts/plot_sod.ipynb`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only density, velocity, and pressure are plotted now.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also make sure the path for the plotting script reference is correct.

:align: center
:autoplay:
:loop:
:::
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're going to show a movie on this page it would be nice to show the evolution of the wave for a full period. So perhaps instead of modifying the outstep to 0.005, you could modify the final output time to 1.0.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like there might be an extra movie file in this folder that can be removed.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this parameter file being used? If not it can be removed.

# value of gamma
gamma=1.666666666666667
```
Upon completion, you should obtain 101 output files. We can obtain the evolution of the density. Pressure is constant to the $10^{-14}$ level. Examples of how to extract and plot data can be found in `cholla/python_scripts/plot_sod.ipynb`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe instead of "we can obtain the evolution of the density" you could say something like "the evolution of the density is shown below".

# value of gamma
gamma=1.4
```
Upon completion, you should obtain two output files. The initial and final density, pressure, and velocity (in code units) of the solution is shown below.. Examples of how to extract and plot data can be found in cholla/python_scripts/plot_sod.ipynb.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe "density, velocity, and pressure" to reflect the order of the plot.

This test highlights a collision between two shocks. This test is from Toro's *Riemann solvers and numerical methods for fluid dynamics* Sec. 6.4, test 4.The test consists of left and right states separated at x = 0.4 with velocities 19.5975 and -6.19633, respectively. Density of the left side is 5.99924 and pressure is 460.894. For the right side, density is 5.99242 while pressure is 46.095. Gamma is set to 1.4. This test is performed with the hydro build (`cholla/builds/make.type.hydro`). Full initial conditions can be found in `cholla/src/grid/initial_conditions.cpp`under `Riemann()`.


## Parameter file: (**modified** to add y and z boundary conditions = 0 from {repository-file}`examples/1D/two_shocks.txt`)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment about formatting here.

# value of gamma
gamma=1.4
```
Upon completion, you should obtain 2 output files. The initial and final density, pressure, velocity, and internal energy (in code units) of the solution is shown below.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something looks badly wrong with this test. Looks like it's a problem with the diode boundaries again: https://github.com/cholla-hydro/cholla/wiki/1D-Two-Shocks. I think maybe we should not include the new plots on these, and instead include the warning at the top, and use the old plots from the wiki (until we add the diode disabling back in).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file can be removed if it's not being used.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for this one.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for this file.

# 2D Implosion
This tests a code's ability to resolve contact discontinuities for a non-grid aligned shock tube and can determine the symmetry of a code. It consists of a diamond region of density = 0.125 and pressure = 0.14 inside a square region of both density and pressure of 1. Parameters from Liska and Wendroff 2003. Gamma is set to 1.4. Full initial conditions can be found in `cholla/src/grid/initial_conditions.cpp`under `Implosion_2D()`.This test is performed with the default hydro build (`cholla/builds/make.type.hydro`).

## Parameter file: ({repository-file}`examples/2D/Implosion_2D.txt`)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment here on formatting.

# path to output directory
outdir=./
```
Upon completion, you should obtain 251 output files. An evolution of the pressure overlaid with density contours is seen here at 10 fps. Examples of how to plot projections and slices can be found in `cholla/python_scripts/Projection_Slice_Tutorial.ipynb`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think here you want to reference your 2D plotting example, not the projection and slice examples (since those don't exist for 2D datasets).

This test highlights the ability of a code to resolve mixing caused by shear flows, emphasizing the importance of an efficient, high order reconstuction method and a fast code. The level of mixing increases with the resolution. See Chandrasekhar 1961. It consists of a high density region (density = 1 and x velocity = 0.5) in the middle third of the grid sandwiched between two low density regions (density = 1 and x velocity = -0.5). Y-velocities are perturbed by a sine wave of amplitude 0.1. Pressure is 2.5 everywhere and gamma is set to 1.666667. Full initial conditions can be found in `cholla/src/grid/initial_conditions.cpp`under `KH()`.This test is performed with the default hydro build (`cholla/builds/make.type.hydro`) and Van Leer integrator.


## Parameter file: ({repository-file}`examples/2D/KH_discontinuous_2D.txt`)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment about the parameter file line formatting.

# path to output directory
outdir=./
```
Upon completion, you should obtain 201 output files. The initial and final density (in code units) is shown below. Examples of how to plot projections and slices can be found in `cholla/python_scripts/Projection_Slice_Tutorial.ipynb`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment here about the plotting script reference.

:loop:
:::

We can compare to the results of the [Athena](https://www.astro.princeton.edu/~jstone/Athena/tests/kh/kh.html) code on a 512x512 grid at t = 1.00. Density is shown on a linear color map between 0.9 and 2.1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can get rid of the Athena comparison here (it's not exactly the same test, so it's a little confusing).

@@ -0,0 +1,71 @@
# 2D Resolution Independent Kelvin-Helmholtz Test
This test highlights the ability of a code to resolve mixing caused by shear flows, emphasizing the importance of an efficient, high order reconstuction method and a fast code. In general, the level of mixing would increase with the resolution; however, this is a resolution independent version. The test consists of a region of higher density (100) sandwiched between two regions of lower density (1.0). The high density layer has a velocity of 10.5 and the low density layers have a velocity of 9.5. Pressure is set to 2.5 and a 1% pertubation (amplitude of 0.1) is added to the high density layer to provoke the instability. Gamma is set to 1.6666666666666667. This test is performed with the default hydro build (`cholla/builds/make.type.hydro`) and Van Leer integrator. Full initial conditions can be found in `cholla/src/grid/initial_conditions.cpp`under `KH_res_ind()`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a reference here to Robertson 2010, after "this is a resolution independent version inspired by the test presented in Robertson et al. 2010".

:::{figure} snapshots_khri_256.png
:::

The solution does appear to be independent of resolution. We can also compare the time evolution of the density at the above resolutions.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had forgotten that there was not much density contrast in these initial conditions. It may be worth it for us to adjust the initial conditions in the code. In the meantime, I think picking a lower maximum density for the color bar (perhaps 100) would help make the instability more visible.

# 2D Noh Strong Shock
This test highlights the ability of a code to track a high Mach number shock. Parameters from Liska and Wendroff 2003. The test consists of an infinitely strong circular shock radiating from the origin. There is initially a constant density of 1.0 across the grid and a velocity of 1.0 towards the center everywhere. Pressure is set to $10^{-6}$ everywhere. Gamma is set to 1.66666667. This test is performed with the default hydro build (`cholla/builds/make.type.hydro`) and Van Leer integrator. Full initial conditions can be found in `cholla/src/grid/initial_conditions.cpp`under `Noh_2D()`.

## Parameter file: ({repository-file}`examples/2D/Noh_2D.txt`)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment about the parameter file formatting and removing the comment about boundaries.


## Parameter file:
## Parameter file:({repository-file}`examples/2D/Rayleigh_Taylor.txt`)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can just refer tp the parameter file normally here, since this documentation is tied to the dev branch.


Cholla utilizes finite volume methods (FVM) to solve the partial differential equations related to various hydrodynamics problems. In FVMs, the average values of each conserved quantity (i.e. density, momentum, energy) are stored in each cell. However, the cell-average quantities are updated in time using fluxes, which are calculated at cell interfaces. The reconstruction method determines what the input values for solving the Riemann problem at cell interfaces should be.

This section will evaluate two piecewise linear methods (PLM) and one piecewise parabolic method (PPM). PLM is a second order reconstruction that models the shape of the fluid linearly, and thus representing the fluid more accurately. PPM is a third order reconstruction method that models the fluids parabolically and can be useful in problems where PLM proves to be too diffusive.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe "and thus represents the fluid more accurately than a first-order method using the cell average values".

2D-Rayleigh-Taylor/2D-Rayleigh-Taylor
2D-Kelvin-Helmholtz-Discontinuous/overview
2D-Kelvin-Helmholtz-Resolution-Independent/overview
Reconstruction-Methods/overview
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe adjust this order so the Reconstruction methods comes after the new 3D adiabatic test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants