# Running an Example

Now that you have built the code, you will want to run an example! Let’s start with a hydrodynamics only example, the 3D Sod Shock.

## Sod Shock

To run the Sod Shock example, you need to follow the following instructions (requires python3 with the h5py and other standard scientific packages, as well as wget for grabbing the glass).

cd examples/HydroTests/SodShock_3D
./getGlass.sh
python3 makeIC.py
python3 plotSolution.py 1


This will run the ‘SodShock’ in 3D and produce a nice plot that shows you how the density has varied. Try running with GIZMO-MFV (this will take significantly longer than with SPH) to see the difference. For that, you will need to reconfigure with the following options:

./configure \
--with-hydro=gizmo-mfv \
--with-riemann-solver=hllc


To see the results that you should get, you should check out our developer wiki at https://gitlab.cosma.dur.ac.uk/swift/swiftsim/wikis/Sod_3D.

## Small Cosmological Volume

As a second example, we run a small cosmolgical volume containing dark matter only starting at redshift $$z = 50$$. Like for the Sod Shock example, it suffices to configure (./configure) and compile (make) the code without any extra flags.

cd examples/SmallCosmoVolume/SmallCosmoVolume_DM
./getIC.sh


We can plot the solution with the included python script as follows:

python3 plotProjection.py 31


The plotProjection.py script requires the swiftsimio library, which is a dedicated and maintained visualisation and analysis library for SWIFT.

An additional example containing both baryonic and dark matter is examples/SmallCosmoVolume/SmallCosmoVolume_hydro. To run with hydrodynamics, the --hydro flag needs to be provided as well:

cd examples/SmallCosmoVolume/SmallCosmoVolume_hydro
./getIC.sh
../../../swift --cosmology --self-gravity --hydro --threads=8 small_cosmo_volume.yml


The solution can again be plotted using the plotProjection.py script.