Smoothed Particle Hydrodynamics (SPH) is a meshless method for solving the Navier-Stokes equation, in which fluid properties are stored on Lagrangian fluid particles (i.e. on particles which move with the fluid flow). The particles interact to generate values across the entire fluid domain through continuous smoothing kernels.
As the SPH method is meshless and Lagrangian, it is ideal for solving problems involving fluid flow with interfaces and free surfaces. This tool implements the SPH method in C++ to solve wave generation in a lock-release/dam-break problem.
A Makefile has been provided that builds the tool and places the executables in the bin folder. Reading through the Makefile is highly encouraged to see all the options a user has for building and testing the tool. The simplest way to compile is:
make
Note, that the post.py uses the lxlm library. The installation of that library changes from system to system. Users are thus encouraged to check out the installation page on the lxlm website.
Also note, that the testing routines use the BOOST library, which is another can of worms. If you are using a Linux distribution (however) you can just use apt-get:
sudo apt-get install libboost-all-dev
, or any other package manager your distribution comes with.
After a successfull complilation, the user can run the tool with his/her desired initial configuration, by running:
./bin/SPH_2D input.txt
The input.txt should look like:
30.0 <-- length of the simulation in seconds
0.05 <-- time-step to output to disk
0.2 <-- dx
0 <-- switch off analysisMode (to be deprecated)
-0.6 -0.6 0.1 10.7 1 <-- Define bottom left and top right corners (first 4)
0.0 10.0 20.0 10.7 1 <-- 5th argument is the type of particle (1 for boundary)
20.0 -0.6 20.6 10.7 1
0.0 -0.6 20.0 0.1 1
0.2 0.2 3.1 5.1 0
3.2 0.2 19.9 2.1 0
Extensive Documentation has been written for both the tool and its testing routines. You can either check the Markdown version (incomplete :( ), emacs org-mode version (no latex functions unfortunately), pdf version.
The tool includes tests, which you can use to check its operation on your system. With the code compiled, these can be run with
python run_tests.py
If you are on a Linux distribution and you want to compile and run the complete testing routines, you can use:
make runtests