Skip to content

A quadtree decomposition based grid generator built for numerical solution of fluid flows.

Notifications You must be signed in to change notification settings

aerosayan/SAMARITAN

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DISCLAIMER

Some researchers have reached out to me, to use this tool for running CFD simulations. Unfortunately, this is just a basic tool, and doesn't produce a mesh suitable for CFD. I made this as an exercise, so kindly be aware of this. However, if you wanted to look into the code and see how the cell identification, intersection tests, root disection happens, feel free to do so.

SAMARITAN

A block structured grid generator based on quad tree decomposition.

Author : Sayan Bhattacharjee

LICENSE : DEFAULT : for now; will update to GPL v2 very soon.

genius-hagrid

INTRODUCTION

This is a block stuctured grid generator based on quad tree decomposition for Computaional Fluid Dynamics(CFD). The quad tree decompositon is done after running a series of ray-box intersection tests. The ray is created from the geometric edges and the box are the internal domains of the mesh.

AIM OF CREATION

Primary aim :

This grid generator was created by me to satisfy my personal intrigue of hypersonic CFD simulations. Since, the grid created is block structured in nature, thus it is meant to be used effeciently using Adaptive Mesh Refinement(AMR), possibly for my PhD in distant future.

Secondary aim :

CFD is cool and very math and computational power intensive, thus I just wanted to learn how this things work under the hood. Adaptive Mesh Refinement has some common aspects with Machine Learning too, essentially both are based on minimizing error/cost/residual function results at positions of high gradients, which I just adore.

spiderman-desk

INSPIRATION

Inspiration came from SpaceX personell Adam Lichtl and Stephen Jones from their talk about simultating combustion in very large rocket engines.
From: GPU Tech Conference, San Jose, California, March 17 - 20, 2015. Originally posted on :
http://on-demand.gputechconf.com/gtc/2015/video/S5398.html

FOLDER STRUCTURE :

SAMARITAN

  • src/ : contains the source files
  • src/mods/ : contains the C++ backend
  • geoms/ : contains the mesh geometry
  • mesh-pictures/ : conatains mesh output pictures
  • memes/ : Can I has grid please?

TECHNOLOGY USED

  • C++ for high performance backend code,
  • Cython for linking C++ code with Python,
  • Python for calling the C++ code,
  • Python for visualization.

COMPILATION AND TEST

For developers :

To compile only the C++ code and do development. First cd to src folder, then run scons, then run main.exe, then run visualizeMesh.py. Note that MSYS2 was used to provide linux like environment in windows to provide good programming experience. And if requried the basic cmd commands can also be used by a user who does not wish to use MSYS2.

$ cd src
$ scons
$ main.exe
$ python visualizeMesh.py

For use in python :

Cython is used to allow Python to call the grid generator from Python itself. For this, setuptools of Python 2.7 was used to create a .pyd file that can be imported into Python as a library. It is to be noted that we are using Microsoft Visual Studio Compiler to compile our library for compatibility reasons.

$ cd src
$ python setup.py build_ext --inplace -cmsvc
$ ls | grep samaritan.pyd
samaritan.pyd*
$ python testSamaritan.py
$ python visualizeMesh.py

Meshing result for a NACA-2412 aerofoil

Fig 1 : NACA 2412 mesh NACA 2412 mesh

Fig 2 : NACA 2412 mesh zoomed NACA 2412 mesh zoomed

Fig 3 : NACA 2412 trailing edge mesh zoomed NACA 2412 trailing edge mesh zoomed

For more pictures see mesh-pictures folder.

Future work

  • For the sake of everything that is fluffy and sweet in this world, refactor the visulaization script to use bokeh or datashader instead of matplotlib.
  • Allow plotting of multiple geometries at once.
  • Clean out the un-necessary volumes inside the solid region of the aerofoil geometry.
  • Allow python full control over the geometry selection and mesh creation from Python.
  • Make it easy to select and name the different boundaries and set the boundary conditions.
  • Allow optional conversion of std::vector containers to simple C arrays to allow compatibility with Numpy.

Current flow solver status

gordon-angry

Disclaimer

I do not own the memes.Do I need to ?

About

A quadtree decomposition based grid generator built for numerical solution of fluid flows.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published