Difference between revisions of "OpenFOAM guide/Introduction to OpenFOAM Programming, A Walk Through reactingFOAM"

From OpenFOAMWiki
m (Chapter 1: Why reactingFOAM ?: Eliminate excess whitespace)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
== Chapter 1: Why reactingFOAM ? ==  
 
== 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.
+
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.
  
 
== Chapter 2: What the initial header files do? ==
 
== Chapter 2: What the initial header files do? ==
Line 26: Line 26:
 
#include "fvm.H"
 
#include "fvm.H"
 
#include "linear.H"
 
#include "linear.H"
 +
#include "uniformDimensionedFields.H"
 
#include "calculatedFvPatchFields.H"
 
#include "calculatedFvPatchFields.H"
 
#include "fixedValueFvPatchFields.H"
 
#include "fixedValueFvPatchFields.H"
 
#include "adjustPhi.H"
 
#include "adjustPhi.H"
 
#include "findRefCell.H"
 
#include "findRefCell.H"
#include "mathematicalConstants.H"
+
#include "constants.H"
  
 
#include "OSspecific.H"
 
#include "OSspecific.H"
 
#include "argList.H"
 
#include "argList.H"
 +
#include "timeSelector.H"
  
 
#ifndef namespaceFoam
 
#ifndef namespaceFoam
Line 47: Line 49:
 
; [[ fvc_H|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.
 
; [[ fvc_H|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|fvMatrices.H]] :
 
; [[ fvMatrices_H|fvMatrices.H]] :
 +
; [[ fvm_H|fvm.H ]] :
 
; [[ linear_H|linear.H ]] :
 
; [[ linear_H|linear.H ]] :
 +
; [[ uniformDimensionedFields_H|uniformDimensionedFields.H ]] :
 
; [[ calculatedFvPatchFields_H|calculatedFvPatchFields.H ]] : Provides Neumann type boundary conditions.
 
; [[ calculatedFvPatchFields_H|calculatedFvPatchFields.H ]] : Provides Neumann type boundary conditions.
 
; [[ fixedValueFvPatchFields_H|fixedValueFvPatchFields.H ]] : Provides Dirichlet type boundary condition.
 
; [[ fixedValueFvPatchFields_H|fixedValueFvPatchFields.H ]] : Provides Dirichlet type boundary condition.
 
; [[ adjustPhi_H|adjustPhi.H ]] :
 
; [[ adjustPhi_H|adjustPhi.H ]] :
 
; [[ findRefCell_H|findRefCell_H ]] : Sets the cell for the reference pressure.
 
; [[ findRefCell_H|findRefCell_H ]] : Sets the cell for the reference pressure.
; [[ mathematicalConstants_H|mathematicalConstants.H ]] : Provides mathematical constants e.g. <math>\Pi,\, e </math>
+
; [[ constants_H|constants.H ]] : Provides mathematical constants e.g. <math>\pi,\, e </math>
 
; [[ OSspecific_H|OSspecific.H ]] : Provides functionality like file writing, deleting etc.
 
; [[ OSspecific_H|OSspecific.H ]] : Provides functionality like file writing, deleting etc.
 
; [[ argList_H|argList.H ]] :
 
; [[ argList_H|argList.H ]] :
 +
; [[ timeSelector|timeSelector.H ]] :
 
--Jens 20:55, 11 Dec 2007 (CET)
 
--Jens 20:55, 11 Dec 2007 (CET)
 
[[Category:OpenFOAM coding guide]]
 
[[Category:OpenFOAM coding guide]]

Latest revision as of 17:03, 1 June 2014

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 "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;
#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 
fvm.H  
linear.H  
uniformDimensionedFields.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.
constants.H  
Provides mathematical constants e.g. \pi,\, e
OSspecific.H  
Provides functionality like file writing, deleting etc.
argList.H  
timeSelector.H  

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