ArcturusZhang / DualSPHysics

C++/CUDA/OpenMP based Smoothed Particle Hydrodynamics (SPH) Solver

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool


DualSPHysics
DualSPHysics

DualSPHysics is based on the Smoothed Particle Hydrodynamics model named SPHysics.

The code is developed to study free-surface flow phenomena where Eulerian methods can be difficult to apply, such as waves or impact of dam-breaks on off-shore structures. DualSPHysics is a set of C++, CUDA and Java codes designed to deal with real-life engineering problems.

Instructions for regular users

If you only want a copy of DualSPHysics to create and run cases in your system, you probably want the full DualSPHysics package from the official website. There you will find documentation and packages of different versions for different Operating Systems.

It is possible that you want the latest version in this repository that is not yet uploaded in the official web page. In this case check the Building the project section to build an executable.

Have in mind that DualSPHysics needs a case already created to execute the SPH solver, so you need to use GenCase, which is included the main package on the DualSPHysics webpage.

If you need help check out the wiki for this project.

Instructions for docker

You can build a Docker container of DualSPHysics using the provided Dockerfile. The Docker-container can be build with the following command:

docker build -t dualsphysics .

After a successful build, you can run DualSPHysics using docker:

docker run dualsphysics ./DualSPHysics4.2CPU_linux64

This command works similar for the other executables, e.g.:

docker run dualsphysics ./GenCase4_linux64

The Docker container runs a minimalized image of Ubuntu, thus only the linux64 executables work.

It is necessary to mount the working directory to the Docker container. Suppose you want to simulate a case defined in the file /path/to/CaseDef.xml. You have to execute the following commands:

# executes GenCase
docker run -v /path/to:/run dualsphysics ./GenCase4_linux64 /run/CaseDef /run/out/Simulation -save:all

# executes DualSPHysics
docker run -v /path/to:/run dualsphysics ./DualSPHysics4.2CPU_linux64 /run/out/Simulation /run/out -svres -cpu

On your system, the directory /path/to/out/ must exists. Here all output files are stored. The parameter -v mounts all files in path/to to the container in the directory /run.

We haven't tested the GPU version of DualSPHysics which probably will not work with the current Dockerfile. Feel free to create a pull request with an improved version.

You can run DualSPHysics on all platforms including Mac OS X with this Docker container but probably not with the optimal performance.

Instructions for developers

If you are a developer and want to use this code check the following guides.

Take into account that for pre- and post-processing you will need to use GenCase and the different post-processing tools included in the main DualSPHysics package, here. If you compile your own DualSPHyiscs version just overwrite the one in the package.

Developing a modified version to fit your own needs.

You can fork this repository and change or add anything you want. Keep in mind that your changes will not be taken into account into the main versions. If your objective is to implement your changes/improvements to the main code, check the next section.

Developing a modified or improved version to contribute to the project.

We appreciate your efforts! But please, if you are trying to develop/implement a functionality to be added to the main repository, be sure to follow the steps described in the CONTRIBUTING.md file.

Building the project

Microsoft Windows

This application is being developed in Visual Studio Community 2015 since it is free and compatible with CUDA 9.2 (download web). The repository contains project files.

Make sure that you install the CUDA SDK beforehand if you want to compile the GPU version, and configure the Visual Studio project to point to the CUDA libraries directory to compile (now prepared for CUDA 9.2).

You can also use CMake. It is possible that you'll need to edit it. Check the Alternative building method via CMAKE section of the wiki for more details.

GNU/Linux

Using Makefile

You can build the project in GNU/Linux using the Makefile included in the source folder. Follow these steps (for the GPU version):

  1. Clone this repository into your system git clone https://github.com/DualSPHysics/DualSPHysics.git
  2. In a terminal, go to the folder cd DualSPHysics/src/source/
  3. Edit the Makefile file with a text editor and then:
    • Set the DIRTOOLKIT variable with the path to CUDA in your system e.g. DIRTOOLKIT=/opt/cuda
    • Make sure that your G++ compiler version is compatible with the CUDA version installed in your system (e.g. CUDA 9.1 only supports G++ versions up to 6.x). If you want to use an specific version, you should modify the variable CC, for example: CC=/usr/local/bin/g++-6
    • If you are using G++ version 5 of greater make sure to set USE_GCC5=YES
  4. Execute make clean to make sure the environment is clean and ready to compile.
  5. Execute make

After compiling you should see a message like --- Compiled Release GPU/CPU version ---. Go to bin/linux/ to check that DualSPHyiscs_linux64 or DualSPHyiscsCPU_linux64 is there and build correctly.

For the CPU version: If you want to compile de CPU version just ignore CUDA and use the makefile Makefile_cpu. To specify a different file to make, use the -f parameter: make -f Makefile_cpu

Using CMake

Alternatively you can use CMake to compile DualSPHysics following these steps:

  1. Clone this repository into your system git clone https://github.com/DualSPHysics/DualSPHysics.git
  2. In a terminal, go to the folder cd DualSPHysics/src/source/
  3. Create a temporal directory were the build files will be placed mkdir build
  4. Make sure that your GCC compiler version is compatible with the CUDA version installed in your system (e.g. CUDA 9.1 only supports G++ versions up to 6.x). If you want to use an specific version, you should modify the environment variable CC and CXX, for example: export CC=/usr/local/bin/gcc-6; export CXX=/usr/local/bin/g++6
  5. Go to the build folder and execute cmake cd build; cmake ..
  6. Execute make

If CUDA is not installed in your system, only the CPU version will be compiled.

If you want the binaries be placed into bin/linux directory, just type make install

Graphical user interface (GUI)

DualSPHysics

Please check DesignSPHysics website.

Advanced visualisation with Blender

DualSPHysics

Please check VisualSPHysics website.

Contributing

Please read CONTRIBUTING.md if you want to make changes to the code.

Authors and people involved

  • Dr Jose M. Dominguez - Main Developer
  • Dr Alejandro Crespo
  • Prof. Moncho Gomez Gesteira
  • Dr Anxo Barreiro
  • Orlando G. Feal
  • Dr Benedict Rogers
  • Prof. Peter Stansby
  • Dr Georgios Fourtakas
  • Dr Athanasios Mokos
  • Dr Renato Vacondio
  • Dr Ricardo Canelas
  • Dr Stephen Longshaw
  • Dr Corrado Altomare

See also the list of contributors who participated in this project.

License

This project is licensed under the LGPL License - see the LICENSE file for details.

About

C++/CUDA/OpenMP based Smoothed Particle Hydrodynamics (SPH) Solver

License:GNU Lesser General Public License v2.1


Languages

Language:C++ 87.2%Language:Cuda 11.6%Language:C 0.7%Language:CMake 0.2%Language:Makefile 0.2%Language:Dockerfile 0.0%Language:Batchfile 0.0%Language:Shell 0.0%