Praveen Chandrashekar

Centre for Applicable Mathematics, TIFR, Bangalore

[ People | News | Codes | Talks | Teaching | Publications | Calendar | Hiking | Contact ]

Computational Fluid Dynamics

Students

IIT Ghandhinagar: Rachit, Himanshu, Vinay, Yogesh, Neelesh
TIFR-CAM: Anant Diwakar, Deep Ray

Slides

  1. Linear hyperbolic conservation laws
  2. Non-linear conservation laws
  3. High order methods
  4. Linear hyperbolic systems
  5. Euler equations in 1-D
  6. Flux vector splitting schemes
  7. Flux difference splitting schemes (Approximate Riemann solver)
  8. JST, SLIP and CUSP schemes
  9. Low mach number schemes
  10. Compressible flow equations
  11. Finite volume method on unstuctured grids
  12. Convergence acceleration techniques

Computer programs

  1. Solution of inviscid Burger’s equation (matlab)
  2. 1-D finite volume code for shock tube problem (C++): FVM code, Exact solution, gnuplot script

Exact solution for shock tube problem

Here are the steps to run the exact solution code from book of Toro. This requires fortran compiler and gnuplot. The five test cases have been setup in different files test1.ini, etc. The output solution is written into the file e1rpex.out which contains x coordinate, density, velocity, pressure and internal energy (basically temperature).

gfortran E1RPEX.F -o E1RPEX
./E1RPEX < test1.ini
gnuplot allplot.gnu

This creates postscript file allplot.ps which can be opened to see the solution.

1-D finite volume code for shock tube problem

Download the three files given above. This code solves Euler equations in 1-D for given initial condition. It has kinetic split fluxes and reconstruction using minmod limiter. You can run it in first order or second order mode. The initial condition is based on test1.ini conditions so we can compare with exact solution.

g++ fv_euler_1d.cc
./a.out
gnuplot fvm.gnu
gv fvm.ps

The postscript file contains numerical and exact solution. Run it for first order and then for second order and see the solution in each case. You have to set the variable order in function FVProblem::FVProblem () which is the constructor of the FVProblem class.

Compiling SU2

Here are the steps to compile serial version. I am going to install it into /Users/praveen/Applications; modify it according to your actual installation location. In the following $ denotes the shell prompt in the terminal where you type in your commands.

$ cd /Users/praveen/Applications
$ tar zxvf SU2v2.0.tgz
$ cd SU2v2.0
$ ./configure --prefix=`pwd`
$ make
$ make install

Add following lines to your $HOME/.bashrc file.

export SU2_RUN="/Users/praveen/Applications/SU2v2.0/bin"
export SU2_HOME="/Users/praveen/Applications/SU2v2.0/trunk"
PATH=$PATH:$SU2_RUN
export PATH

The part in red may be different in your case; modify above lines according to your installation path. Then open new terminal and check the following variables have been defined.

$ echo $SU2_RUN
/Users/praveen/Applications/SU2v2.0/bin
$ echo $SU2_HOME
/Users/praveen/Applications/SU2v2.0/trunk

If you now type SU2_CFD you should get following result

$ SU2_CFD
There is no configuration file!!
Press any key to exit...

If you get different result then you made a mistake in the above steps.

Meshing using Gmsh

Gmsh is an excellent open source meshing tool for unstructured grids. You can get binaries for most common platforms from their website.

To try the diamond airfoil case, download the Gmsh script from here. You can open it in Gmsh and use the gui to do mesh generation.

Or you can do it from the command line

gmsh -2 diamond.geo

which creates the mesh file called diamond.msh. You can open this in Gmsh to see the mesh. We now need to convert the msh file to su2 format. I borrowed a code I found online and Anant Diwakar made some small modifications. You can get the converter here. Compile the converter and run it as shown below. You have to input the filename of msh file without the msh extension as shown in red below.

$ gfortran gmsh2su2d.f90 -o gmsh2su2d
$ ./gmsh2su2d 
 Gmsh2SU2: Converts a Gmsh mesh file to SU2 format.
 (Input must be in Gmsh version 2.0 ascii format.
  Output is in SU2 format.)
  
 Input Gmsh filename, excluding the .msh suffix
diamond
 Opening the Gmsh file
 Reading MeshFormat
 MeshFormat: 2.2 0 8
 
 Reading PhysicalNames
 Name            2 -> airfoil                                                                 
 Name            3 -> farfield                                                                
 Name            1 -> domain                                                                  
 Reading Nodes
 Nodes written         5306
 Total Gmsh elements to be read in:       10612
 
 Creating the .su2 files
 Triangle boundaries:        10352
 Done su2 file.
 
 Done gmsh2su2

This creates the file diamond.su2 which can be used in SU2.