Skip to content

CERNN/VISCOPLASTIC-LBM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LBM Viscoplastic

This is a LBM (Lattice Boltzmann method) project for flow simulation, using C/C++ and CUDA API. The velocity sets supported are D3Q19 and D3Q27.

If you are not familiarized with the method, we strongly recommend the book The Lattice Boltzmann Method: Principles and Practice by Kruger et al. as a guide.

For software citation use PERFORMANCE ANALYSIS OF THE LATTICE BOLTZMANN METHOD IMPLEMENTATION ON GPU, by Oliveira et al., XL CILAMCE (CILAMCE site, Research gate)

Features

The LBM features supported are:

  • Boundary Conditions

    • Zou-He (velocity or pressure)
    • Bounce-back (velocity)
    • Free slip
    • Interpolated bounce back
  • Collision

    • BGK operator
    • Regularization
    • Constant force
  • Velocity Sets

    • D3Q19
    • D3Q27
  • Non-Newtonian Fluid Model

    • Power-Law
    • Bingham

The IBM features supported are:

  • Geometries
    • Movable Spheres
    • Fixed Cylinders
  • Collision
    • Hertz-Mindlin

Other features can be implemented or changed. The file updating.md gives more details on that.

Compilation

The requirements are:

  • Nvidia drivers must be installed
  • CUDA API must be installed

Both can be obtained in "CUDA Toolkit", provided by Nvidia.

The code supports Nvidia's GPUs with compute capability 3.5 or higher. The program runs in only one GPU, multi-GPU support is in development.

For compilation, a bash file is provided. It contains the commands used to compile and the instructions for altering it according to the GPU compute capability and the arguments to pass to it.

Simulation

The output of the simulations are binary files with the content of macroscopics (density, velocity, etc.), an information file with the simulation parameters (lattice size, tau, velocity set, etc.), It is also provided an option to output treated data, values obtained by the treatment of simulation macroscopics, as residual and average density. The simulation information and the treated data are also printed on screen. To convert from binary to interpretable data, a Python application is provided. "Post Processing" gives more details on that.

More details on code usage is described in updating.md. The file describes how to change simulation parameters, boundary conditions, collision scheme, etc.

Documentation

The documentation of the source files is made in markDown files (files.md and updating.md) and in header files (.h), with each function presenting @brief, @param and @return, describing what it does, its parameters and what it returns.

Post Processing

Since the program exports macroscopics in binary format, it is necessary to process it. For that, Python source files are provided. python3 is required and the packages dependecies are:

  • glob
  • numpy
  • os
  • pyevtk
  • matplotlib

Two example files are presented in CUDA/Post Processing/ folder. Basic data treatment, exportation and plot is implemented by these files. Graphics f(x)=y, heatmaps and exportation to VTK and .csv are the examples provided. Feel free to alter these to match the required data processing.

Implementations details and more informations can be obtained in the source files and in files.md.

Create Visual Studio 2019 Project

  1. Create project with CUDA template
  2. Exclude the default file kernel.cu
  3. Add all .cpp, .cu, .h, etc. files in the src/CUDA folder to the project, except for the ones in boundaryConditionsBuilders folder
  4. Change the project settings (right click on projetct, then properties) to:
    1. Set Depuração->Diretório de trabalho to the folder where main.cu is (src/CUDA)
    2. Cuda C/C++ -> Common set Generate Relocatable Device Code to yes (-rdc=True)
    3. Update CUDA C/C++ -> Device
      1. Code Generation to compute_CC,sm_CC where CC is the compute capability of your device (37, 61, 75, etc.)
      2. Use fast math to yes
    4. Update Linker -> Input
      1. Add to Additional dependencies the libs cudadevrt.lib;curand.lib. The final string should be something like "cudadevrt.lib;curand.lib;cudart_static.lib;kernel32.lib;...[continues]"

License

This software is provided under the GPLv2 license.

Contact

For bug report or issue adressing, usage of git resources (issues/pull request) is encouraged. Contact via email: waine@alunos.utfpr.edu.br and/or cernn-ct@utfpr.edu.br.