A C++ code for numerical modelling of free-surface flow 🌊 using Explicit, Weakly Compressible or Incompressible Moving Particle Simulation/Semi-implicit (MPS) method. Boundary walls modeled by polygonal mesh (triangles) or particles (walls and dummies).
If you use PolyMPS, please cite the following reference:
Rubens Augusto Amaro Junior, Alfredo Gay Neto and Liang-Yee Cheng, "3D WC-MPS coupled with geometrically nonlinear shell for hydro-elastic free-surface flows", International Journal for Numerical Methods in Fluids. https://doi.org/10.1002/fld.5083
In order to install C++ compiler (GCC) on windows, we recommend to install Cygwin. You can find here how to install Cygwin. The following Packages should be selected during the Cygwin installation:
- automake
- gcc-core
- gcc-fortran
- gcc-g++
- gdb
- libstdc++
- make
Eigen, libigl and JSON for Modern C++ are third party header-only libraries, i.e., they do not need to be separately compiled, packaged and installed to be used 😍.
- SOLID DOMAIN:
- Boundary walls using triangular meshes. It is necessary to create a file (extension .stl) with informations about the initial geometry.
- Boundary walls using particles. Necessary to add one layer of wall particles (material ID = 2) and two layers of dummy particles (material ID = 3) in the .grid file.
- FLUID DOMAIN: it is necessary to create a file (extension .grid) with informations about the initial geometry and some numerical and physical parameters:
- First line: 0
- Second line: number of particles
- Next lines in the columns: material ID coordinates of particles X Y Z the initial fluid velocities (generally 0.0) VX VY VZ the initial particle pressure (generally 0.0) P and presure average (generally 0.0) PAV
- FOLDERNAMES, FILENAMES, PHYSICAL and NUMERICAL parameters: it is necessary to create a file (extension .json) and set all parameters.
There are some examples in the folder input.
Code compiled and tested on Windows 7, and Linux CentOS 7 and Ubuntu64.
You can build the project in GNU/Linux using the makefile. Follow these steps (CPU version):
Clone this repository into your system using terminal in Linux
, and Git BASH or command prompt (cmd) in Windows
git clone https://github.com/rubensaaj/polymps.git
Go to the folder polymps
cd polymps
Now, clone the third party libraries. You must run two commands
git submodule init
to initialize your local configuration file, and
git submodule update
to fetch all the data from the third party libraries.
Edit the Makefile
file (if necessary) with a text editor.
Make sure the environment is clean and ready to compile
make clean
Execute make
make all
This should create a binary main
in folder bin
- LINUX
In the terminal, type
./bin/main
- WINDOWS
You can do this in two ways:
1st way - In the command prompt, type
bin\main.exe
2nd way - Move the main.exe from the folder bin to the root folder polymps. After that, double click on main.exe.
Type the name of the json input file (located in input directory), e.g.
MpsInputExample
This code writes pvd (header file) and corresponding vtu files as output. Look in the output directory. You can visualize them by open the pvd file with Paraview 👓.
The PolyMPS contains several files and directories:
File/Folder | Description |
---|---|
eigen | library for linear algebra: matrices, vectors, numerical solvers, and related algorithms |
include | header files |
input | simple input examples (json, grid and stl files). Grid files compressed in a folder |
libigl | geometry processing library |
json | file that uses human-readable text to store and transmit data objects |
output | ouput files (pvd, vtu and txt files) |
src | source files |
LICENSE | MIT License |
Makefile | set of tasks to compile the program |
README | text file |
This project is licensed under the MIT License - see the LICENSE file for details.