Syntax Highlighting

Saturday, 5 January 2013

Call Graph in Xfoil

Use the following procedure to visualise the logic through xfoil:
  1. Make sure you have the correct dependencies
    1. gprof (or one of the alternative profilers installed).
    2. Make sure you have graphviz 
    3. Download gprof2dot.py
    4. Make sure that you can compile xfoil properly
  2. Modify the flags in the Makefile (${srcdir}/Xfoil/bin/Makefile) to allow the profiling of the xfoil code.
    1. Add the -pg option to the FFLAGS and FFLOPT makefile variables.
    2. Add the -pg option to the make xfoil command line ("    xfoil: $(XFOILOBJ) $(XUTILOBJ)... $(FC) -o xfoil $(XFOILOBJ) .... -pg"
    3. Note it may be necessary to do a "make clean" to be able to recompile xfoil.
  3. Now create a script file that touches all the xfoil commands that your interested in. 
    1. Example below does an viscous, (slightly) compressible analysis analysis of a NACA 23012 airfoil section at 10 degrees AoA.
  4. Now run the script.
    1. ~/bin/xfoil < naca23012.xfoilscript
    2. Note that I have a bin directory in my home folder (~) that has a symbolic link to the particular xfoil program I want to run. Hence ~/bin/xfoil command.
  5. If you've compiled xfoil correctly you'll get profiler file (gmon.out for gprof) file in the same directory that you ran the xfoil script in.
  6. Now run the gprof2dot script to generate a dot file.
    1. gprof ~/bin/xfoil | ./gprof2dot.py -n0 -e0 | dot -Tpng -o xfoil.png
  7. Enjoy the call graph
Xfoil call graph for the example script



Xfoil Script


$ cat naca23012.xfoilscript
plop
g


naca
23012

oper
v
3e5
m
0.3
a
10


quit

No comments:

Post a Comment