euler2d: 2-D inviscid flow/adjoint solver

euler2d is a 2-dimensional inviscid flow and adjoint solver. It solves the Euler equations of gas dynamics on unstructured triangular grids using a vertex-centroid scheme which is second order accurate. The adjoint solver is developed using the automatic differentiation tool Tapenade. Both the flow and adjoint solvers are accelerated using matrix-free LUSGS scheme.

A brief description of the algorithms used here is given in a technical report.

Getting the code

You can get the source via anonymous svn by executing the following command

svn checkout http://euler2d.svn.sourceforge.net/svnroot/euler2d

This will create a directory called euler2d which contains all the sources. The sub-directories are

  • src-flo: This contains the flow solver files.
  • src-adj: This contains the adjoint solver files.
  • src-mesh: This contains files for mesh deformation and mesh adjoint computation.
  • tapenade: This contains some tapenade related files.
  • examples: This contains some example grids and test cases.

You can also browse the source code in the svn repository.

Compiling the code

  • The code is compiled using make. I have tested it only with GNU make.
  • You will need a fortran and C compiler, and the AD tool Tapenade (for adjoint solver only, see below for link to Tapenade website).
  • The Makefile assumes that you have already set a fortran compiler in the shell environment variable F77. You can also set it in Makefile.in which is located in the base directory. Read the comments in this file.
  • Note that gcc is required since I do some preprocessing of some fortran source files; you may be able to use other C compilers but I have not tested any.
  • You can compile the flow, adjoint and mesh programs from the base directory or by going inside the corresponding directories. In the base directory, type make flo or make adj or make mesh to compile the individual programs. Type make to compile all of them.
  • The executables are saved in the corresponding directories; you may want to set your PATH variable to include these directories or copy the executables to some other directory which is already in your path.

Limitations

This is not an exhaustive list of limitations.

  • The flux function cannot be changed using the input files. By default, KFVS subroutines are called. If you want to use a different flux function, you have to make changes in all the required files.
  • The limiter also cannot be controlled from the input files. You must edit the flux subroutines to switch on/off the limiter.
  • Only two boundary types are supported, solid wall and far-field. For far-field, Steger-Warming splitting combined with point vortex correction is used.
  • For adjoint solver, the cost function is the lift coefficient. To use your own cost function, see the following files to get an idea of how to modify them.
    • src-adj/cost_x.F
    • src-adj/cost_q.F
    • src-adj/costfunc.F

Input files

The input file for the flow solver should be of the following form:

Example input file for flo

Start     1
FlowType  1
Mach      0.40
AOA       0.00
Reynolds  100.0
CFL       1000.0
Explicit  0
LastIter  0
MaxIter   10000
MinRes    1.0e-6
SaveInt   100
NoIso     30
Flux      3
Limiter   0
FarBC     1  0.25  0.0
GridFile  "./naca3.struct"

The adjoint solver requires both the flow input file and an extra input file which is of the following form:

Example input file for adj

Start     1
CFL       1000.0
Explicit  0
MaxIter   75000
MinRes    1.0e-6
SaveInt   100
NoIso     50
Flux      3

A brief description of the various parameters is given in the table.

Variable Description
Start 1=Start from free stream conditions, 2=Start from previously saved solution
FlowType Ignore this, not required
Mach Mach number
AOA Angle of attack in degrees
Reynolds Ignore this, not required
CFL CFL condition for time-step
Explicit 1=Explicit, 0=Implicit
LastIter Usefull for grid adaptation, otherwise set to 0
MaxIter Maximum number of time steps
MinRes Residue for determining convergence
SaveInt Interval at which results will be saved
NoIso Number of iso-contours for gnuplot visualization
Flux Numerical flux function (not implemented yet)

Running and visualizing output

Try the example test cases given in the examples directory. First run the flow solver:

$ flo flo.inp

and then if you want, you can run the adjoint solver

$ adj flo.inp adj.inp

A lot of data is generated as output. The geometry and the grid are saved in BD.DAT and GRID.DAT which can be visualized using gnuplot:

gnuplot> set size square
gnuplot> plot 'BD.DAT' w l,'GRID.DAT' w l

The flow/adjoint solution is saved in three different formats. These files are written by src-flo/results.f and src-adj/results.f files.

  • gnuplot: FLO.M, FLO.P, FLO.VECT, ADJ.D, ADJ.U, ADJ.V, ADJ.E, ADJ.VECT
  • vigie: FLO.VIG, ADJ.VIG
  • vtk: FLO.VTK, ADJ.VTK
  • residue information: FLO.RES, ADJ.RES
  • general files: FLO.DAT, ADJ.DAT

Links

  • Tapenade: Automatic differentiation tool.
  • Gnuplot: GNU scientific data visualization program.
  • Vigie: A nice visualization tool for 2-D and 3-D data.
  • MayaVi: A VTK-based visualization tool.
  • BAMG: 2-D anisotropic grid generation program.
  • Delaundo: 2-D grid generation program, mainly for isotropic grids.
  • XV: A nice image viewer.
I am not actively working on this code at present. However you are welcome to write to me if you have any questions.

SourceForge.net Logo

 
research/euler2d.txt · Last modified: 2007/01/14 21:26 by pc     Back to top
Get Firefox! Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
This site will render correctly in Mozilla/Firefox.