Escolar Documentos
Profissional Documentos
Cultura Documentos
HowtoUseOpenFOAMwithEclips
Contents
1 2 3 4 5 Thanks to .. Versions Eclipse Capabilities Aim of the tutorial Download and set up Eclipse 5.1 Install CDT by hand 5.2 Launching C++ project 6 Developing and compiling 7 Running applications and debugging 8 Annotations and hints 8.1 Eclipse and python 8.2 Working in parallel with the terminal 8.3 Increase Java heap space for Eclipse 8.4 Limit the number of sources 8.5 Further information
1 Thanks to ..
Patrik Eder for his help with setting up Eclipse and Holger Marschall for proofreading.
2 Versions
Operating system: openSuse 10.2 OpenFOAM version: OpenFOAM-1.6.x Eclipse version: eclipse 3.5.1 (eclipse Galileo)
3 Eclipse Capabilities
"Eclipse is an open source community whose projects are focused on building an extensible development platform, runtimes and application frameworks for building, deploying and managing software across the entire software lifecycle. Many people know us, and hopefully love us, as a Java IDE but Eclipse is much more than a Java IDE." - www.eclipse.org (http://www.eclipse.org)
Eclipse is a powerful integrated development environment IDE originally developed for Java programming. But with the C/C++ Development Toolkit (CDT) extension Eclipse becomes a very common IDE for C++ programming. If you want to work on a project in OpenFOAM, it is even not necessary to import the whole OpenFOAM-folder. Only import the project you are working on and the rest of the code will be linked for developing and debugging.
2011/3/18
HowtoUseOpenFOAMwithEclips
In this tutorial we will import a standard OpenFOAM solver and set up Eclipse for OpenFOAM. After a short introduction in Eclipse's developing features for applications and libraries, debugging in the Eclipse environment using the GNU Debugger GDB will be presented. Everything will be carried out with simpleFoam on the test case pitzDaily while having a look at the turbulence models as libraries.
Now, set the OpenFOAM compiler properties for Eclipse. Right-click on your new project in the project explorer on the left side, select properties. Set the compiler command under C/C++Build. Deactivate the default build command and type in OpenFOAM's wmake. Deactivate Generate Makefiles automatically. Set the build directory maybe you have to remove the /Release or /Debug. Click OK. Make sure, that Project -> Automatically build in the menu bar is deactivated.
openfoamwiki.net//Howto_Use_
2/8
2011/3/18
HowtoUseOpenFOAMwithEclips
The Eclipse editor offers some advantageous tool as the indexer that searches your workspace or project for variables and objects. Another tool is the automatic completion for functions. Call a class and set a dot for a function after it, and you will be offered a list of available functions including parameters. This allows fast programming and avoids searching and jumping between windows. Errors and warnings are marked on the left side of the editor window. Additionally you can set bookmarks or tasks. But please keep in mind that the indexer works only for the imported parts of OpenFOAM.
openfoamwiki.net//Howto_Use_ 3/8
2011/3/18
HowtoUseOpenFOAMwithEclips
On the right hand side you can select the outline tab, which presents you the outline of current functions, namespaces and files. (Hint: If the outline tab is missing select: Window -> Show View -> outline this is valid for all views) If you want to compile a certain part of your imported project, you must create a make target for Eclipse. Therefore select the make targets tab on the right side of the window. Select the folder where your Make folder is in, and create a new make target with the new make target button. For compiling an application create a make target named wmake and leave the make target box plain. Build command is the default wmake -- corresponding to the console command wmake. If you want to execute wclean, create a make target named wclean and leave the make target box plain again. Change the build command to wclean. Execute your make target by double-clicking on it and watch the output in the console window.
Now, create your own turbulence model as described in the OpenFOAM Wiki tutorial "How to use your own turbulence model" of the Special Interest Group (SIG) Turbomachinery. Import the library as C++ project as mentioned above. For compiling the new turbulence model using wmake libso in OpenFOAM, name your make target libso the build command stays wmake. In analogous way create a wclean libso make target.
2011/3/18
HowtoUseOpenFOAMwithEclips
before you should run your preprocessing tools as blockMesh in the terminal on beforehand. Then set up the run configurations in the menu bar under Run -> Run Configurations. Choose your test case as project and your solver as application. Here, the test case pitzDaily is chosen as project and the solver simpleFoam is chosen as application. To start your simulation just click on the run button and follow the console output.
It is also possible to debug applications under Eclipse with the GNU Debugger gdb. Therefore you may need to compile your OpenFOAM version in the debug mode of the compiler. Change the compiler settings in OpenFOAM/OpenFOAM-1.6.x/etc/bashrc to debug with WM_COMPILE_OPTION:=Debug and compile OpenFOAM using ./Allwmake. This will take a few minutes. Open the configurations for debugging under Run -> Debug Configurations. Choose the same settings for project and application as for the run configurations. Finally make sure, that you are using the GDB (DSF) Create Process Launcher. If necessary, change it by clicking on hyperlink Select other.
openfoamwiki.net//Howto_Use_
5/8
2011/3/18
HowtoUseOpenFOAMwithEclips
Start debugging by clicking on Debug. Now, the debug perspective should open if not, activate it in the menu bar under Window -> Open Perspective -> Debug. The program should stop at the first breakpoint that is default set to the begin of main{}. Now you can set breakpoints by clicking on the bar left in the editor window. Restart debugging by clicking on the green play button. Watch the console output on the bottom, the variable values and breakpoints on the right hand side. Unfortunately, Eclipse isnt able to display the values of vectors or even vector fields. You can walk through the code line by line while Eclipse emphasizes the line of the file it is currently reading. Use step into and step over buttons as well as breakpoint to navigate through the code.
openfoamwiki.net//Howto_Use_
6/8
2011/3/18
HowtoUseOpenFOAMwithEclips
2011/3/18
HowtoUseOpenFOAMwithEclips
project. This will link the project with the python backbone.
Use top command for watching heap space usage in linux console.
openfoamwiki.net//Howto_Use_
8/8