OpenFOAM guide/Introduction to OpenFOAM Programming, A Walk Through reactingFOAM

From OpenFOAMWiki
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:

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 "uniformDimensionedFields.H"
#include "calculatedFvPatchFields.H"
#include "fixedValueFvPatchFields.H"
#include "adjustPhi.H"
#include "findRefCell.H"
#include "constants.H"
#include "OSspecific.H"
#include "argList.H"
#include "timeSelector.H"
#ifndef namespaceFoam
#define namespaceFoam
    using namespace Foam;

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

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
This controls the information of Time during the simulations.
This contains all the topological and geometric information related to the mesh for finite volume descretization
(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.
Provides Neumann type boundary conditions.
Provides Dirichlet type boundary condition.
Sets the cell for the reference pressure.
Provides mathematical constants e.g. \pi,\, e
Provides functionality like file writing, deleting etc.

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