Channelflow examples/README file. 1. Prerequisites 1.1 Software development 1.2 Computational fluid dynamics 2. Compiling channelflow example programs ==================================================================== 1. Software development prerequisites 1.1 Software development prerequisites There are some prerequisites to writing channelflow programs. You should be have a minimal familiarity with writing and compiling C or C++ programs using Unix command-line utilities (e.g. gcc). For example, you should be able to write, compile, and execute a simple "hello, world" program in C or C++. It is very helpful to have basic familiarity with the underlying concepts of software development and compilation (e.g. Makefiles, source code, header files, object files, libraries). There is a lot of documentation on the web for this, for example, http://classes.engr.oregonstate.edu/eecs/summer2008/cs261/gcc_tutorial.pdf http://www.cs.virginia.edu/~son/cs414.s08/make.tutorial.pdf A very large fraction of the questions I get about channelflow are actually about software compilation. I would appreciate it if you consulted readily available documentation, or even worked through an on-line tutorial on software compilation, before asking me what do when you get an error like this gibson@tansen$ make couette.x g++ -Wall -O2 -fomit-frame-pointer -DNDEBUG -I/home/gibson/chunnelflow/include -c couette.cpp couette.cpp:3:29: error: channelflow/dns.h: No such file or directory couette.cpp:4:35: error: channelflow/flowfield.h: No such file or directory couette.cpp:5:35: error: channelflow/utilfuncs.h: No such file or director This is a run-of-the-mill gcc error caused by a typo in the gcc flag that specifies the location of channelflow header files ("channelflow" is misspelled as "chunnelflow"). The value of this flag is set in the examples/Makefile through the CHANNELINC variable. Check whether the value you have set in examples/Makefile is correct (i.e. specifies the location of the channelflow/*.h header files. 1.2 Computational fluid dynamics prerequisites (to be written) ==================================================================== 2. Compiling channelflow example programs This directory provides some simple examples of channelflow programs and a simple Makefile, in order to illustrate how channelflow programs can be written and compiled. THESE EXAMPLE PROGRAMS ARE NOT INTENDED FOR PRODUCTION RUNS. You can use them as a starting point for your own codes. But please refer to the programs in channelflow/programs as well, since these codes are more configurable and make better use of channelflow's features. Reading channelflow/doc/TUTORIAL is a good starting point for the channelflow/programs. A second warning: YOU MIGHT HAVE TO MODIFY THE MAKEFILE IN ORDER TO GET IT TO COMPILE CORRECTLY. The examples/Makefile is as simple as possible, in order that it can be modified simply to suit your needs. But that generally means you MUST modified the Makefile to get it to work correctly. See step 2.2 below. To compile and run the example programs in this directory 2.1 Configure, build, and install channelflow as specified in the INSTALL file in the top-level directory of the channelflow distribution. 2.2 Edit the examples/Makefile to set the CHANNELDIR variable to the directory in which channelflow is installed. E.g. if you configured channelflow with "./configure --prefix=/home/brenda", you'll need to change Makefile to read CHANNELDIR = /home/brenda In some cases you might need to manually edit the CHANNELINC and CHANNELIB variables, too. For example, if channelflow was installed by a system administrator into system-wide directories, you might need to figure out where the headers files and libraries are, and manually set CHANNELINC and CHANNELLIB accordingly, for example CHANNELDIR = CHANNELINC = -I/usr/include CHANNELLIB = -L/usr/lib64 2.3 Compile an example programs. E.g. make couette.x If you compiled and installed the channelflow debugging libraries, you can compile debuggable executables as well, with make couette.dx If you encounter errors at this stage, they are in all likelihood caused by a misconfigured Makefile sending gcc the wrong compilation options. Check the values of the -I and -L gcc option that get printed to the screen. These values show where gcc is looking for header files and libraries, respectively. Look in those directories. If those directories don't contain channelflow/*.h and libchflow.so (or libchflow.a), you need to fix the Makefile. See step (a). Please consult readily available documentation on the web about gcc options and Makefiles for help configuring them properly. 2.4 Make sure that the channelflow library directory is in your shared library path. With the bash shell (the default on most Unix systems including Mac OS X), do this echo $LD_LIBRARY_PATH /usr/local/lib:/usr/lib64/octave-3.0.0 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/brenda/lib echo $LD_LIBRARY_PATH /usr/local/lib:/usr/lib64/octave-3.0.0:/home/brenda/lib If you're running tcsh or csh (god help you), try setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:/home/brenda/lib in place of "export LD_LIBRARY_PATH ..." above. It's a good idea to put this command in your shell start-up file, e.g. ~/.bash_profile or ~/.tcshrc. 2.5 Run the program ./couette.x or ./couette.dx If you encounter an error like this couette.x: error while loading shared libraries: libchflow.so.0: cannot open shared object file: No such file or directory your operating system cannot find the shared library needed to execute couette.x. You need to set the LD_LIBRARY_PATH variable as described in step (c). 2.6 The couette.x program will integrate a flow and save data to disk in a data/ directory. What next? The channelflow/doc/TUTORIAL explains how to use channelflow utilities to analyze and plot this data. See also channelflow/INSTALL for compiling and locating the channelflow libraries channelflow/docs/TUTORIAL for prerequisites for writing channelflow codes channelflow/docs/channelflow.tex for detailed discussion of the libraries