OpenFOAM Formation 102
OpenFOAM Formation 102
OpenFOAM Formation 102
discussions, stats, and author profiles for this publication at: https://www.researchgate.net/publication/282272911
CITATIONS
READS
8,163
1 author:
Victor Pozzobon
Ecole Centrale Paris
7 PUBLICATIONS 9 CITATIONS
SEE PROFILE
Some of the authors of this publication are also working on these related projects:
OpenFOAM tutorial
OpenFOAM tutorial
Discover it, tame it, use it
by Victor Pozzobon
(victor.pozzobon@mines-albi.fr)
14th March 2016
Version 1.02
Disclaimer
This offering is not approved or endorsed by
OpenCFD Limited, the producer of the
OpenFOAM software and owner of the
OPENFOAM and OpenCFD trade marks.
Pozzobon Victor
Introduction
Pozzobon Victor
OpenFOAM
Pozzobon Victor
Pozzobon Victor
Battle plan
Ex. 1: Cavity
- getting started
Ex. 5: 2D pipe
- axisymmetric problem
- 2D problem
Ex. 3: 1D beam
- 1D problem
- transient
Pozzobon Victor
Pozzobon Victor
Pozzobon Victor
Pozzobon Victor
Pozzobon Victor
10
Pozzobon Victor
11
Pozzobon Victor
12
Observation tools
Time
step
tool
Legend
Scene
Pozzobon Victor
13
Pozzobon Victor
14
Battle plan
Pozzobon Victor
15
Creating a mesh
Pozzobon Victor
16
dU
p
2
+ U . U = + U
dt
2 cm
20 cm
Pozzobon Victor
17
Pozzobon Victor
18
z
2
Wall
4
Inlet
Outlet
y
Symmetry
plane
0
Pozzobon Victor
19
Beware, the
points are to be
prescribed in
order not to
back cross a line
Do (0 4 7 3)
4
Scaling
factor
Block division
along axis
Points
locations
Division grading
Points needed to
Pozzobon Victor
build a block
20
Face
name
Avoid (0 3 4 7)
4
7
Face
type
Point sequence
delimiting the
face
Wall
Inlet
Outlet
Pozzobon Victor
21
Pozzobon Victor
22
Pozzobon Victor
23
Pozzobon Victor
24
Pozzobon Victor
25
Pozzobon Victor
26
Open transportProperties
file, this is where physical
properties value (e.g.
viscosity) are specified:
gedit constant/transportProperties
Property name
Property dimension
[ kg m s K mol A Cd]
Property value
Subdictionaries for some viscosity laws,
can be removed in our case
14th March 2016
Pozzobon Victor
27
Pozzobon Victor
28
Pozzobon Victor
29
Pozzobon Victor
30
Pozzobon Victor
31
Setting a 1D case
Pozzobon Victor
32
Symmetry
planes
Cold side
Hot side
20 cm
Pozzobon Victor
33
Pozzobon Victor
34
Modify file:
gedit system/blockMeshDict
Build mesh:
blockMesh
Pozzobon Victor
35
Ex. 3: 1D beam IC / BC
Pozzobon Victor
36
Pozzobon Victor
37
Pozzobon Victor
38
Pozzobon Victor
39
Setting a 2D case
Pozzobon Victor
40
dU
p
2
+ U . U = + U
dt
3m
2m
2m
14th March 2016
Pozzobon Victor
41
Pozzobon Victor
42
Inlet
Block 1
Outlet
Symmetry
wall
Down
Plate
Block 2
Pozzobon Victor
43
Pozzobon Victor
44
Build mesh:
blockMesh
Pozzobon Victor
45
Pozzobon Victor
46
Pozzobon Victor
47
Pozzobon Victor
48
Solver
Solved type and
options
field
14th March 2016
Pozzobon Victor
49
Pozzobon Victor
50
Pozzobon Victor
51
Pozzobon Victor
52
Pozzobon Victor
53
Pozzobon Victor
54
dU
p
2
+ U . U = + U
dt
10 cm
1 cm
Pozzobon Victor
55
Pozzobon Victor
56
Outlet
Inlet
Front and
Back
Wall
Pozzobon Victor
57
Draw a wegde,
with a 5 angle
(twice 2.5)
Points 1, 2 and 3 are
not used to build the
geometry. OpenFOAM
uses them to define
x, y and z directions :
- point 0 to point 1 = x
- point 1 to point 2 = y
- point 0 to point 4 = z
Pozzobon Victor
cos(2.5)
sin(2.5)
58
In order to do things
by the book, create
two 'wedge' patches
(here, 'front' and
'back')
It would have worked
with only one, but
checkMesh would have
returned an error
Pozzobon Victor
59
Ex. 5: 2D pipe IC / BC p
Pozzobon Victor
60
Ex. 5: 2D pipe IC / BC U
Pozzobon Victor
61
Pozzobon Victor
62
Pozzobon Victor
63
Battle plan
Pozzobon Victor
64
Pozzobon Victor
65
=
U
p
2 p=0
Symmetry
planes
Inlet
Outlet
100 cm
14th March 2016
Pozzobon Victor
66
Pozzobon Victor
67
Pozzobon Victor
68
Pozzobon Victor
69
Modify createFields.H to
create the new fields:
gedit createFields.H
Pressure field
(scalar field)
Velocity field
(vector field)
14th March 2016
Pozzobon Victor
70
Modify createFields.H to
read the physical
properties:
gedit createFields.H
Physical property
called 'Mu'
14th March 2016
Pozzobon Victor
71
Modify tubeFoam.C
to specify the
equations that will
be solved:
gedit tubeFoam.C
Time loop
Correction loop
(not mandatory)
Solved equations
(implicit '=0')
Pozzobon Victor
72
Error file
and line number
3. Take care of it
Pozzobon Victor
73
Pozzobon Victor
74
Pozzobon Victor
75
Pozzobon Victor
76
Velocity field
(vector field)
Pozzobon Victor
77
Pozzobon Victor
78
Pozzobon Victor
79
Pozzobon Victor
80
Pozzobon Victor
81
Pozzobon Victor
82
Evolving a case
Pozzobon Victor
83
dA
2
=v AB
+ .( U A)= D A
dt
dB
2
=0
+ .( U B)=D B
.U
dt
dC
2
+ .( U C)=D C + Symmetry
dt
planes
Inlet
p=0
=
U
p
Outlet
100 cm
14th March 2016
Pozzobon Victor
84
Pozzobon Victor
85
Pozzobon Victor
86
Pozzobon Victor
Defined in
the source
code
87
Modify createFields.H to
read the physical
properties:
gedit createFields.H
Pozzobon Victor
88
Modify
tubeChemFoam.C
to add species fields:
gedit tubeChemFoam.C
Interpolates the
velocity field on the
mesh in order to
later calculate the
divergence operator
14th March 2016
Pozzobon Victor
89
Pozzobon Victor
90
Pozzobon Victor
91
A field
Pozzobon Victor
92
C field
Pozzobon Victor
93
Pozzobon Victor
94
Add solvers:
gedit system/fvSolution
Due to the use of the
divergence, we need to
use asymmetric solvers
for the species fields
Pozzobon Victor
95
Add solvers:
gedit system/controlDict
Run the case:
tubeChemFoam
Process it:
paraFoam
Pozzobon Victor
96
Pozzobon Victor
97
Evolve a case
Pozzobon Victor
98
1 cm
dU
p
2
+ U . U = + U
dt
14th March 2016
Pozzobon Victor
99
T surrounding = 80 C
k T . n =h(T T sur )
14th March 2016
Pozzobon Victor
100
Pozzobon Victor
101
Pozzobon Victor
102
Pozzobon Victor
103
Carry on ...
Loading turbulence
model (we do not
use it in this case)
Add temperature
field
14th March 2016
Pozzobon Victor
104
Carry on ...
Loading
transportProperties
dictionary
Pozzobon Victor
105
Pozzobon Victor
106
Pozzobon Victor
107
Pozzobon Victor
108
Pozzobon Victor
109
options
Pozzobon Victor
110
Modify convectiveHeatFluxFvPatchScalarField.H:
gedit convectiveHeatFluxFvPatchScalarField.H
Replace all totalTemperature occurences by
convectiveHeatFlux (consider using ctrl + H)
Pozzobon Victor
111
Pozzobon Victor
112
Pozzobon Victor
113
Modify convectiveHeatFluxFvPatchScalarField.C:
gedit convectiveHeatFluxFvPatchScalarField.C
Replace all totalTemperature occurences by
convectiveHeatFlux (consider using ctrl + H)
Change scalar affection to a gradient
affectation
Set thermal gradient equation
Pozzobon Victor
114
Pozzobon Victor
115
Pozzobon Victor
116
Pozzobon Victor
117
Pozzobon Victor
118
Pozzobon Victor
119
Pozzobon Victor
120
Pozzobon Victor
121
Pozzobon Victor
122
Pozzobon Victor
123
Pozzobon Victor
124
Pozzobon Victor
125
Pozzobon Victor
126
Pozzobon Victor
127
1 dC dLC
Q= (
) H
2 dt
dt
T surrounding = 180 C
k T . n =h(T T sur )
Chocolate
14th March 2016
Pozzobon Victor
128
Pozzobon Victor
129
Rename tubeFoam:
mv tubeFoam.C cakeFoam.C
Change compilation file:
gedit Make/files
Pozzobon Victor
130
Pozzobon Victor
131
Pozzobon Victor
132
Rename tubeFoam:
gedit cakeFoam.C
Pozzobon Victor
133
Pozzobon Victor
134
Pozzobon Victor
135
Left
Down
Pozzobon Victor
Right
SymmetryWall
136
Pozzobon Victor
137
Pozzobon Victor
138
Pozzobon Victor
139
Pozzobon Victor
140
Pozzobon Victor
141
Pozzobon Victor
142
Pozzobon Victor
143
Pozzobon Victor
144
Pozzobon Victor
145
Pozzobon Victor
146
Pozzobon Victor
147
Pozzobon Victor
148
Pozzobon Victor
149
Chocolate chips
location
Pozzobon Victor
150
Exporting an animation
Pozzobon Victor
151
Water inlet
Tank walls
Pozzobon Victor
152
Pozzobon Victor
153
Pozzobon Victor
154
inlet
fixedWalls
Pozzobon Victor
155
Modify velocity
boundary conditions
according to the case
setup:
gedit 0/U
Negative because of
axis orientation
14th March 2016
Pozzobon Victor
156
Pozzobon Victor
157
Pozzobon Victor
158
Pozzobon Victor
159
Negative because of
axis orientation
14th March 2016
Pozzobon Victor
160
Pozzobon Victor
161
Number of processors
that are going to be
used
Pozzobon Victor
162
Pozzobon Victor
163
Maximum Courant
number
Maximum time step
(in second)
Pozzobon Victor
164
Number of processors
you want to use (has to
be in agreement with
decomposeParDict)
Pozzobon Victor
165
Pozzobon Victor
166
Pozzobon Victor
167
Adjust Camera
button
Pozzobon Victor
168
Pozzobon Victor
169
Pozzobon Victor
170
It's over
Pozzobon Victor
171
Pozzobon Victor
172
It's over
Pozzobon Victor
173