Create installation dir and setup PREFIX variable used in this document’s examples:
export PREFIX=$HOME/sw/sph-newmkdir $PREFIXInstall required system packages:
sudo apt-get install make g++ libhdf5-dev libvtk5-dev freeglut3-dev octaveOptionally, for viewing VTK files we recommend to use Paraview and for
HDF5 files the hdf5-tools package contains some utility programs
sudo apt-get install paraview hdf5-toolsDownload H5Part library
wget https://codeforge.lbl.gov/frs/download.php/170/H5Part-1.6.1.tar.gzUnpack H5Part library
tar -xzf H5Part-1.6.1.tar.gzOn a current Debian Testing system the layout of paths of libhdf5-dev is different from what H5Part expects. Therefore we create a directory with two symlinks that point to the correct locations:
pushd /usr/local
mkdir hdf5
cd hdf5
ln -sfT /usr/include/hdf5/serial include
ln -sfT /usr/lib/x86_64-linux-gnu/hdf5/serial lib
popdCheck result:
ls -l /usr/local/hdf5Now, change directory to h5part-1.6.1 and run configure and make install
cd H5Part-1.6.1./configure --prefix=$PREFIX/h5part --with-hdf5path=/usr/local/hdf5make -j8 installcd ..Download the Name Constant Generator tool from https://savannah.nongnu.org/projects/named-constant/:
wget http://download.savannah.gnu.org/releases/named-constant/named-constant-0.3.1.tar.gzUnpack:
tar -xzf named-constant-0.3.1.tar.gzcd named-constant-0.3.1
make prefix=$PREFIX installcd ..Now set the GENNC_HOME variable in your shell and also add the /bin directory to the $PATH:
export GENNC_HOME=$PREFIX/gennc
export PATH=$PATH:$GENNC_HOME/binFirst, you can set up some environment variables to control the compiler flags during the build. Recommended settings are:
export CXXFLAGS="-Wall -Wextra -m64 -O3 -march=native"
export CPPFLAGS="-DNDEBUG"
export LDFLAGS="-m64"Run the script bootstrap to invoke the autotools, which will
generate the configure script, and some other files:
./bootstrapNow, run configure, setting the location of the H5Part library that we installed and also using the make shift HDF5 directory that we created:
./configure --prefix=$PREFIX/sph-v1.0.0 --with-h5part=$PREFIX/h5part --with-hdf5=/usr/local/hdf5An alternative is to specify the HDF5 include and library directories separately:
./configure --prefix=$PREFIX/sph-v1.0.0 --with-h5part=$PREFIX/h5part \
--with-hdf5-incdir=/usr/include/hdf5/serial --with-hdf5-libdir=/usr/lib/x86_64-linux-gnu/hdf5/serialmake -j8 installexport PATH=$PATH:$PREFIX/sph-v1.0.0/binThis takes about an hour
cd sph/vtk
makesphere -2 -d1e-5 -S1000 -irk3 vtk/test-cases2/2D/monaghan-ellipsis/mittel/test.vtkThis command runs Sphere in 2D mode, with fixed timestep of 1/100000 s
using the RK3 (Simpson rule) integrator with a save rate of 1000 Hz.
The last argument is the inititial state in a VTK file. The
simulation creates a file sph-result-2d.h5 which contains the
particle data at each of the save time steps. Also, information about
the simulation is printed to the console in XML format and saved also
in the file sph-result-2d.sphrun.xml.
For more information on sphere options, run
sphere -hsphere is just a shell script that launches the actual SPH
binary. Some settings are not yet available as options in sphere but
can only be triggered using environment variables.
There is the script h52vtk.sh, which converts a single HDF5 file
into a series of VTK files, which can be viewed with Paraview.
h52vtk.sh sph-result-2d.h5This creates a directory sph-result-2d with files res_00000.vtk,
res_00001.vtk, … which contain the dynamic particle data and a
file boundary.vtk which contains the static (boundary) particle
data.