1 FreeFOAM hackers informations
2 =============================
3 Michael Wild <themiwi@users.sourceforge.net>
5 v{fullver}, {localdate}
6 http://freefoam.sourceforge.net
10 FreeFOAM is free software; you can redistribute it and/or modify it under the
11 terms of the GNU General Public License as published by the Free Software
12 Foundation; either version 2 of the License, or (at your option) any later
13 version. See the file COPYING in this directory, for a description of the GNU
14 General Public License terms under which you can copy the files.
19 Before you participate in the FreeFOAM project and start away hacking, you
20 should make yourself familiar with the tools. The following sections name the
21 most important of them and give you a few references I used to learn them.
25 To work on the FreeFOAM source base, you need to know your 'Git-foo'. Git is
26 the distributed source control system used by the FreeFOAM project, and feeling
27 comfortable using Git is germane to participating in the project. The official
28 documentation (either available through extensive man-pages or from
29 http://www.kernel.org/pub/software/scm/git/docs/) is of course the
30 authoritative source. Especially the manual page
31 http://www.kernel.org/pub/software/scm/git/docs/gitworkflows.html[gitworkflows(7)]
32 is of interest with respect to the work flow used by the FreeFOAM project. If
33 you prefer to learn Git reading a book, there are the freely available online
34 books <<ProGit>> and <<GitCommBook>>. Learners desiring to hold a book in their
35 hands can either print the PDF version of <<GitCommBook>> or buy a hard-copy of
36 <<ProGit>> or <<VCGit>>.
40 The build system used by FreeFOAM is http://www.cmake.org[CMake]. Being able to
41 use it on a user-level is a hard requirement for working on FreeFOAM. Pretty
42 quickly, though, contributors will need more understanding of the topic and
43 should get their hands on a copy of <<MasteringCMake>>.
47 All the 'user-land' scripts and many of the scripts used during the build of
48 FreeFOAM are written in Python. So, you definitely should know how to read it.
49 There is a good tutorial (and of course the ever-so-important reference) at
50 http://www.python.org/doc. There is no book I can recommend, since I haven't
55 FreeFOAM is a large C\++ project which makes use of almost any language feature
56 there is. Thus it is *strongly* recommended you have a good understanding of
57 C\++ in general (e.g. you should be familiar with function overloading and
58 polymorphism) and you absolutely *must* understand function and class
59 templates. So far I did not come across a single book which covers all of these
60 topics satisfactorily. For the more traditional C\++ topics (i.e. non-templated
61 code), <<EffCXX>> and <<ExceptCXX>> are very good resources and should also
62 cover template programming in sufficient detail to work on the FreeFOAM code
63 base. If you want to know the ins and outs of C++ templates, refer to
64 <<CXXTemplates>> and to get an inkling of all the fancy stuff you can do with
65 them, read <<CXXMeta>>.
67 Coding Practices and Style
68 --------------------------
69 Follow the instructions outlined in the file 'doc/codingStyleGuide.pdf'
70 contained in the source distribution. Additionally, pay special attention to
73 * In general, lines shouldn't be longer than 80 characters and they *must* be
74 terminated by a LF. Windows-style line endings (CR+LF) are not acceptable.
75 * Indentation for C++ is 4 spaces, for Python code 3 or 2 spaces and
76 CMake-code uses 2 spaces only. Never use tab characters (except where
78 * Avoid trailing whitespace at all costs. It is considered to be a programming
79 error. However, only remove it from existing code if you change that line
80 anyways. Otherwise the version control log will be very noisy and the 'blame'
82 * Make sure that file and directory names differ not just in their
83 capitalization. Also, for libraries a header name must be unique within the
84 whole library, but preferably all file names are unique throughout the whole
86 * New applications must provide header documentation describing *all* available
87 options and arguments. Also, there must be a brief description (1-2 lines
88 maximum) and an extended, informative description. Somebody reading it should
89 know what to expect from this application without having to read its whole
91 * New applications must provide a tutorial case that can be run as a basic
92 test to ensure that it runs (although, without checking the validity of the
94 * New CMake-Modules and functions must be documented using a header comment.
98 This section describes each of the libraries briefly. This is an ongoing effort
99 and below items are by no means complete. The listing is alphabetical.
102 This library handles adaptive mesh refinement, e.g. layer insertion/deletion.
103 barotropicCompressibilityModel::
104 Provides barotropic compressibility models (a linear model, the one by Wallis
105 and another by Chung).
106 basicThermophysicalModels::
107 Provides classes to store and compute derived thermophysical properties (such
108 as sensible enthalpy, inner energy, temperature, pressure or heat capacity)
109 based on the density or compressibility for pure fluids or mixtures.
111 This library contains various chemistry models (e.g. based on density or
112 compressibility, but also an ODE systems solver).
114 Contains classes relevant to the simulation of coal combustion (specialised
115 particle cloud coal parcel, surface reaction models).
116 compressibleLESModels::
117 Provides a large variety of compressible LES subgrid-scale models.
118 compressibleRASModels::
119 Supplies various compressible RANS turbulence models.
120 compressibleTurbulenceModel::
121 Contains a common interface and infrastructure for compressible turbulence
124 This library comprises several file-format conversion classes (e.g. for
125 Ensight and Star-CD).
126 decompositionMethods::
127 The library contains common infrastructure and interfaces for decomposition
128 domain methods, as well as several actual decomposition methods
129 (geometrical, hierarchical, manual and one using the 'scotch' graph library).
131 Provides classes relevant to Diesel-spray modelling (breakup, atomization,
132 evaporation, drag, collision, wall interaction etc.).
134 This library contains classes for 'Direct Simulation Monte Carlo'.
136 This is the serial implementation of the 'Pstream' communications library.
138 Provides classes for dynamic and topology-changing finite volume meshes.
140 This library provides mesh manipulation methods (e.g. addition/removal of
141 cell layers, mesh-motion solvers, sliding interfaces etc.)
143 A simple mesh type consisting of points connected by edges.
145 This is a support-library for internal combustion engine solvers.
147 Residual error estimation and error-driven mesh refinement classes.
148 fieldFunctionObjects::
149 Runtime-loadable function objects for the extraction statistics/diagnostics
152 This library contains everything related to the finite volume (FV) method,
153 such as mesh classes, discretisation and interpolation schemes, matrices and
154 other basic CFD related tools.
156 Functions for the 'foamCalc' utility application.
158 Runtime-loadable function objects used to extract forces and
159 force-coefficients on selected patches.
161 Library containing various finite volume mesh motion solvers where the motion
162 velocity is set as a boundary condition.
164 Generic finite volume and point patch field types.
165 incompressibleLESModels::
166 Large Eddy Simulation (LES) models for incompressible flow.
167 incompressibleRASModels::
168 Reynolds Averaged Simulation (RAS) models for incompressible flow.
169 incompressibleTransportModels::
170 Transport model classes for incompressible flow.
171 incompressibleTurbulenceModel::
172 Base classes for the incompressible turbulence models.
173 interfaceProperties::
174 Classes describing interface properties and compression for two-phase flows.
176 A function object to write registered objects which would otherwise not be
179 Basic classes for Lagrangian particle tracking.
180 lagrangianIntermediate::
181 Advance classes for Lagrangian particle tracking.
182 laminarFlameSpeedModels::
183 Laminar flame speed models.
185 Various LES delta models.
189 A class representing a mixture of liquids.
191 Thermophysical properties of various liquids.
193 A collection of classes and functions of mesh-related tasks, such as
194 searching, splitting into regions, creating sets etc.
196 Domain decomposition method using the 'METIS' graph library.
197 MGridGenGAMGAgglomeration::
198 Cell-agglomeration for the 'GAMG' solver using the 'MGridGen' library.
199 molecularMeasurements::
200 Statistic extraction library for molecular dynamics simulations.
202 Library containing classes for molecular dynamics (MD) simulations.
204 This is the MPI-parallel implementation of the 'Pstream' communications
207 Library to solve ODE's for each cell.
209 Basic infrastructure, such as containers, primitive types, streams, fields
212 Functions wrapping operating-system specific functionality.
214 Domain decomposition method using the 'ParMetis' library.
216 Provides various probability density functions (PDF).
218 Generic wrapper to calculate quantities in a post-processing step.
220 Models for various potentials in molecular dynamics simulations.
222 Various radiation models.
224 A library to create a turbulent velocity and pressure field according to a
225 wave-number spectrum and which is divergence-free.
226 reactionThermophysicalModels::
227 Reaction- and combustion-thermophysical models.
229 A data-sampling library (extraction along a line, on a plane, patch etc.).
231 Domain decomposition method using the 'SCOTCH' graph library.
233 A class for the thermophysical properties of a solid mixture.
235 A simple solid, spherical particle class with one-way coupling with the
238 Thermophysical properties models for various solid materials.
240 Basic classes for thermphysical properties models.
242 A library with classes for many surface-mesh formats.
244 A function object allowing the user to call an external program at run-time.
245 thermophysicalFunctions::
246 A collection of thermophysical functions.
248 Classes to support topology-changing finite volume meshes.
250 Triangulated surface description and patch information classes.
251 utilityFunctionObjects::
252 Miscellaneous function objects (static pressure computation, calculation of
253 intensive fields in DSMC simulations)
257 These are notes mainly concerning the FreeFOAM maintainers performing the
258 merges with the upstream repository (currently, that is me). Other may find
259 this informative, though, and I realized that I need a checklist...
261 * Create a clone on a case-sensitive file system and check out the upstream
262 tracking branch 'upstream/OpenFOAM-1.7.x' and +git pull+.
263 * Check out the branch with the unified history, 'upstream/OpenFOAM' and merge
264 in the versioned upstream branch.
265 * Get an overview of what has been added and removed using
266 +git show -m --name-status --no-renames --diff-filter=AD+. Of special
267 interest are 'wmake' related files, new or removed sources, new scripts in
268 'bin', added or removed libraries, applications and tutorials.
269 * Check out the branch you want to merge into (usually that is 'pu') and merge
270 with 'upstream/OpenFOAM'. There will be many merge conflicts.
271 * Use the following checklist while merging:
272 - Changes to 'Make/files' usually only map to the corresponding 'files.cmake'
273 file. New source files are added to the 'SRCS' list.
274 - New source and header files ('.C' and '.H') belonging to a library that
275 are not mentioned in the 'Make/files' file must be added to the 'HDRS'
276 list. This usually is not reflected by a conflict!
277 - New link libraries added in 'Make/options' should be ported to the
278 'CMakeLists.txt' file. New include directories should only be ported if
279 they are 'relative includes'.
280 - Check the 'diff' of all modified/added source files for '#include'
281 directives. Find whether the included file belongs to a library and if so,
282 change the '#include "header.H"' to '#include <libname/header.H>'.
283 - Add modelines to added files.
284 - Complete/fix the header comment of new applications.
285 - Usually, changes inside the 'wmake' directory can be discarded.
286 - More often than not, added scripts in 'bin' are useless to the FreeFOAM
287 project. If not, port the script to Python if it is to be distributed in a
289 - Newly added tutorials must be furnished with their own 'CMakeLists.txt'
290 file and a new +add_subdirectory+ call needs to be added. Port new 'Allrun'
291 and 'Allclean' scripts to a 'Allrun.py.in' script.
295 The following lists things to remember when creating a new release.
297 * Update 'ChangeLog' and 'ReleaseNotes'
298 * Update version information in 'CMakeLists.txt' and
299 'data/asciidoc/asciidoc.conf'
300 * Use the 'data/utilities/foamPackSource' script to create a new, signed tag,
301 create a tar-ball with an external signature and check-sum files.
306 * [[[ProGit]]] Scott Chacon. http://progit.org/['Pro Git']. Apress 2009.
307 ISBN http://isbndb.com/search-all.html?kw=1-430-21833-9[1-430-21833-9].
308 * [[[GitCommBook]]] Scott Chacon and many others.
309 http://book.git-scm.com['The Git Community Book'].
310 * [[[VCGit]]] Jon Loeliger. 'Version Control with Git'. O'Reilly 2009.
311 ISBN http://isbndb.com/search-all.html?kw=0-596-52012-3[0-596-52012-3].
312 * [[[MasteringCMake]]] Ken Martin, Bill Hoffman. 'Mastering CMake'.
314 ISBN http://isbndb.com/search-all.html?kw=1-930-93422-X[1-930-93422-X]
315 * [[[EffCXX]]] Scott Meyers. 'Effective C++'. Addison-Wesley 2005.
316 ISBN http://isbndb.com/search-all.html?kw=0-321-33487-6[0-321-33487-6].
317 * [[[ExceptCXX]]] Herb Sutter. 'Exceptional C++'. Addison-Wesley 2000.
318 ISBN http://isbndb.com/search-all.html?kw=0-201-61562-2[0-201-61562-2].
319 * [[[CXXTemplates]]] David Vandevoorde, Nicolai M. Josutis.
320 'C++ Templates - The Complete Guide'. Addison-Wesley 2003.
321 ISBN http://isbndb.com/search-all.html?kw=0-201-73484-2[0-201-73484-2].
322 * [[[CXXMeta]]] David Abrahams
323 David Abrahams, Aleksey Gurtovoy. 'C++ Template Metaprogramming: Concepts,
324 Tools, and Techniques from Boost and Beyond'. Addison-Wesley 2005.
325 ISBN http://isbndb.com/search-all.html?kw=0-321-22725-5[0-321-22725-5]
327 ////////////////////////////////////////////////////////////////////
328 Process with: asciidoc -a toc -f data/asciidoc/asciidoc.conf HACKING
330 Vim users, this is for you:
331 vim: ft=asciidoc sw=2 expandtab fenc=utf-8
332 ////////////////////////////////////////////////////////////////////