# Introduction to OpenFOAM Programming, A Walk Through reactingFOAM

Jump to: navigation, search

## 1 Chapter 1: Why reactingFOAM ?

reactingFOAM is (one of the simpler ) reacting flow solvers of OpenFOAM. Understanding how this particular code works in a line by line manner, gives an idea not just of this particular solver but also the general programming techniques employed in OpenFOAM. Besides, this also gives an understanding of both the flow calculations as well as the reaction calculations in OpenFOAM.

## 2 Chapter 2: What the initial header files do?

The beginning part of reactingFoam, (of course after the GNU license comments) reads

```
#include "fvCFD.H"
#include "hCombustionThermo.H"
#include "compressible/turbulenceModel/turbulenceModel.H"
#include "chemistryModel.H"
#include "chemistrySolver.H"
#include "multivariateScheme.H"```

We shall now see what each of the header files do, one by one

#### 2.1 Section 1: `"fvCFD.H"`

This file brings in the most fundamental tools for performing any finite volume calculation. This file in fact just includes a bunch of other files, each of which represents a building block of the edifice of the finite volume technique. This file reads

```
#include "parRun.H"

#include "Time.H"
#include "fvMesh.H"
#include "fvc.H"
#include "fvMatrices.H"
#include "fvm.H"
#include "linear.H"
#include "calculatedFvPatchFields.H"
#include "fixedValueFvPatchFields.H"
#include "adjustPhi.H"
#include "findRefCell.H"
#include "mathematicalConstants.H"

#include "OSspecific.H"
#include "argList.H"

#ifndef namespaceFoam
#define namespaceFoam
using namespace Foam;
#endif```

A small listing of each of the above header files is as follows.

parRun.H
Provides routines for initializing the parallel run and for finalizing it. Its instance is declared in the file arglist.H This controls the information of Time during the simulations
Time.H
This controls the information of Time during the simulations.
fvMesh.H
This contains all the topological and geometric information related to the mesh for finite volume descretization
fvc.H
(finite volume calculus) This contains other include files which provide the following routines for performing operations like interpolation, integration and finding derivatives of scalars vectors and tensors. With fvc all operations are explicit where as with fvm all operations are implicit.
fvMatrices.H
linear.H
calculatedFvPatchFields.H
Provides Neumann type boundary conditions.
fixedValueFvPatchFields.H
Provides Dirichlet type boundary condition.
adjustPhi.H
findRefCell_H
Sets the cell for the reference pressure.
mathematicalConstants.H
Provides mathematical constants e.g. $\Pi,\, e$
OSspecific.H
Provides functionality like file writing, deleting etc.
argList.H

--Jens 20:55, 11 Dec 2007 (CET)