0% found this document useful (0 votes)
6 views

7 applicationSourceCode

Uploaded by

xjj3150100867
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

7 applicationSourceCode

Uploaded by

xjj3150100867
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

CFD with OpenSource Software, 2019

A first look at the source code of applications

Håkan Nilsson, Chalmers / Mechanics and Maritime Sciences / Fluid Dynamics 1


CFD with OpenSource Software, 2019

Finding the source code of the applications in OpenFOAM


• The source code for the applications is arranged in a structure that is useful for
finding the application you need.

• Use the pre-defined alias app to go to the applications directory: $FOAM_APP

• You will find: Allwmake solvers test utilities


(No test in foam-extend, but instead a bin)
(In 1706+, bin is instead here: $WM_PROJECT_DIR/platforms/$WM_OPTIONS)

• Allwmake is used to compile all the applications.

• solvers contains the source code of the solvers.

• utilities contains the source code of the utilities.

• test contains source code for testing specific features of OpenFOAM.

Håkan Nilsson, Chalmers / Mechanics and Maritime Sciences / Fluid Dynamics 2


CFD with OpenSource Software, 2019

Solvers in OpenFOAM
• In $FOAM_SOLVERS (use alias sol to go there) you find the source code for the
solvers arranged according to (version-dependent):

basic discreteMethods financial lagrangian


combustion DNS heatTransfer multiphase
compressible electromagnetics incompressible stressAnalysis

• In sub directory incompressible you find the solver source code directories:

adjointShapeOptimizationFoam nonNewtonianIcoFoam shallowWaterFoam


boundaryFoam pimpleFoam simpleFoam
icoFoam pisoFoam

• Inside each solver directory you find a *.C file with the same name as the direc-
tory. This is the main file, where you will find the top-level source code and a
short description of the solver. For icoFoam:

Transient solver for incompressible, laminar flow of


Newtonian fluids.

For a more complete description, you have the source code right there.

Håkan Nilsson, Chalmers / Mechanics and Maritime Sciences / Fluid Dynamics 3


CFD with OpenSource Software, 2019

Utilities in OpenFOAM
• In $FOAM_UTILITIES (use alias util to go there) you find the source code for the utili-
ties arranged according to (version-dependent):

doc miscellaneous postProcessing surface


mesh parallelProcessing preProcessing thermophysical

• In sub directory postProcessing you find:

dataConversion lagrangian miscellaneous postProcess


graphics lumped noice

• Inside each utility directory you find a *.C file with the same name as the directory. This
is the main file, where you will find the top-level source code and a short description of
the utility. For noise:

Utility to perform noise analysis of pressure data.

• The number of utilities have been greatly reduced in recent versions, since they are
being moved into functionObjects.

Håkan Nilsson, Chalmers / Mechanics and Maritime Sciences / Fluid Dynamics 4


CFD with OpenSource Software, 2019

A quick look at the icoFoam solver directory


• The icoFoam solver source code is located in $FOAM_SOLVERS/incompressible/icoFoam
where you can find two files, createFields.H and icoFoam.C, and a Make directory.

• The Make directory contains two files, files and options, that specifies how icoFoam
should be compiled.

• We will have a look at the code later.

Håkan Nilsson, Chalmers / Mechanics and Maritime Sciences / Fluid Dynamics 5

You might also like