Welcome to the most active Linux Forum on the web.
Go Back > Blogs > rainbowsally
User Name


Rate this Entry

f2c (with makefiles) and xfoil (that converges correctly in VISC mode).

Posted 03-10-2012 at 10:38 AM by rainbowsally
Updated 08-06-2014 at 11:27 AM by rainbowsally (stable)

f2c (with makefiles) and xfoil (that converges correctly in VISC mode).

For advanced programmers or folks that don't have 500 bucks for an air foil simulator/analyzer.

  • Bug fix(es) for f2c and xfoil retro apps.
  • Example of how to f2c when INC files mix data and declarations.
  • Example of a make system that builds its own uninstaller.
  • XPlot11 (included, renamed libPlt, but easily changed again.
  • The first of many reasons to install in a sandbox like HOME/usr32.
  • Switchable between static and dynamic builds (last time it was tested, anyway). :-) Default is the static build.

This is a largish exercise so I won't do it as a blog entry. If you have had trouble converting fortran to C, however, by splitting up the INC files (still in the sources) it was possible to get xfoil working with f2c.

This is xfoil, debugged so the analysis can converge, rewritten in C using f2c, which is also slightly modified to separate the args from the 'main' function. (Details on the bug at the bottom.)

It was originally in Fortran. This is based on the xfoil 6.97-2 version downloaded from mit and with f2c downloaded from netlib in pieces.

It's currently set up to create static libs and run in ~/usr32/bin when installed. NO ROOT PRIVILEGES NEEDED, NONE WANTED for the sandbox installation.

To make it a dynamic linked system,
make setup-dynamic
in both folders, then make and make install.

For both static and dynamic,
export PATH+=":$HOME/usr32/bin"
For the dynamic build
export LD_LIBRARY_PATH+=":$HOME/usr32/lib"
To change it from a sandbox installer to a real installer change PREFIX in the makeinclude-static and/or makeinclude-dynamic and re-make setup-static or setup-dynamic.

It creates an uninstaller in a directory PREFIX/uninstall/<appname>/, in case you want to get rid of the sources and just use the binary version as-is. The default location of this uninstaller would (therefor) be in ~/usr32/uninstall in case you want to check out how it works before modifying the PREFIX.

Make uninstall, just calls the uninstaller but you don't need the makefile to uninstall.

Save yourself 500 bucks and just download the f2c even if you aren't interested in windmill design (which is why I got xfoil). Also, f2c is a bit senstive to placement of declarations and data, so if you want to fancy it up, you might want to collect the parts before reassembling them into a file which I have not done in this upload because I could inadvertently introduce new bugs you'd have to work around.

re. bug in XFoil (air foil designer/analyzer).

There was apparently a bug in the xoper.f file that didn't allow converging in the viscid mode. The epsi variable was probably correct (1e-4) but other places in the file tighter epsilons were used which apparently made it impossible to converge at even low reynolds numbers for known naca foil shapes.

When all are set to 1e-4 it converges. When starting with low Reynolds numbers it is possible to increment them (double) without losing lock on the convergence.

Was also tested with smaller epsilons and though it may work (sometimes) it takes many more iterations and the end results are the same.

It's amazing to think this was written 40-50 years ago in the days of the punched card programming method.

Compared to openFOAM it... Well, at least it does air foils and quite easily once you get used the the screwy menus.

Oh! And XPlot11 (renamed libPlt) is a great example X11 window programming if you are hacking x11 low level stuff.

PS. If you want to turn the compiler warnings off you can remove the -Wall flag in the Makefiles, or you can try to bring the code up to current specs for your compiler as an exercise.

Posted in Uncategorized
Views 898 Comments 0
« Prev     Main     Next »
Total Comments 0




All times are GMT -5. The time now is 08:30 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration