Exploring Openfoam Source Code: There and Back Again
Exploring Openfoam Source Code: There and Back Again
Exploring Openfoam Source Code: There and Back Again
2
Chalmers OpenFOAM course: Guest presentation March 28th 2008
Navigating the OpenFOAM class maze:
Doxygen:
Documentation system for C++, Java, Python, C, etc.
Generates:
– On-line documentation in HTML from C++ source code
– Inheritance Class diagram
– Collaboration class diagram
– Hyperlinks so you can navigate swiftly through the class hierarchy
– Hyperlinks to the actual source code class definition (.H files)
– Search facility available if using a Web server (PHP script)
The configuration files for generating your own local copy of the
Doxygen documentation is also available
– $WM_PROJECT_DIR/doc/Doxygen/
3
Chalmers OpenFOAM course: Guest presentation March 28th 2008
A quick overview of OpenFOAM Doxygen doc: (1/14)
4
Chalmers OpenFOAM course: Guest presentation March 28th 2008
A quick overview of OpenFOAM Doxygen doc: (2/14)
5
Chalmers OpenFOAM course: Guest presentation March 28th 2008
A quick overview of OpenFOAM Doxygen doc: (3/14)
6
Chalmers OpenFOAM course: Guest presentation March 28th 2008
A quick overview of OpenFOAM Doxygen doc: (4/14)
7
Chalmers OpenFOAM course: Guest presentation March 28th 2008
A quick overview of OpenFOAM Doxygen doc: (5/14)
8
Chalmers OpenFOAM course: Guest presentation March 28th 2008
A quick overview of OpenFOAM Doxygen doc: (6/14)
9
Chalmers OpenFOAM course: Guest presentation March 28th 2008
A quick overview of OpenFOAM Doxygen doc: (7/14)
10
Chalmers OpenFOAM course: Guest presentation March 28th 2008
A quick overview of OpenFOAM Doxygen doc: (8/14)
11
Chalmers OpenFOAM course: Guest presentation March 28th 2008
A quick overview of OpenFOAM Doxygen doc: (9/14)
12
Chalmers OpenFOAM course: Guest presentation March 28th 2008
A quick overview of OpenFOAM Doxygen doc: (10/14)
13
Chalmers OpenFOAM course: Guest presentation March 28th 2008
A quick overview of OpenFOAM Doxygen doc: (11/14)
14
Chalmers OpenFOAM course: Guest presentation March 28th 2008
A quick overview of OpenFOAM Doxygen doc: (12/14)
15
Chalmers OpenFOAM course: Guest presentation March 28th 2008
A quick overview of OpenFOAM Doxygen doc: (13/14)
16
Chalmers OpenFOAM course: Guest presentation March 28th 2008
A quick overview of OpenFOAM Doxygen doc: (14/14)
17
Chalmers OpenFOAM course: Guest presentation March 28th 2008
Modifying the generated documentation:
It is possible to customize the Doxygen
documentation:
Changing the default settings chosen by OpenCFD
Adding new information (side panel, etc.)
Adding your own C++ classes
19
Chalmers OpenFOAM course: Guest presentation March 28th 2008
Adapting for the available version of doxygen
20
Chalmers OpenFOAM course: Guest presentation March 28th 2008
Modifying Doxyfile : the hard way
21
Chalmers OpenFOAM course: Guest presentation March 28th 2008
Modifying Doxyfile : using doxywizard
22
Chalmers OpenFOAM course: Guest presentation March 28th 2008
Doxywizard : loading a configuration file
23
Chalmers OpenFOAM course: Guest presentation March 28th 2008
Doxywizard : Wizard mode
24
Chalmers OpenFOAM course: Guest presentation March 28th 2008
Doxywizard : Expert mode (1/9)
25
Chalmers OpenFOAM course: Guest presentation March 28th 2008
Doxywizard : Expert mode (2/9)
26
Chalmers OpenFOAM course: Guest presentation March 28th 2008
Doxywizard : Expert mode (3/9)
27
Chalmers OpenFOAM course: Guest presentation March 28th 2008
Doxywizard : Expert mode (4/9)
28
Chalmers OpenFOAM course: Guest presentation March 28th 2008
Doxywizard : Expert mode (5/9)
29
Chalmers OpenFOAM course: Guest presentation March 28th 2008
Doxywizard : Expert mode (6/9)
30
Chalmers OpenFOAM course: Guest presentation March 28th 2008
Doxywizard : Expert mode (7/9)
31
Chalmers OpenFOAM course: Guest presentation March 28th 2008
Doxywizard : Expert mode (8/9)
32
Chalmers OpenFOAM course: Guest presentation March 28th 2008
Doxywizard : Expert mode (9/9)
33
Chalmers OpenFOAM course: Guest presentation March 28th 2008
Doxywizard : Saving your modifications
34
Chalmers OpenFOAM course: Guest presentation March 28th 2008
Doxywizard : Generating the HTML files
35
Chalmers OpenFOAM course: Guest presentation March 28th 2008
Doxywizard : Generating the HTML files (take 2)
• 23 minutes on remote3.
• 241MB of data
36
Chalmers OpenFOAM course: Guest presentation March 28th 2008
Doxygen: Generating from the command line
37
Chalmers OpenFOAM course: Guest presentation March 28th 2008
Doxygen: Browsing the end result (Class Index)
38
Chalmers OpenFOAM course: Guest presentation March 28th 2008
Doxygen: Browsing the end result (Class Reference)
39
Chalmers OpenFOAM course: Guest presentation March 28th 2008
Doxygen: Browsing the end result: one limitation
40
Chalmers OpenFOAM course: Guest presentation March 28th 2008
Using Doxygen for your own development
Create a separate directory for the new documentation
Start from a pre-initialized Doxyfile
Customize the Doxygen configuration:
Change the name of the project
Add the path to your library source code
Keep only the libraries from OpenFOAM that you need
– Check your Make/options file for the list of needed libraries
Customize as you see fit
An example:
Library OpenFoamTurbo from openfoam-extend
http://openfoamwiki.net/index.php/Sig_Turbomachinery_Library_OpenFoamTurbo
41
Chalmers OpenFOAM course: Guest presentation March 28th 2008
Doxygen: Setup for library OpenFoamTurbo
42
Chalmers OpenFOAM course: Guest presentation March 28th 2008
Doxygen: Configuration for OpenFoamTurbo (1/5)
43
Chalmers OpenFOAM course: Guest presentation March 28th 2008
Doxygen: Configuration for OpenFoamTurbo (2/5)
44
Chalmers OpenFOAM course: Guest presentation March 28th 2008
Doxygen: Configuration for OpenFoamTurbo (3/5)
45
Chalmers OpenFOAM course: Guest presentation March 28th 2008
Doxygen: Configuration for OpenFoamTurbo (4/5)
46
Chalmers OpenFOAM course: Guest presentation March 28th 2008
Doxygen: Configuration for OpenFoamTurbo (5/5)
47
Chalmers OpenFOAM course: Guest presentation March 28th 2008
OpenFoamTurbo: Browsing the result (1/3)
48
Chalmers OpenFOAM course: Guest presentation March 28th 2008
OpenFoamTurbo: Browsing the result (2/3)
49
Chalmers OpenFOAM course: Guest presentation March 28th 2008
OpenFoamTurbo: Browsing the result (3/3)
50
Chalmers OpenFOAM course: Guest presentation March 28th 2008
Doxygen: some possible improvements (1/5)
51
Chalmers OpenFOAM course: Guest presentation March 28th 2008
Doxygen: some possible improvements (2/5)
52
Chalmers OpenFOAM course: Guest presentation March 28th 2008
Doxygen: some possible improvements (3/5)
53
Chalmers OpenFOAM course: Guest presentation March 28th 2008
Doxygen: some possible improvements (4/5)
54
Chalmers OpenFOAM course: Guest presentation March 28th 2008
Doxygen: some possible improvements (5/5)
• mixed blessing...
55
Chalmers OpenFOAM course: Guest presentation March 28th 2008
Doxygen: some useful pointers
56
Chalmers OpenFOAM course: Guest presentation March 28th 2008
OpenFOAM overall directory structure
$WM_PROJECT_DIR $WM_PROJECT_USER_DIR
applications/ applications/
bin/ lib/
doc/ run/
lib/
src/
tutorials/
wmake/
57
Chalmers OpenFOAM course: Guest presentation March 28th 2008
OpenFOAM useful shell aliases
OpenFOAM provides useful predefined shell aliases:
alias foam='cd $WM_PROJECT_DIR'
alias run='cd $FOAM_RUN'
alias tut='cd $FOAM_TUTORIALS'
alias app='cd $FOAM_APP'
alias src='cd $FOAM_SRC'
etc., etc.
59
Chalmers OpenFOAM course: Guest presentation March 28th 2008
Navigating efficiently : pushd/popd examples
Commands: Current Directory: Directory stack:
$> foam $WM_PROJECT_DIR $WM_PROJECT_DIR
$> dirs
60
Chalmers OpenFOAM course: Guest presentation March 28th 2008
Navigating efficiently : pushd and aliases??
A little quiz...
How do you combine aliases like 'src' or 'app' with pushd/popd?
61
Chalmers OpenFOAM course: Guest presentation March 28th 2008
Navigating efficiently : pushd and aliases??
A little quiz...
How do you combine aliases like 'src' or 'app' with pushd/popd?
62
Chalmers OpenFOAM course: Guest presentation March 28th 2008
Finding files:
find:
find $FOAM_SRC -iname \*fixedValue\*.[CH]
locate:
useful command to search through predefined file systems on a
Unix workstation.
– pre-digested, file system wide, “find” results stored in a database
– very quick search time
• example: locate -i doxygen
– man locate for more details
63
Chalmers OpenFOAM course: Guest presentation March 28th 2008
Finding files, one library at time:
lnInclude directory:
Available for every OpenFOAM library
64
Chalmers OpenFOAM course: Guest presentation March 28th 2008
Searching inside files:
66
Chalmers OpenFOAM course: Guest presentation March 28th 2008
Browsing revisions from a Subversion repository (1/5)
67
Chalmers OpenFOAM course: Guest presentation March 28th 2008
Browsing revisions from a Subversion repository (2/5)
68
Chalmers OpenFOAM course: Guest presentation March 28th 2008
Browsing revisions from a Subversion repository (3/5)
69
Chalmers OpenFOAM course: Guest presentation March 28th 2008
Browsing revisions from a Subversion repository (4/5)
70
Chalmers OpenFOAM course: Guest presentation March 28th 2008
Browsing revisions from a Subversion repository (5/5)
71
Chalmers OpenFOAM course: Guest presentation March 28th 2008
How to get help
OpenFOAM Forum
http://openfoam.cfd-online.com/cgi-bin/forum/discus.cgi
Try searching the Forum first!
– Your answer might already be there
OpenFOAM Wiki
http://openfoamwiki.net/index.php/Main_Page
How-To do things:
– http://openfoamwiki.net/index.php/Main_HowTos
72
Chalmers OpenFOAM course: Guest presentation March 28th 2008