Modeling fluid flow using smoothed particle hydrodynamics

Home > Software > SPH fluid flow

For our master's project, Brian Schlatter and I implemented a fluid flow simulation using the smoothed particle hydrodynamics (SPH) method. Our implementation runs in parallel on distributed memory machines using the MPI message passing libraries.

The user can specify various simulation parameters and place cylinders and rectangles into a two-dimensional flow. The flow accelerates under a constant force specified by the user. We use periodic boundary conditions (particles flowing off the right side wrap around to the left) and no slip conditions (friction is exhibited along the surface of boundary shapes).

Here is an example of a velocity plot of fluid flow around Benny the Beaver:

Fluid flow around Benny the Beaver

Our simulator consists of a server side and a client side. The server is written in C++ and performs all the number crunching. The client side is written in Java and can be used to initialize the server and visualizes the resulting data. Communication between the client and server is carried out by a socket connection using classes we developed during the project. This allows the client to be run virtually anywhere that has a Java Virtual Machine and an internet connection. Alternatively, the server can be run without the client, writing data files to disk. These data files can be read in by the client application at a later time.

The data can be viewed as a positional plot of the free and bound particles. It can also be viewed as a color contour plot of pressure, density, or speed. The contour plot is created by coloring each pixel according to the relevant attribute of its nearest free particle neighbor.

We have made all of our source code available here. It is our hope that others will use and extend our work. For more details about the physics and implementation, see the papers listed below.

Theses

A Parallel Implementation of a Fluid Flow Simulation using Smoothed Particle Hydrodynamics

Keith Vertanen

Master's thesis, Oregon State University, 1999.

A Pedagogical Tool Using Smooth Particle Hydrodynamics to Model Fluid Flow Past a System of Cylinders

Brian Schlatter

Master's thesis, Oregon State University, 1999.


Example Animations
single_pos.mpg Flow around a single cylinder, positional plot
single_pres.mpg Flow around a single cylinder, pressure plot
single_speed.mpg Flow around a single cylinder, speed plot
single_params.txt Parameters used for the single cylinder run
many_pos.mpg Flow around a bunch of cylinders, positional plot
many_dens.mpg Flow around a bunch of cylinders, pressure plot
many_speed.mpg Flow around a bunch of cylinders, speed plot
many_params.txt Parameters used for the bunch of cylinders run
benny_pos.mpg Flow around a beaver, positional plot
benny_speed.mpg Flow around a beaver, speed plot

Files
server.tar.gz Contains source code and Makefile for our MPI parallel SPH simulation.
server_utils.tar.gz Contains code for several debugging utilities that can be used with *.debug files produced by the server. Utilities can be used to compare differences in particle attributes between runs and also trace the desired properties of a particle through time.
client.tar.gz Source code for a Java application that performs control and visualization of the server. This one contains just the Java source, needs JDK 1.2 (uses Swing).
client_all.tar.gz Source code and project files for the client. This one contains the Java source and the Visual Cafe project files.