FIX: Forgot to remove wmake stuff from twoPhaseInterfaceProperties
[freefoam.git] / HACKING
bloba988e38edbd384956765e47f81f78d4473a3bc46
1 FreeFOAM hackers informations
2 =============================
3 Michael Wild <themiwi@users.sourceforge.net>
4 :Author Initials: MW
5 v{fullver}, {localdate}
6 http://freefoam.sourceforge.net
8 Copyright
9 ---------
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.
16 Recommended Reading
17 -------------------
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.
23 Git
24 ~~~
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>>.
38 CMake
39 ~~~~~
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>>.
45 Python
46 ~~~~~~
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
51 read any myself.
53 C++
54 ~~~
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
71 the following points:
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
77   required by syntax).
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'
81   operation useless.
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
85   code base.
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
90   code.
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
93   results).
94 * New CMake-Modules and functions must be documented using a header comment.
96 'Tour de Code'
97 --------------
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.
101 autoMesh::
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.
110 chemistryModel::
111   This library contains various chemistry models (e.g. based on density or
112   compressibility, but also an ODE systems solver).
113 coalCombustion::
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
122   models.
123 conversion::
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).
130 dieselSpray::
131   Provides classes relevant to Diesel-spray modelling (breakup, atomization,
132   evaporation, drag, collision, wall interaction etc.).
133 dsmc::
134   This library contains classes for 'Direct Simulation Monte Carlo'.
135 dummyPstream::
136   This is the serial implementation of the 'Pstream' communications library.
137 dynamicFvMesh::
138   Provides classes for dynamic and topology-changing finite volume meshes.
139 dynamicMesh::
140   This library provides mesh manipulation methods (e.g. addition/removal of
141   cell layers, mesh-motion solvers, sliding interfaces etc.)
142 edgeMesh::
143   A simple mesh type consisting of points connected by edges.
144 engine::
145   This is a support-library for internal combustion engine solvers.
146 errorEstimation::
147   Residual error estimation and error-driven mesh refinement classes.
148 fieldFunctionObjects::
149   Runtime-loadable function objects for the extraction statistics/diagnostics
150   from a field.
151 finiteVolume::
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.
155 foamCalcFunctions::
156   Functions for the 'foamCalc' utility application.
157 forces::
158   Runtime-loadable function objects used to extract forces and
159   force-coefficients on selected patches.
160 fvMotionSolvers::
161   Library containing various finite volume mesh motion solvers where the motion
162   velocity is set as a boundary condition.
163 genericPatchFields::
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.
175 IOFunctionObjects::
176   A function object to write registered objects which would otherwise not be
177   written.
178 lagrangian::
179   Basic classes for Lagrangian particle tracking.
180 lagrangianIntermediate::
181   Advance classes for Lagrangian particle tracking.
182 laminarFlameSpeedModels::
183   Laminar flame speed models.
184 LESdeltas::
185   Various LES delta models.
186 LESfilters::
187   Various LES filters.
188 liquidMixture::
189   A class representing a mixture of liquids.
190 liquids::
191   Thermophysical properties of various liquids.
192 meshTools::
193   A collection of classes and functions of mesh-related tasks, such as
194   searching, splitting into regions, creating sets etc.
195 metisDecomp::
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.
201 molecule::
202   Library containing classes for molecular dynamics (MD) simulations.
203 mpiPstream::
204   This is the MPI-parallel implementation of the 'Pstream' communications
205   library.
206 ODE::
207   Library to solve ODE's for each cell.
208 OpenFOAM::
209   Basic infrastructure, such as containers, primitive types, streams, fields
210   and meshes.
211 OSspecific::
212   Functions wrapping operating-system specific functionality.
213 parMetisDecomp::
214   Domain decomposition method using the 'ParMetis' library.
215 pdf::
216   Provides various probability density functions (PDF).
217 postCalc::
218   Generic wrapper to calculate quantities in a post-processing step.
219 potential::
220   Models for various potentials in molecular dynamics simulations.
221 radiation::
222   Various radiation models.
223 randomProcesses::
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.
228 sampling::
229   A data-sampling library (extraction along a line, on a plane, patch etc.).
230 scotchDecomp::
231   Domain decomposition method using the 'SCOTCH' graph library.
232 solidMixture::
233   A class for the thermophysical properties of a solid mixture.
234 solidParticle::
235   A simple solid, spherical particle class with one-way coupling with the
236   continuous phase.
237 solids::
238   Thermophysical properties models for various solid materials.
239 specie::
240   Basic classes for thermphysical properties models.
241 surfMesh::
242   A library with classes for many surface-mesh formats.
243 systemCall::
244   A function object allowing the user to call an external program at run-time.
245 thermophysicalFunctions::
246   A collection of thermophysical functions.
247 topoChangerFvMesh::
248   Classes to support topology-changing finite volume meshes.
249 triSurface::
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)
255 Merging Guide
256 -------------
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
288     binary package.
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.
293 Release Guide
294 -------------
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 'data/asciidoc.conf'
299 * Use the 'data/utilities/foamPackSource' script to create a new, signed tag,
300   create a tar-ball with an external signature and check-sum files.
302 Bibliography
303 ------------
304 [bibliography]
305 * [[[ProGit]]] Scott Chacon. http://progit.org/['Pro Git']. Apress 2009.
306   ISBN http://isbndb.com/search-all.html?kw=1-430-21833-9[1-430-21833-9].
307 * [[[GitCommBook]]] Scott Chacon and many others.
308   http://book.git-scm.com['The Git Community Book'].
309 * [[[VCGit]]] Jon Loeliger. 'Version Control with Git'. O'Reilly 2009.
310   ISBN http://isbndb.com/search-all.html?kw=0-596-52012-3[0-596-52012-3].
311 * [[[MasteringCMake]]] Ken Martin, Bill Hoffman. 'Mastering CMake'.
312   Kitware Inc. 2010.
313   ISBN http://isbndb.com/search-all.html?kw=1-930-93422-X[1-930-93422-X]
314 * [[[EffCXX]]] Scott Meyers. 'Effective C++'. Addison-Wesley 2005.
315   ISBN http://isbndb.com/search-all.html?kw=0-321-33487-6[0-321-33487-6].
316 * [[[ExceptCXX]]] Herb Sutter. 'Exceptional C++'. Addison-Wesley 2000.
317   ISBN http://isbndb.com/search-all.html?kw=0-201-61562-2[0-201-61562-2].
318 * [[[CXXTemplates]]] David Vandevoorde, Nicolai M. Josutis.
319   'C++ Templates - The Complete Guide'. Addison-Wesley 2003.
320   ISBN http://isbndb.com/search-all.html?kw=0-201-73484-2[0-201-73484-2].
321 * [[[CXXMeta]]] David Abrahams
322   David Abrahams, Aleksey Gurtovoy. 'C++ Template Metaprogramming: Concepts,
323   Tools, and Techniques from Boost and Beyond'. Addison-Wesley 2005.
324   ISBN http://isbndb.com/search-all.html?kw=0-321-22725-5[0-321-22725-5]
326 ///////////////////////////////////////////////////////////
327 Process with: asciidoc -a toc -f data/asciidoc.conf HACKING
329 Vim users, this is for you:
330 vim: ft=asciidoc sw=2 expandtab fenc=utf-8
331 ///////////////////////////////////////////////////////////