# src/test/README

- Test cases
- Systems of conservation laws
- Incompressible Euler/Navier–Stokes
- Shallow-water flows
- Multilayer model
- Coriolis
- Stratified multilayer
- Volume-Of-Fluid
- Surface tension
- General orthogonal coordinates
- Embedded boundaries
- Electrohydrodynamics
- Viscoelasticity
- Reaction–Diffusion
- General Ocean Turbulence Model (GOTM)
- MPI
- Speed benchmarks
- Other
- All tests

- Running and creating test cases (and examples)

# Test cases

The following test cases are run automatically whenever the code changes.

Note that only the documented test cases appear in the list below (follow the All tests link for a complete list).

## Systems of conservation laws

## Incompressible Euler/Navier–Stokes

- Lid-driven cavity at Re=1000
- Merging of two vertices
- Merging of two vortices (centered Euler solver)
- Taylor–Green vortices
- Non-hydrostatic lock-exchange

## Shallow-water flows

- Drying of a lake
- Simple Saint-Venant Riemann problem
- Oscillations in a parabolic container
- Undular bores for the Green-Naghdi equations
- Green-Naghdi soliton
- Solitary wave run-up on a plane beach
- Solitary wave overtopping a seawall
- Sinusoidal wave propagation over a bar
- Runup of a solitary wave on a conical island
- Stress test for wetting and drying
- Shock reflection by a circular cylinder
- Flow rates for multiple rivers
- Source of a river
- Implicit Saint-Venant solutions for waves
- Viscous hydraulic jump
- Transcritical flow over a bump with multiple layers
- Wind-driven lake
- Lake flowing into itself

## Multilayer model

- Dispersion relation
- Solitary wave run-up on a plane beach
- Solitary wave overtopping a seawall
- Runup of a solitary wave on a conical island
- Stress test for wetting and drying
- Sinusoidal wave propagation over a bar
- Oscillations in a parabolic container
- Circular dam break on a sphere
- Wind-driven lake
- Large-amplitude standing wave
- Transcritical flow over a bump with multiple layers
- Breaking Stokes wave
- Galilean invariance
- Typical (1D) tsunami wave

## Coriolis

## Stratified multilayer

## Volume-Of-Fluid

- Computation of volume fractions from a levelset function
- Computation of volume fractions on a variable-resolution grid
- Fractions in marginal cases
- Computation of a levelset field from a contour
- Time-reversed VOF advection in a vortex

## Surface tension

- Curvature of a circular/spherical interface
- Circular droplet in equilibrium
- Capillary wave
- Gravity wave
- Shape oscillation of an inviscid droplet
- Rising bubble
- Sessile drop
- 3D Sessile drop

## General orthogonal coordinates

- Circular dam break on a sphere
- Axisymmetric mass conservation
- Axisymmetric Poiseuille flow
- Convergence of axisymmetric viscous terms
- Refinement of axisymmetric metric
- Boundary layer on a rotating disk

## Embedded boundaries

- Poisson equation on complex domains
- Poisson equation on complex domains in 3D
- Stability of the embedded face velocity interpolation
- Hydrostatic balance with refined embedded boundaries
- Hydrostatic balance with refined embedded boundaries in 3D

### Stokes

- Poiseuille flow in a periodic channel inclined at 45 degrees
- Couette flow between rotating cylinders
- Wannier flow between rotating excentric cylinders
- Stokes flow past a periodic array of cylinders
- Stokes flow past a periodic array of spheres
- Stokes flow through a complex porous medium
- Stokes flow through a complex porous medium, randomly refined

### Navier–Stokes

## Electrohydrodynamics

- Gouy-Chapman Debye layer
- Electrostatic in planar layers
- Convergence of axisymmetric EHD stresses
- Charge relaxation in an axisymmetric insulated conducting column
- Charge relaxation in a planar cross-section
- Equilibrium of a droplet suspended in an electric field

## Viscoelasticity

- Transient planar Poiseuille flow for an Oldroyd-B or FENE-P fluid
- Oldroyd-B lid-driven cavity
- Viscoelastic 2D drop in a Couette Newtonian shear flow
- Impact of a viscoelastic drop on a solid

## Reaction–Diffusion

- The SAG equation
- Soluble gas diffusing from a static bubble
- Soluble gas diffusing from a rising bubble

## General Ocean Turbulence Model (GOTM)

## MPI

- Reduction operations
- Boundary conditions and restriction
- Z-order indexing
- Parallel scalability
- Parallel refinement
- Poisson solver on non-uniform mesh
- Boundary conditions for face fluxes
- Boundary conditions for face vector fields
- Simple test of Basilisk View

## Speed benchmarks

## Other

- Kuramoto–Sivashinsky equation
- Convergence of the Runge–Kutta solvers
- Segment traversal
- CVMix KPP interface

## All tests

# Running and creating test cases (and examples)

First make sure to read the section on Makefiles in the tutorial.

To run a particular test case yourself, you can then just do

```
cd src/test
make bump2D1.tst
```

which should give something like

```
...
qcc -g -O2 -Wall -o bump2D1/bump2D1 bump2D1.c -lm
[bump2D1.tst]
```

This indicates that the test compiled and ran successfully.

## Error checking

If the test fails, you will get something like

```
...
> 2.5 434 0.0678117 0.164104 0.11299303
> # refined 80 cells, coarsened 108 cells
make: *** [bump2D1.tst] Error 1
```

The last line indicates that make failed. The lines before this are the output of

`diff bump2D1/log bump2D1.ref`

That is, to check whether the test case succeeded or not, the default Makefile of Basilisk just compares (using *diff*) the *log* file created by the program to the matching reference log file (with the *.ref* extension).

To create your own test case (let’s call it *mytest*), you only need to create the source code (i.e. *mytest.c*), run it to create the *mytest/log* file, check that you are happy with the results and copy *mytest/log* into *mytest.ref*.

## Graphics

Most tests (but not all) also produce some kind of graph summarising the results (which allows for example to understand more easily how/why a particular test failed). Some tests produce these graphs directly when they run, but most rely on *gnuplot* to generate the graphs in a post-processing step.

This step is not automatically executed when doing *make test.tst*. This allows for example to run the test suite on *bare bones* systems which do not have gnuplot installed.

The makefile system knows about two kinds of graphics: *“inline” plots* and *“offline” plots*.

### Inline plots

These are generated using gnuplot or python commands embedded directly in the documentation comments of the source code (*mytest.c*). Using the standard wiki syntax for scripts these commands appear as

` ...`

```
import matplotlib.pyplot as plt
...
plt.savefig('plot.png')
```

and are replaced by the corresponding figure when the page is displayed in the wiki.

To generate the figures from the command line, just do

`make mytest/plots`

### Offline plots

Alternatively, one can put the gnuplot commands in a separate *mytest.plot* file. Note that this method offers few advantages compared to “inline plots” (the prefered option).

To generate the corresponding plots, one can then do

`make bump2D1/plot.png`

which should give something like

`cd bump2D1 && gnuplot -e "batch=1; PNG=\"pngcairo\" ... ../bump2D1.plot ...`

Note that, while *plot.png* is the default name for the generated graph, the gnuplot script can also generate other graphs. Doing

`ls bump2D1/*.png`

(or * eog bump2D1/*.png*) reveal them all.

Note that if you try to generate plots for a test case which does not have a corresponding *.plot* gnuplot script, you will get something like

```
make events/plot.png
make: *** No rule to make target `events/plot.png'. Stop.
```

## Running the entire test suite

Use something like

```
cd src/test/
make -k -j8
```

where *-k* tells *make* not to stop at the first error and *-j8* uses parallel processing (assuming you have at least 8 cores on your system).

If you want to generate all the graphs at once, do

`make plots`