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