Use Of Open Source Programs In Metallurgy
Lecture 02: Developing OpenFOAM® solver
Dr. Alexander Vakhrushev
Alexander Vakhrushev @ ResearchGate
January | 2019
OpenFOAM® resources
[Link]
Tutorials at OpenFOAM Wiki
[Link]
Chalmers University (Sweden)
[Link]
Bernhard F.W. Gschaider (Leoben)
[Link]
Tutorial from Holzmann CFD (Germany)
[Link]
Official OpenFOAM® ESI version
[Link]
The OpenFOAM® Foundation version
[Link]
foam-extend Community Driven Project
Outline
Introduction
Solver structure
Make settings with “files” and “options”
Compiling solver with “wmake”
A look at the “icoFoam” solver
Adding energy equation variables
Adding energy equation
Modifying and running cavity case
Developing your solver: select a prototype
1 2
3
Navigate through the OpenFOAM® source tree
Outline
Introduction
Solver structure
Make settings with “files” and “options”
Compiling solver with “wmake”
A look at the “icoFoam” solver
Adding energy equation variables
Adding energy equation
Modifying and running cavity case
icoFoam solver structure
Solver folder
Build settings
Files & solver name
Directives / libraries
Header(s)
Main file
Outline
Introduction
Solver structure
Make settings with “files” and “options”
Compiling solver with “wmake”
A look at the “icoFoam” solver
Adding energy equation variables
Adding energy equation
Modifying and running cavity case
Modifying “files” input
icoFoam.C
EXE = $(FOAM_APPBIN)/icoFoam
icoFoam.C
EXE = $(FOAM_USER_APPBIN)/myIcoFoam
Content of the “options” file
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lmeshTools
Outline
Introduction
Solver structure
Make settings with “files” and “options”
Compiling solver with “wmake”
A look at the “icoFoam” solver
Adding energy equation variables
Adding energy equation
Modifying and running cavity case
OpenFOAM® build utilities “wclean” / “wmake”
Outline
Introduction
Solver structure
Make settings with “files” and “options”
Compiling solver with “wmake”
A look at the “icoFoam” solver
Adding energy equation variables
Adding energy equation
Modifying and running cavity case
A walk-through the icoFoam
System include files
in $FOAM_SRC
Solver variables
A walk-through the icoFoam
A walk-through the icoFoam
A walk-through the icoFoam
A walk-through the icoFoam
A walk-through the icoFoam
A walk-through the icoFoam
Outline
Introduction
Solver structure
Make settings with “files” and “options”
Compiling solver with “wmake”
A look at the “icoFoam” solver
Adding energy equation variables
Adding energy equation
Modifying and running cavity case
Reading properties in “createFields.H”
Creating fields in “createFields.H”
Creating energy equation fields in “createFields.H”
Outline
Introduction
Solver structure
Make settings with “files” and “options”
Compiling solver with “wmake”
A look at the “icoFoam” solver
Adding energy equation variables
Adding energy equation
Modifying and running cavity case
Add new equation to “icoFoam.C”
𝝏𝑻
𝝆𝒄𝒑 + 𝛁 ∙ 𝒖𝑻 = 𝝀𝛁𝟐 𝑻
𝝏𝒕 𝝏𝑻
+ 𝛁 ∙ 𝒖𝑻 = 𝜶𝛁 𝟐 𝑻
𝝆 = 𝒄𝒐𝒏𝒔𝒕 𝝏𝒕
𝒄𝒑 = 𝒄𝒐𝒏𝒔𝒕
Outline
Introduction
Solver structure
Make settings with “files” and “options”
Compiling solver with “wmake”
A look at the “icoFoam” solver
Adding energy equation variables
Adding energy equation
Modifying and running cavity case
Adding new field to “0/T”
Modifying “constant/transportProperties”
Modifying “system/fvSchemes”
Modifying “system/fvSolution”
Simulation results
Thank you for your attention!