# 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](/src/test/) link for a complete list).
## Systems of conservation laws
* [Bouncing Saint-Venant bump](bump2D1.c)
* [1D arterial flow](artery1D.c)
* [Two- and three-dimensional explosions](explosion.c)
## Incompressible Euler/Navier--Stokes
* [Lid-driven cavity at Re=1000](lid.c)
* [Merging of two vertices](stream.c)
* [Merging of two vortices (centered Euler solver)](vortex.c)
* [Taylor--Green vortices](taylor-green.c)
## Shallow-water flows
* [Drying of a lake](dry.c)
* [Simple Saint-Venant Riemann problem](bore1.c)
* [Oscillations in a parabolic container](parabola.c)
* [Undular bores for the Green-Naghdi equations](bore.c)
* [Green-Naghdi soliton](soliton.c)
* [Solitary wave run-up on a plane beach](beach.c)
* [Solitary wave overtopping a seawall](seawall.c)
* [Sinusoidal wave propagation over a bar](bar.c)
* [Runup of a solitary wave on a conical island](conical.c)
* [Shock reflection by a circular cylinder](shock.c)
* [Flow rates for multiple rivers](multiriverinflow.c)
* [Source of a river](source.c)
* [Implicit Saint-Venant solutions for waves](implicit.c)
* [Viscous hydraulic jump](higuera.c)
* [Transcritical flow over a bump with multiple layers](layered.c)
* [Wind-driven lake](wind-driven.c)
* [Lake flowing into itself](lake-tr.c)
## Volume-Of-Fluid
* [Computation of volume fractions from a levelset function](fractions.c)
* [Computation of volume fractions on a variable-resolution grid](fractions1.c)
* [Fractions in marginal cases](fractions2.c)
* [Computation of a levelset field from a contour](basilisk.c)
* [Time-reversed VOF advection in a vortex](reversed.c)
## Surface tension
* [Curvature of a circular/spherical interface](curvature.c)
* [Circular droplet in equilibrium](spurious.c)
* [Capillary wave](capwave.c)
* [Gravity wave](gravity.c)
* [Shape oscillation of an inviscid droplet](oscillation.c)
* [Rising bubble](rising.c)
* [Sessile drop](sessile.c)
* [3D Sessile drop](sessile3D.c)
## General orthogonal coordinates
* [Circular dam break on a sphere](lonlat.c)
* [Axisymmetric mass conservation](axiadvection.c)
* [Axisymmetric Poiseuille flow](poiseuille-axi.c)
* [Convergence of axisymmetric viscous terms](axi.c)
* [Refinement of axisymmetric metric](refine-axi.c)
* [Boundary layer on a rotating disk](swirl.c)
## Embedded boundaries
* [Poisson equation on complex domains](neumann.c)
* [Poisson equation on complex domains in 3D](neumann3D.c)
* [Stability of the embedded face velocity interpolation](uf.c)
* [Hydrostatic balance with refined embedded boundaries](hydrostatic2.c)
* [Hydrostatic balance with refined embedded boundaries in 3D](hydrostatic3.c)
### Stokes
* [Poiseuille flow in a periodic channel inclined at 45 degrees](poiseuille45.c)
* [Couette flow between rotating cylinders](couette.c)
* [Wannier flow between rotating excentric cylinders](wannier.c)
* [Stokes flow past a periodic array of cylinders](cylinders.c)
* [Stokes flow past a periodic array of spheres](spheres.c)
* [Stokes flow through a complex porous medium](porous.c)
* [Stokes flow through a complex porous medium, randomly refined](porous1.c)
### Navier--Stokes
* [Starting flow around a cylinder](starting.c)
## Electrohydrodynamics
* [Gouy-Chapman Debye layer](debye.c)
* [Electrostatic in planar layers](planar.c)
* [Convergence of axisymmetric EHD stresses](ehd_axi_stress.c)
* [Charge relaxation in an axisymmetric insulated conducting column](cyl_axi.c)
* [Charge relaxation in a planar cross-section](cyl_planar.c)
* [Equilibrium of a droplet suspended in an electric field](taylor.c)
## Viscoelasticity
* [Transient planar Poiseuille flow for
an Oldroyd-B or FENE-P fluid](poiseuille-oldroydb.c)
* [Oldroyd-B lid-driven cavity](lid-oldroydb.c)
* [Viscoelastic 2D drop in a Couette Newtonian shear flow](viscodrop.c)
* [Impact of a viscoelastic drop on a solid](fall.c)
## Reaction--Diffusion
* [The SAG equation](sag.c)
## MPI
* [Reduction operations](mpi-reduce.c)
* [Boundary conditions and restriction](mpi-restriction.c)
* [Z-order indexing](indexing.c)
* [Parallel scalability](mpi-laplacian.c)
* [Parallel refinement](mpi-refine.c)
* [Poisson solver on non-uniform mesh](mpi-circle.c)
* [Boundary conditions for face fluxes](mpi-flux.c)
* [Boundary conditions for face vector fields](mpi-interpu.c)
* [Simple test of Basilisk View](view.c)
## Speed benchmarks
* [Speed of elementary operations on different grids](laplacian.c)
## Other
* [Kuramoto--Sivashinsky equation](kuramoto.c)
* [Convergence of the Runge--Kutta solvers](runge-kutta.c)
## [All tests](/src/test/)
# Running and creating test cases (and examples)
First make sure to read the [section on
Makefiles](/Tutorial#using-makefiles) in the [tutorial](/Tutorial).
To run a particular test case yourself, you can then just do
~~~bash
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
~~~bash
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*](http://man7.org/linux/man-pages/man1/diff.1.html)) 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
~~~gnuplot Caption
...
~~~
~~~pythonplot Caption
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
~~~bash
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
~~~bash
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
~~~bash
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
~~~bash
make events/plot.png
make: *** No rule to make target `events/plot.png'. Stop.
~~~
## Running the entire test suite
Use something like
~~~bash
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
~~~bash
make plots
~~~