Mittwoch, 17. April 2013

QPTool - A swelling process simulator running on GPU (CUDA, OpenGL)

This post is about my recent work. A swelling process simulator (german: Quellprozess) with glass fibers. The project is running at the IKGB Department of the University of Freiberg (East Germany). I have been working mostly on my own, doing this besides of my master study for one year and it makes a lot of fun. The simulator is open source, licensed under GPL v3, so you can grab the source from git (qptool). At the moment third party libraries are not provided, but they can be obtained from the web. I will post a running application here, when v1.0.0 is released.

The swelling process is driven by 'expanding' hydrogen gas bubbles within the fluid concrete. It is a part of the production process of the AAC, a really versatile, lightweight, cheap precast building material. That hydrogen gas is triggered by a really small amount of aluminium powder in the raw mix. The gas can escape later and in the end the pores contains just air.

To improve the properties of the AAC, (alkali-resistant) glass fibers will be added to the raw mix. The swelling process will distribute the fibers. The simulation helps to understand the movements and directions of the fibers from beginning to the end of the whole swelling process.

QPTool is written in C++, Qt 4.7.4, CUDA 5.0, OpenGL 3. The simulation and visualization is completely done on the (Nvidia) GPU. This gives a good framerate even for medium sized simulations (131k Spheres, 8k Fibers at ~16 FPS). The pores are just expanding spheres, following the Cherrypit Model. The fibers are just lines in the simulation colliding only with spheres (no fiber-fiber interaction), since the glass fibers are very thin.

  • Simple Raycast-Shader (e.g. Spheres are computed in Shader)
  • Multipass Raycast-Shader with Shadows and Edge Filter
  • Geometry Renderer (using instancing technique, but it is slower and uglier than simple raycast-shader)
  • CUDA driven physics engine
  • Using uniform space subdivision (based on SDK example 'particles' from Nvidia)
  • Slice-cutting computation (simulates cutting of the concrete block)
  • User can create fiber clusters with preferred directions
  • Real-data based and generic distribution of end radii of pores
  • Distribution of pores and fibers
  • Radii of pores
  • Fiber directions (phi/theta diagram)
  • ...
  • Recording long-term simulations into video alongside with statistics
  • Benchmark tool to compare algorithms
  • Export simulation data to csv for further processing
  • Import simulation data
  • Session and simulation setting management
  • ...

Just some pictures:

Comparison Shader vs. Geometry
Fiber Clusters
QPTool v0.9.7
Radius Distribution
Slice cutting the block

- S. Matthes: My boss :) He does the higher mathematics and experimental investigations for this simulation. Thanks for all the great discussions and for giving me this opportunity.
- Prof. B. Steinbach, allowing me to use an office room for free (including Desktop PC with Nvidia GPU of course :) )
- Nvidia, CUDA, Simon Green, SDK Demo 'particles'.
- Qt (used Qt 4.7.4), Qwt, Qxt / libqxt
- CAviFile Class, Xvid Encoder used for recording tool (video rendering)
- ...

Further sources which I used or adapted or helped me to understand the things better
- FastDelegate
- PixelBufferObjects Class
- Camera Control Class
- several tutorials over the web about OpenGL buffer objects, renderbuffer, framebuffer, shader instancing, shadows shader, ... (take the appropriate buzzword and google it)
- Christian Sigg (GPU-Based Ray-Casting of Quadratic Surfaces)
- Article on Molecules: Enhancing Molecules using OpenGL ES 2.0
- ... and many more ... :)

v0.9.7 still has some bugs and cylinder impostor shader is not finished yet.


  1. Very interesting your work, can you give me some more information about the physics you use and the analysis method? its FEM, meshless, what?

    Thank you in advance,

  2. Hi Konstantinos,
    the simulation involves discrete elements method (DEM) for the collisions.
    To speed up the simulation the world is subdivided into small parts (uniform subdivision). It is based on Simon Greens CUDA Demo "particles", you can find some more informations here:
    We introduced some more features, but it is still just plain DEM with hard and soft collision model for spheres and static cylinders.
    The simulation is still in use, but there hasn't been any developement on it due to other projects (hrr I need more time ;) ).

    Just ask if you need more informations.
    Best Regards

  3. Good morning, I am making a report for different interesting fem simulators like yours and I would like to refer to your work. Is there any scientific paper or other reference of you which I can include in my report?

    Thank you and have a nice day,

    1. Hi Konstantinos,
      There is just a german seminar paper which I have written in my study 2012. It was planned to make a paper for computational materials science, but time was missing as always.
      Here's a link:
      I will keep the pdf online, so you can refer to it, if you like to.
      You also can refer to this blog entry. The git source is not up to date (no more maintained) and it is not a showpiece anyway ;)
      But keep in mind, this is not a FEM simulation.
      Best Regards

  4. Hello Antworten, thanks for your reference. I used it and my supervisor is interested a lot in your procedure as far as we are not concerned for a FEM simulation but our work will be based on discrete methods too. I wish i could find some literature in english because german is not in my skills! If you can help with that I would be glad. Or if you have a version of your paper that can be translated, here is my email if you want to communicate with me.