Sei sulla pagina 1di 39

OPENFOAM GUIDE FOR BEGINNERS

6.

Fluid dynamics of a Very


Light Aircraft

6.0.18

Description of the case

The last chapter of the guide describes a completely different case to be solved.
While up to now only two-dimensional fluid mechanics problems have been solved,
the current chapter encompasses the simulation of a real 3D body in a free stream.
More specifically, this body is a very light aircraft flying at sea level conditions.
Unlike previous chapters, the mesh of the current case is going to be created using an
external surface generated with a 3D CAD design software. Nevertheless, the user
can follow the tutorial using a geometry created by himself. As the main steps are
common for generic geometries, it will only be necessary to take into consideration
particular instructions which may depend on the specifications of each case. It
implies that standard bodies in a free stream (a sphere, an automobile, etc.) will
be suitable to be simulated according to the instructions and methods shown in
Chapter 6.

6.0.19

Hypotheses

Incompressible flow
Turbulent flow
Newtonian flow
Negligible gravitatory effects
Sea level conditions
RAS turbulence modelling with wall functions
Non-static components of the aircraft are not included (as for instance the
propeller), as well as the landing gear
Jordi Casacuberta Puig

145

6. Fluid dynamics of a Very Light Aircraft

Aircraft flying at = 0

6.0.20

Physics of the problem

The problem encompasses a very light aircraft flying at a speed of V = 45 m/s at


sea level. As the medium is air ( = 1.5 105 m2 /s), the Reynolds number is
Re =

45 1.276
Vc
=
= 38.28 105

1.5 105

where c is the mean aerodynamic chord of the wings and is equal to 1.276 m. The
mean aerodynamic chord is the chord of a rectangular wing which has the same area,
aerodynamic force and position of the pressure center for a given angle of attack as
the original. The very light aircraft that it is going to be used for the simulation
does not belong to any real aeronautics company; it was designed by the author of
the guide during a course taught at the university (and thus it might contain flaws).
The aircraft is shown at Figure 6.1.

Figure 6.1: Aircraft used in the simulation of the Very Light Aircraft case

The aircraft measures and geometrical properties are:


Jordi Casacuberta Puig

146

OPENFOAM GUIDE FOR BEGINNERS

Figure 6.2: Measures of the aircraft used in the simulation of the Very Light Aircraft
case

The problem statement is shown at Figure 6.3.

Figure 6.3: Very light aircraft flying at 45 m/s and ambient pressure

In the current chapter there is no easy analytical solution to describe the behaviour
of the fluid. However, it is necessary to keep in mind the main equations involved
in the problem:

Jordi Casacuberta Puig

147

6. Fluid dynamics of a Very Light Aircraft

The continuity equation,


U=0

(6.1)

U
+ U U = p + 2 U
t

(6.2)

The momentum equation,

As it can be seen at Figure 6.2, the aircraft presents a length of 8.3 m. Unlike
previous cases, it cannot be directly meshed and treated because of its large size
(it would be necessary to create an enormous number of cells). This is the reason
why the geometry will be rescaled 100 times. It can be understood as if the analysis
would be done to a prototype introduced into a wind tunnel.
Consequently, it is necessary to do a dimensional analysis to find out the dimensionless numbers involved in the problem. It ensures that the flow conditions are
consistent to guarantee that the results of the 100 times rescaled aircraft are the
same as if the real aircraft would be flying in the sky.
The dimensionless variables of Equations 6.1 and 6.2 are:
x
c
=U
U
V
p
p =
V 2
=
x

t =

t
c/V

By introducing them, the dimensionless equations of mass and momentum are:


=0
U

(6.3)

U

=

U
p+
2U
+U
cV
t
which can be rewritten as:

U

=

U
p+ 1
2U
+U

Re
t

(6.4)

It can be seen that the only dimensionless number involved in the problem is the

Jordi Casacuberta Puig

148

OPENFOAM GUIDE FOR BEGINNERS

Reynolds number. Therefore, maintaining Re (comparing the real aircraft flying


in the sky with the prototype analysed in the wind tunnel), the behaviour of the
flow around them may be comparable and the case preserves its coherence. As
a consequence, if the mean aerodynamic chord has been reduced 100 times, the
kinematic viscosity will be also reduced this quantity:
Re =

6.0.21

45 0.01276
Vc
=
= 38.28 105

1.5 107

Pre-processing

The following codes contain the information to simulate the case with Re = 38.28
105 using simpleFoam and the SST k-w turbulence model. The main differences
with previous cases come from the fact that the constant and system directories will
include new features. Therein it will be contained the dictionaries and files required
to treat and mesh the geometry.
It is highly recommendable to follow the current tutorial bearing in mind the structure of directories that the case is going to contain (shown at the end of Section
6.0.21.6), as the case setting changes significantly. The scheme of directories is simR
ilar as the one used in the official OpenF OAM
motorBike case (located within
incompressible/simpleFoam). It may help the user to figure up the case resolution,
before and whilst running it.
The case directory is named aircraft and will be located within FoamCases.
6.0.21.1

Mesh generation

Handling surface meshes


First of all, create empty constant and system directories within aircraft. In constant,
there will be two new directories, polyMesh and triSurface, this second containing
the case geometry saved with the .stl extension. In the current tutorial, the file with
the geometry is going to be named aircraft.stl.
STL (STereoLithography) is a file format native to the stereolithography CAD software created by 3D Systems. This file format is supported by many other software
packages; it is widely used for rapid prototyping and computer-aided manufacturing.
STL files describe only the surface geometry of a three-dimensional object without
any representation of color, texture or other common CAD model attributes.
Next, as it was done in Chapter 5, a dummy controlDict file is needed to be included.
Jordi Casacuberta Puig

149

6. Fluid dynamics of a Very Light Aircraft

Caution:
For coherence with further explanations, set deltaT and writeInterval
within controlDict equal to 1
Now the user has to include a new file: surfaceFeatureExtractDict. It is contained
within system and is used to extract feature edges from tri-surfaces. The file includes:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

/ C++ \
| =========
|
|
| \\
/ F ield
| OpenFOAM: The Open S o u r c e CFD Toolbox
|
|
\\
/
O peration
| Version :
2.2.0
|
|
\\ /
A nd
| Web :
www.OpenFOAM. o r g
|
|
\\/
M anipulation
|
|
\/
FoamFile
{
version
2.0;
format
ascii ;
class
dictionary ;
object
surfaceFeatureExtractDict ;
}
// //

16
17
18
19
20

aircraft . stl
{
// How t o o b t a i n raw f e a t u r e s ( e x t r a c t F r o m F i l e | | e x t r a c t F r o m S u r f a c e )
extractionMethod
extractFromSurface ;

21
22
23
24
25
26
27
28
29

extractFromSurfaceCoeffs
{
// Mark e d g e s whose a d j a c e n t s u r f a c e n or ma ls a r e a t an a n g l e l e s s
// than i n c l u d e d A n g l e a s f e a t u r e s
// 0 : s e l e c t s no e d g e s
// 1 8 0 : s e l e c t s a l l e d g e s
includedAngle
120;
}

30
31

// Write o p t i o n s

32

// Write f e a t u r e s t o o b j f o r m a t f o r p o s t p r o c e s s i n g
writeObj
yes ;

33
34
35
36

}
// //

Advice:
At line 17 the name has to match the one used for the file located within
constant/triSurface
Next, the user has to execute the dictionary to extract the features. Type within
the case:
Jordi Casacuberta Puig

150

OPENFOAM GUIDE FOR BEGINNERS

surfaceFeatureExtract
Note that a new directory and a new file have been generated within constant and
constant/triSurface respectively.
At this moment the user can launch ParaView to view the aircraft shape, opening
the .stl file contained in constant/triSurface.

Figure 6.4: Aircraft STL surface used in the simulation of the Very Light Aircraft
case

Generating a background mesh


Before meshing the aircraft itself, it is first necessary to create a background mesh.
It can be simply done using blockMesh and blockMeshDict. The aim is to create a
big rectangular prism encompassing the whole aircraft. This prism will become the
fluid domain of the case. The inside of the aircraft will be removed using further
instructions transforming the aircraft into a real obstacle for the flow.
Caution:
As it is necessary to analyze the flow downstream more than the flow
upstream, the distance from the inlet patch of the prism to the aircrafts
cabin will be shorter than the distance between the outlet patch and the
aircrafts tail

Jordi Casacuberta Puig

151

6. Fluid dynamics of a Very Light Aircraft

Advice:
Try to generate the cells of the background mesh with an aspect ratio
as close to 1 as possible
So, to create an adequate mesh for the aircraft, copy the following blockMeshDict
code within constant/polyMesh and type:
blockMesh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

/ C++ \
| =========
|
|
| \\
/ F ield
| OpenFOAM: The Open S o u r c e CFD Toolbox
|
|
\\
/
O peration
| Version :
2.2.0
|
|
\\ /
A nd
| Web :
www.OpenFOAM. o r g
|
|
\\/
M anipulation
|
|
\/
FoamFile
{
version
2.0;
format
ascii ;
class
dictionary ;
object
bl ock Me sh Dic t ;
}
// //

16
17

convertToMeters 0 . 0 1 ;

18
19
20
21
22
23
24
25
26
27
28

vertices
(
(30
( 10
( 10
(30
(30
( 10
( 10
(30

8
8
8
8
8
8
8
8

10)
10)
10)
10)
10)
10)
10)
10)

29
30

);

31
32
33
34
35

blocks
(
hex ( 0 1 2 3 4 5 6 7 ) ( 3 2 13 1 6 ) s i m p l e G r a d i n g ( 1 1 1 )
);

36
37
38
39

edges
(
);

40
41
42
43
44

boundary
(
inlet
{

Jordi Casacuberta Puig

152

OPENFOAM GUIDE FOR BEGINNERS

t y p e patch ;
faces
(
(1 2 6 5)
);
}

45
46
47
48
49
50
51

outlet
{
t y p e patch ;
faces
(
(0 4 7 3)
);
}

52
53
54
55
56
57
58
59
60

bottom
{
type s l i p ;
faces
(
(0 3 2 1)
);
}

61
62
63
64
65
66
67
68
69

top
{

70
71

type s l i p ;

72

faces
(

73
74

(4 5 6 7)

75

);

76

77
78

frontAndBack
{
type s l i p ;
faces
(
(0 1 5 4)
(2 3 7 6)
);
}

79
80
81
82
83
84
85
86
87
88
89

);

90
91
92
93

mergePatchPairs
(
);

94
95

// //

Figure 6.5 shows the result of combining the mesh generated with the initial STL
surface:

Jordi Casacuberta Puig

153

6. Fluid dynamics of a Very Light Aircraft

Figure 6.5: Aircraft STL surface contained within the mesh generated with
blockMesh in the Very Light Aircraft case

Advice:
To obtain the results shown in Figure 6.5 it is necessary to include dummy
files of fvScheme and fvSolution
Using snappyHexMesh
To mesh, the snappyHexMesh application is going to be used, being controlled by
the snappyHexMeshDict file located in system. The main parts of the dictionary are:
3 switches to control the individual meshing processes
A geometry subdictionary for the surface geometry used in the meshing
3 subdictionaries, one for each meshing process
A subdictionary for the control of the quality criteria
The snappyHexMeshDict file that it is going to be used for the meshing of the aircraft
is:
1
2
3

/ C++ \
| =========
|
|
| \\
/ F ield
| OpenFOAM: The Open S o u r c e CFD Toolbox
|

Jordi Casacuberta Puig

154

OPENFOAM GUIDE FOR BEGINNERS

4
5
6
7
8
9
10
11
12
13
14
15

|
\\
/
O peration
| Version :
2.2.0
|
|
\\ /
A nd
| Web :
www.OpenFOAM. o r g
|
|
\\/
M anipulation
|
|
\/
FoamFile
{
version
2.0;
format
ascii ;
class
dictionary ;
object
snappyHexMeshDict ;
}
// //

16
17
18
19
20

// Which o f t h e
castellatedMesh
snap
addLayers

s t e p s t o run
true ;
false ;
false ;

21
22
23
24
25
26
27
28
29
30
31
32

// Geometry . D e f i n i t i o n o f a l l s u r f a c e s . A l l s u r f a c e s a r e o f c l a s s
// s e a r c h a b l e S u r f a c e .
// S u r f a c e s a r e used
// t o s p e c i f y r e f i n e m e n t f o r any mesh c e l l i n t e r s e c t i n g i t
// t o s p e c i f y r e f i n e m e n t f o r any mesh c e l l i n s i d e / o u t s i d e / n e a r
// t o snap t h e mesh boundary t o t h e s u r f a c e
geometry
{
a i r c r a f t . s t l //STL f i l e n a m e where a l l t h e r e g i o n s a r e added
{
type triSurfaceMesh ;

33

regions

34

35

pa tc h0
//Named r e g i o n i n t h e STL f i l e
{
name a i r c r a f t P a t c h ;
// Userd e f i n e d patch name . I f not p r o v i d e d w i l l be
<name> <r e g i o n >
}

36
37
38

39

40

41
42

r e f i n e m e n t B o x // Geometry t o r e f i n e . E n t i t i e s : Box , C y l i n d e r , Sphere , Plane


{
type searchableBox ;
min ( 0.3 0.06 0.04) ;
max ( 0 0 . 0 6 0 . 0 4 ) ;
}

43
44
45
46
47
48
49

};

50
51
52
53

// S e t t i n g s f o r t h e c a s t e l l a t e d M e s h g e n e r a t i o n .
castellatedMeshControls
{

54
55
56

// Refinement p a r a m e t e r s
//

57
58
59

// I f l o c a l number o f c e l l s i s >= m a x L o c a l C e l l s on any p r o c e s s o r


// s w i t c h e s from from r e f i n e m e n t f o l l o w e d by b a l a n c i n g

Jordi Casacuberta Puig

155

6. Fluid dynamics of a Very Light Aircraft

60
61

// ( c u r r e n t method ) t o ( w e i g h t e d ) b a l a n c i n g b e f o r e r e f i n e m e n t .
maxLocalCells 1500000;

62
63
64
65
66
67
68

// O v e r a l l c e l l l i m i t ( a p p r o x i m a t e l y ) . Refinement w i l l s t o p i m m e d i a t e l y
// upon r e a c h i n g t h i s number s o a r e f i n e m e n t l e v e l might not c o m p l e t e .
// Note t h a t t h i s i s t h e number o f c e l l s b e f o r e removing t h e p a r t which
// i s not v i s i b l e from t h e k e e p P o i n t . The f i n a l number o f c e l l s might
// a c t u a l l y be a l o t l e s s .
maxGlobalCells 2000000;

69
70
71
72
73
74

// The s u r f a c e r e f i n e m e n t l o o p might spend l o t s o f i t e r a t i o n s r e f i n i n g j u s t a


// few c e l l s . This s e t t i n g w i l l c a u s e r e f i n e m e n t t o s t o p i f <= minimumRefine
// a r e s e l e c t e d f o r r e f i n e m e n t . Note : i t w i l l a t l e a s t do one i t e r a t i o n
// ( u n l e s s t h e number o f c e l l s t o r e f i n e i s 0 )
minRefinementCells 0 ;

75
76
77
78
79
80

// Allow a c e r t a i n l e v e l o f i m b a l a n c e d u r i n g r e f i n i n g
// ( s i n c e b a l a n c i n g i s q u i t e e x p e n s i v e )
// E x p r e s s e d a s f r a c t i o n o f p e r f e c t b a l a n c e (= o v e r a l l number o f c e l l s /
// nProcs ) . 0=b a l a n c e a l w a y s .
maxLoadUnbalance 0 . 1 ;

81
82
83
84
85

// Number o f b u f f e r l a y e r s between d i f f e r e n t l e v e l s .
// 1 means normal 2 : 1 r e f i n e m e n t r e s t r i c t i o n , l a r g e r means s l o w e r
// r e f i n e m e n t .
nCellsBetweenLevels 3;

86
87
88
89

// E x p l i c i t f e a t u r e edge r e f i n e m e n t
//

90
91
92
93
94
95
96
97
98

//
//
//
//
//
//
//
//

S p e c i f i e s a l e v e l f o r any c e l l i n t e r s e c t e d by e x p l i c i t l y p r o v i d e d
edges .
This i s a featureEdgeMesh , r e a d from c o n s t a n t / t r i S u r f a c e f o r now .
S p e c i f y l e v e l s i n t h e same way a s t h e d i s t a n c e mode i n t h e
r e f i n e m e n t R e g i o n s ( s e e below ) . The o l d s p e c i f i c a t i o n
level
2;
i s e q u i v a l e n t to
levels
((0 2) ) ;

99
100

f e a t u r e s // D i s a b l e d b e c a u s e t h e r e f i n e m e n t w i l l be s u r f a c e based ( a s i n t e r a l
a i r c r a f t c e l l s a r e removed )

101
102

(
// {
//
//
// }

103
104
105
106
107

f i l e a i r c r a f t . eMesh ;
l e v e l s ((4 4) ) ;

);

108
109
110

// S u r f a c e based r e f i n e m e n t
//

111
112
113
114
115

//
//
//
//

S p e c i f i e s two l e v e l s f o r e v e r y s u r f a c e . The f i r s t i s t h e minimum l e v e l ,


e v e r y c e l l i n t e r s e c t i n g a s u r f a c e g e t s r e f i n e d up t o t h e minimum l e v e l .
The s e c o n d l e v e l i s t h e maximum l e v e l . C e l l s t h a t s e e m u l t i p l e
i n t e r s e c t i o n s where t h e i n t e r s e c t i o n s make an

Jordi Casacuberta Puig

156

OPENFOAM GUIDE FOR BEGINNERS

// a n g l e > r e s o l v e F e a t u r e A n g l e g e t r e f i n e d up t o t h e maximum l e v e l .

116
117

refinementSurfaces
{

118
119
120

aircraft . stl
//STL f i l e n a m e where a l l t h e r e g i o n s a r e added
{
l e v e l (6 6) ;
regions
{
/ zone0 //Named r e g i o n i n t h e STL f i l e
{
// S u r f a c e w i s e min and max r e f i n e m e n t l e v e l
l e v e l (2 2) ;
// O p t i o n a l s p e c i f i c a t i o n o f patch t y p e ( d e f a u l t i s w a l l ) . No
// c o n s t r a i n t t y p e s ( c y c l i c , symmetry ) e t c . a r e a l l o w e d .
patchInfo
{
t y p e patch ;
inGroups ( meshedPatches ) ;
}
} /
}

121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140

}
}

141
142
143
144
145

// F e a t u r e a n g l e :
// used i f min and max r e f i n e m e n t l e v e l o f a s u r f a c e d i f f e r
// used i f f e a t u r e s n a p p i n g ( s e e s n a p C o n t r o l s below ) i s used
resolveFeatureAngle 30;

146
147
148
149

// Regionw i s e r e f i n e m e n t
//

150
151
152
153
154
155
156
157
158
159

//
//
//
//
//
//
//
//
//

S p e c i f i e s r e f i n e m e n t l e v e l f o r c e l l s i n r e l a t i o n t o a s u r f a c e . One o f
t h r e e modes
d i s t a n c e . l e v e l s s p e c i f i e s per d i s t a n c e to the s u r f a c e the
wanted r e f i n e m e n t l e v e l . The d i s t a n c e s need t o be s p e c i f i e d i n
increasing order .
i n s i d e . l e v e l s i s o n l y one e n t r y and o n l y t h e l e v e l i s used . A l l
c e l l s i n s i d e t h e s u r f a c e g e t r e f i n e d up t o t h e l e v e l . The s u r f a c e
n e e d s t o be c l o s e d f o r t h i s t o be p o s s i b l e .
o u t s i d e . Same but c e l l s o u t s i d e .

160
161
162
163
164
165
166
167

refinementRegions
{
refinementBox
{
mode i n s i d e ;
l e v e l s ( ( 1 E15 3 ) ) ; // ( 1 E15 ) not r e l e v a n t .
}

168
169
170
171
172

// a i r c r a f t . s t l
// {
//
mode d i s t a n c e ;
//
l e v e l s (0.008 5) ;

Jordi Casacuberta Puig

157

6. Fluid dynamics of a Very Light Aircraft

// }

173

174
175

// Mesh s e l e c t i o n
//

176
177
178

// A f t e r r e f i n e m e n t p a t c h e s g e t added f o r a l l r e f i n e m e n t S u r f a c e s and
// a l l c e l l s i n t e r s e c t i n g t h e s u r f a c e s g e t put i n t o t h e s e p a t c h e s . The
// s e c t i o n r e a c h a b l e from t h e l o c a t i o n I n M e s h i s k e p t .
// NOTE: This p o i n t s h o u l d n e v e r be on a f a c e , a l w a y s i n s i d e a c e l l , even
// a f t e r r e f i n e m e n t .
l o c a t i o n I n M e s h ( 0.051 0.04 0.008) ;

179
180
181
182
183
184
185

// Whether any f a c e Z o n e s ( a s s p e c i f i e d i n t h e r e f i n e m e n t S u r f a c e s )
// a r e o n l y on t h e boundary o f c o r r e s p o n d i n g c e l l Z o n e s o r a l s o a l l o w
// f r e e s t a n d i n g zone f a c e s . Not used i f t h e r e a r e no f a c e Z o n e s .
allowFreeStandingZoneFaces true ;

186
187
188
189
190

191
192
193
194
195
196
197

// S e t t i n g s f o r t h e s n a p p i n g .
snapControls
{
// Number o f patch smoothing i t e r a t i o n s b e f o r e f i n d i n g c o r r e s p o n d e n c e
// t o s u r f a c e
nSmoothPatch 3 ;

198

// Maximum r e l a t i v e d i s t a n c e f o r p o i n t s t o be a t t r a c t e d by s u r f a c e .
// True d i s t a n c e i s t h i s f a c t o r t i m e s l o c a l maximum edge l e n g t h .
// Note : changed ( c o r r e c t e d ) w . r . t 17 x ! ( 1 7 x used 2 t o l e r a n c e )
tolerance 1.0;

199
200
201
202
203

// Number o f mesh d i s p l a c e m e n t r e l a x a t i o n i t e r a t i o n s .
nSolveIter 30;

204
205
206

// Maximum number o f s n a p p i n g r e l a x a t i o n i t e r a t i o n s . Should s t o p


// b e f o r e upon r e a c h i n g a c o r r e c t mesh .
nRelaxIter 5;

207
208
209
210

// F e a t u r e s n a p p i n g

211
212

// Number o f f e a t u r e edge s n a p p i n g i t e r a t i o n s .
// Leave out a l t o g e t h e r t o d i s a b l e .
nFeatureSnapIter 10;

213
214
215
216

// D e t e c t ( g e o m e t r i c o n l y ) f e a t u r e s by s a m p l i n g t h e s u r f a c e
// ( d e f a u l t=f a l s e ) .
implicitFeatureSnap f a l s e ;

217
218
219
220

// Use c a s t e l l a t e d M e s h C o n t r o l s : : f e a t u r e s ( d e f a u l t = t r u e )
explicitFeatureSnap true ;

221
222
223

// D e t e c t f e a t u r e s between m u l t i p l e s u r f a c e s
// ( o n l y f o r e x p l i c i t F e a t u r e S n a p , d e f a u l t = f a l s e )
multiRegionFeatureSnap f a l s e ;

224
225
226
227

228
229

// S e t t i n g s f o r t h e l a y e r a d d i t i o n .

Jordi Casacuberta Puig

158

OPENFOAM GUIDE FOR BEGINNERS

230
231
232
233
234

addLayersControls
{
// Are t h e t h i c k n e s s p a r a m e t e r s below r e l a t i v e t o t h e u n d i s t o r t e d
// s i z e o f t h e r e f i n e d c e l l o u t s i d e l a y e r ( t r u e ) o r a b s o l u t e s i z e s ( f a l s e ) .
r e l a t i v e S i z e s true ;

235
236
237
238
239
240

//
//
//
//
//

Layer t h i c k n e s s s p e c i f i c a t i o n . This can be s p e c i f i e d i n one o f f o u r ways


e x p a n s i o n R a t i o and f i n a l L a y e r T h i c k n e s s ( c e l l n e a r e s t i n t e r n a l mesh )
e x p a n s i o n R a t i o and f i r s t L a y e r T h i c k n e s s ( c e l l on s u r f a c e )
o v e r a l l t h i c k n e s s and f i r s t L a y e r T h i c k n e s s
o v e r a l l t h i c k n e s s and f i n a l L a y e r T h i c k n e s s

241
242
243

// Expansion f a c t o r f o r l a y e r mesh
expansionRatio 2;

244
245
246
247
248

// Wanted t h i c k n e s s o f t h e l a y e r f u r t h e s t away from t h e w a l l .


// I f r e l a t i v e S i z e s t h i s i s r e l a t i v e t o u n d i s t o r t e d s i z e o f c e l l
// o u t s i d e l a y e r .
finalLayerThickness 0.4;

249
250
251
252
253

// Wanted t h i c k n e s s o f t h e l a y e r n e x t t o t h e w a l l .
// I f r e l a t i v e S i z e s t h i s i s r e l a t i v e t o u n d i s t o r t e d s i z e o f c e l l
// o u t s i d e l a y e r .
// f i r s t L a y e r T h i c k n e s s 0 . 3 ;

254
255
256
257
258

// Wanted o v e r a l l t h i c k n e s s o f l a y e r s .
// I f r e l a t i v e S i z e s t h i s i s r e l a t i v e t o u n d i s t o r t e d s i z e o f c e l l
// o u t s i d e l a y e r .
// t h i c k n e s s 0 . 5

259
260
261
262
263
264
265

// Minimum o v e r a l l t h i c k n e s s o f t o t a l l a y e r s . I f f o r any r e a s o n l a y e r
// ca nn ot be above mi nT hi ckn es s do not add l a y e r .
// I f r e l a t i v e S i z e s t h i s i s r e l a t i v e t o u n d i s t o r t e d s i z e o f c e l l
// o u t s i d e l a y e r . .
mi nT hi ck ne ss 0 . 2 ;

266
267
268
269
270
271
272
273
274
275
276
277

// Per f i n a l patch ( s o not geometry ! ) t h e l a y e r i n f o r m a t i o n


// Note : This b e h a v i o u r changed a f t e r 21 x . Any nonmentioned p a t c h e s
//
now s l i d e u n l e s s :
//
n S u r f a c e L a y e r s i s e x p l i c i t l y mentioned t o be 0 .
//
a n g l e t o n e a r e s t s u r f a c e < s l i p F e a t u r e A n g l e ( s e e below )
layers
{
aircraftPatch
{
nSurfaceLayers 2;

278
279
280
281
282
283
284
285
286

}
maxY
{
nSurfaceLayers 2;
// Per patch l a y e r data
expansionRatio
2;
finalLayerThickness 0.4;
mi nT hi ck nes s
0.2;

Jordi Casacuberta Puig

159

6. Fluid dynamics of a Very Light Aircraft

287
288

// D i s a b l e any mesh s h r i n k i n g and l a y e r a d d i t i o n on any p o i n t o f


// a patch by s e t t i n g n S u r f a c e L a y e r s t o 0
frozenPatches
{
nSurfaceLayers 0;
}

289
290
291
292
293
294
295

296
297
298
299
300
301

// I f p o i n t s g e t not e x t r u d e d do nGrow l a y e r s o f c o n n e c t e d f a c e s t h a t a r e
// a l s o not grown . This h e l p s c o n v e r g e n c e o f t h e l a y e r a d d i t i o n p r o c e s s
// c l o s e t o f e a t u r e s .
// Note : changed ( c o r r e c t e d ) w . r . t 17 x ! ( didn t do a n y t h i n g i n 17 x )
nGrow 0 ;

302
303

// Advanced s e t t i n g s

304
305
306
307

// When not t o e x t r u d e s u r f a c e . 0 i s
// a r e p e r p e n d i c u l a r
featureAngle 60;

f l a t s u r f a c e , 90 i s when two f a c e s

308
309
310
311

// At nonp a t c h e d s i d e s a l l o w mesh t o s l i p
// a n g l e l a r g e r than s l i p F e a t u r e A n g l e .
slipFeatureAngle 30;

if

e x t r u s i o n d i r e c t i o n makes

312
313
314
315

// Maximum number o f s n a p p i n g r e l a x a t i o n i t e r a t i o n s . Should s t o p


// b e f o r e upon r e a c h i n g a c o r r e c t mesh .
nRelaxIter 5;

316
317
318

// Number o f smoothing i t e r a t i o n s o f s u r f a c e no rm al s
nSmoothSurfaceNormals 1 ;

319
320
321

// Number o f smoothing i t e r a t i o n s o f i n t e r i o r mesh movement d i r e c t i o n


nSmoothNormals 3 ;

322
323
324

// Smooth l a y e r t h i c k n e s s o v e r s u r f a c e p a t c h e s
nSmoothThickness 1 0 ;

325
326
327

// Stop l a y e r growth on h i g h l y warped c e l l s


maxFaceThicknessRatio 0 . 5 ;

328
329
330
331

// Reduce l a y e r growth where r a t i o t h i c k n e s s t o m e d i a l


// d i s t a n c e i s l a r g e
maxThicknessToMedialRatio 0 . 3 ;

332
333
334
335

// Angle used t o p i c k up m e d i a l a x i s p o i n t s
// Note : changed ( c o r r e c t e d ) w . r . t 17 x ! 90 d e g r e e s c o r r e s p o n d s t o 130 i n 17 x .
minMedianAxisAngle 9 0 ;

336
337
338

// C r e a t e b u f f e r r e g i o n f o r new l a y e r t e r m i n a t i o n s
nBufferCellsNoExtrude 0;

339
340
341
342
343

// O v e r a l l max number o f l a y e r a d d i t i o n i t e r a t i o n s . The mesher w i l l e x i t


// i f i t r e a c h e s t h i s number o f i t e r a t i o n s ; p o s s i b l y with an i l l e g a l
// mesh .
nLayerIter 50;

Jordi Casacuberta Puig

160

OPENFOAM GUIDE FOR BEGINNERS

344

// Max number o f i t e r a t i o n s a f t e r which r e l a x e d meshQuality c o n t r o l s


// g e t used . Up t o n R e l a x I t e r i t u s e s t h e s e t t i n g s i n m e s h Q u a l i t y C o n t r o l s ,
// a f t e r n R e l a x I t e r i t u s e s t h e v a l u e s i n m e s h Q u a l i t y C o n t r o l s : : r e l a x e d .
nRelaxedIter 20;

345
346
347
348
349

// A d d i t i o n a l r e p o r t i n g : i f t h e r e a r e j u s t a few f a c e s where t h e r e
// a r e mesh e r r o r s ( a f t e r a dd in g t h e l a y e r s ) p r i n t t h e i r f a c e c e n t r e s .
// This h e l p s i n t r a c k i n g down p r o b l e m a t i c mesh a r e a s .
// a d d i t i o n a l R e p o r t i n g t r u e ;

350
351
352
353
354

355
356
357
358
359
360
361

// G e n e r i c mesh q u a l i t y s e t t i n g s . At any u n d o a b l e phase t h e s e d e t e r m i n e


// where t o undo .
meshQualityControls
{
// Maximum nono r t h o g o n a l i t y a l l o w e d . S e t t o 180 t o d i s a b l e .
maxNonOrtho 4 5 ;

362
363
364
365

// Max s k e w n e s s a l l o w e d . S e t t o <0 t o d i s a b l e .
maxBoundarySkewness 2 0 ;
maxInternalSkewness 4 ;

366
367
368
369
370

// Max c o n c a v e n e s s a l l o w e d . I s a n g l e ( i n d e g r e e s ) below which c o n c a v i t y


// i s a l l o w e d . 0 i s s t r a i g h t f a c e , <0 would be convex f a c e .
// S e t t o 180 t o d i s a b l e .
maxConcave 8 0 ;

371
372
373
374
375

// Minimum pyramid volume . I s a b s o l u t e volume o f c e l l pyramid .


// S e t t o a s e n s i b l e f r a c t i o n o f t h e s m a l l e s t c e l l volume e x p e c t e d .
// S e t t o v e r y n e g a t i v e number ( e . g . 1E30 ) t o d i s a b l e .
minVol 1 e 13;

376
377
378
379
380
381
382
383
384
385

// Minimum q u a l i t y o f t h e t e t formed by t h e f a c e c e n t r e
// and v a r i a b l e b a s e p o i n t minimum d e c o m p o s i t i o n t r i a n g l e s and
// t h e c e l l c e n t r e . This has t o be a p o s i t i v e number f o r t r a c k i n g
// t o work . S e t t o v e r y n e g a t i v e number ( e . g . 1E30 ) t o
// d i s a b l e .
//
<0 = i n s i d e out t e t ,
//
0 = flat tet
//
1 = regular tet
minTetQuality 1 e 9;

386
387
388

// Minimum f a c e a r e a . S e t t o <0 t o d i s a b l e .
minArea 1;

389
390
391
392

// Minimum f a c e t w i s t . S e t t o <1 t o d i s a b l e . dot p r o d u c t o f f a c e normal


// and f a c e c e n t r e t r i a n g l e s normal
minTwist 0 . 0 5 ;

393
394
395
396

// minimum n o r m a l i s e d c e l l d e t e r m i n a n t
// 1 = hex , <= 0 = f o l d e d o r f l a t t e n e d i l l e g a l
minDeterminant 0 . 0 0 1 ;

cell

397
398
399

// minFaceWeight ( 0 > 0 . 5 )
minFaceWeight 0 . 0 5 ;

400

Jordi Casacuberta Puig

161

6. Fluid dynamics of a Very Light Aircraft

// minVolRatio ( 0 > 1 )
minVolRatio 0 . 0 1 ;

401
402
403

// must be >0 f o r F l u e n t c o m p a t i b i l i t y
m i n T r i a n g l e T w i s t 1;

404
405
406

// i f >0 : p r e s e r v e s i n g l e c e l l s with a l l p o i n t s on t h e s u r f a c e i f t h e
//
r e s u l t i n g volume a f t e r s n a p p i n g ( by a p p r o x i m a t i o n ) i s l a r g e r than
// m i n V o l C o l l a p s e R a t i o t i m e s o l d volume ( i . e . not c o l l a p s e d t o f l a t c e l l ) .
//
I f <0 : d e l e t e a l w a y s .
// m i n V o l C o l l a p s e R a t i o 0 . 5 ;

407
408
409
410
411
412

// Advanced

413
414

// Number o f e r r o r d i s t r i b u t i o n i t e r a t i o n s
nSmoothScale 4 ;
// amount t o s c a l e back d i s p l a c e m e n t a t e r r o r p o i n t s
errorReduction 0. 75;

415
416
417
418
419

// O p t i o n a l : some meshing p h a s e s a l l o w u s a g e o f r e l a x e d r u l e s .
// See e . g . a d d L a y e r s C o n t r o l s : : n R e l a x e d I t e r .
relaxed
{
// Maximum nono r t h o g o n a l i t y a l l o w e d . S e t t o 180 t o d i s a b l e .
maxNonOrtho 4 5 ;
}

420
421
422
423
424
425
426
427

428
429

// Advanced

430
431
432
433
434
435
436

// F l a g s f o r o p t i o n a l o ut pu t
// 0 : o n l y w r i t e f i n a l meshes
// 1 : w r i t e i n t e r m e d i a t e meshes
// 2 : w r i t e v o l S c a l a r F i e l d with c e l l L e v e l f o r p o s t p r o c e s s i n g
// 4 : w r i t e c u r r e n t i n t e r s e c t i o n s a s . o b j f i l e s
debug 0 ;

437
438
439
440

// Merge t o l e r a n c e . I s f r a c t i o n o f o v e r a l l bounding box o f i n i t i a l mesh .


// Note : t h e w r i t e t o l e r a n c e n e e d s t o be h i g h e r than t h i s .
m e r g e T o l e r a n c e 1 e 6;

441
442

// //

To start meshing, make sure that the first switch is set to true while the others are
set to false (lines 18 through 20). Then, within the case directory, type:
snappyHexMesh
The first switch, controlling the castellatedMeshControls uses the cells of the background mesh to divide the domain in small cubes according to the instructions
specified in the dictionary. A new directory has appeared (named 1 if deltaT and

Jordi Casacuberta Puig

162

OPENFOAM GUIDE FOR BEGINNERS

writeInterval have been previously set to 1). It contains the information of the first
meshing process of snappyHexMesh.
The results are shown in the following figure:

Figure 6.6: Shape of the aircraft at the first step of the meshing process of snappyHexMesh

To obtain the results shown in Figure 6.6, launch ParaView, go to time interval 1
and select aircraftPatch located in Mesh Parts.
As it was previously said, the internal cells of the aircraft are removed. This characteristic, as well as the cell refinement distribution along the domain can be observed
in the following figures:

Jordi Casacuberta Puig

163

6. Fluid dynamics of a Very Light Aircraft

Figure 6.7: Mesh of the domain at the first step of the meshing process of snappyHexMesh

Figure 6.8: Detail of the mesh at the first step of the meshing process of snappyHexMesh

Jordi Casacuberta Puig

164

OPENFOAM GUIDE FOR BEGINNERS

Figure 6.9: Detail of the mesh with a representation of the cell refinement at the
first step of the meshing process of snappyHexMesh

For the representation of the previous Figures, internalMesh has to be selected


instead of aircraftPatch. Moreover, as the aircraft shape is internal, a cut using
the Clip icon has to be used. To show the cell refinement as a field, click the Volume
Fields box located within Properties. Then, select the cellLevel option in the first
drop-down menu at the top of ParaViews screen.
As it can be seen in previous figures, the surface of the aircraft is irregular and cubebased. The second switch of snappyHexMesh controls the snapControls, involving the
displacement of boundary vertices to conform to surface. All vertex displacements
are reversible to ensure mesh quality.
To proceed to the next step, set the first switch to false, the second to true and type:
snappyHexMesh
Once it has been run, the user can observe the 2 directory within the case containing
the information generated. During this second process, castellated mesh boundary
and internal mesh have been smoothed. Furthermore, mesh boundary is snapped to
geometry surface.
Now, in ParaView, the user can use the time control buttons to view the background
mesh (t = 0), the castellated mesh (t = 1) and the mesh generated in the second
step of snappyHexMesh (t = 2). In the following figures it is possible to observe the

Jordi Casacuberta Puig

165

6. Fluid dynamics of a Very Light Aircraft

differences between directories 1 and 2 :


t=1

t=2

Now, the mesh of the Very Light Aircraft case is ready.


It exists a third switch in snappyHexMesh which introduces cell layers at the patches
of the case. When doing it, surface points are identified and are not displaced. In
the current tutorial, this third process of snappyHexMesh is not going to be used.
Finally, it is important to mention that the snappyHexMeshDict file is complex to
fully understand; it includes a lot of instructions and only with time and experience it
is possible to reach a broad domain of its contents. Nevertheless, the user can identify
some basic instructions that are relevant when preparing the meshing process:
Name of the geometry used for the meshing process: line 30
Definition of cell refinement level at the patches of the domain: lines
118 through 140
Specification of a point contained in the volume which will be meshed:
line 184
Regarding the last sentence, as in the current case the point specified is located
outside the aircraft, its internal cells have been removed while the background mesh
has become the fluid domain.
Advice:
If the user wants to remesh the case (changing or not the instructions of
snappyHexMeshDict) it is first necessary to remove 1 and 2 directories.
Then, after setting the switches properly, snappyHexMesh can be run
again
Jordi Casacuberta Puig

166

OPENFOAM GUIDE FOR BEGINNERS

6.0.21.2

Boundary and initial conditions

Besides the p and U files, as the case is set turbulent, three new files are necessary
to be created. Their names are k, nut and omega. These dictionaries contain the
boundary conditions of the parameters used to implement the SST k-w turbulence
model. Before discussing their calculation, the boundary conditions for p and U
are:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

/ C++ \
| =========
|
|
| \\
/ F ield
| OpenFOAM: The Open S o u r c e CFD Toolbox
|
|
\\
/
O peration
| Version :
2.2.1
|
|
\\ /
A nd
| Web :
www.OpenFOAM. o r g
|
|
\\/
M anipulation
|
|
\/
FoamFile
{
version
2.0;
format
ascii ;
class
volScalarField ;
object
p;
}
// //

16
17

dimensions

[ 0 2 2 0 0 0 0 ] ;

internalField

uniform 0 ;

18
19
20
21
22
23
24
25
26

boundaryField
{
inlet
{
type
}

freestreamPressure ;

27
28
29
30
31

outlet
{
type
}

freestreamPressure ;

32
33
34
35
36

aircraftPatch
{
type
}

zeroGradient ;

37
38
39

top
{
type

40
41

slip ;

42
43
44
45
46

bottom
{
type
}

slip ;

47

Jordi Casacuberta Puig

167

6. Fluid dynamics of a Very Light Aircraft

frontAndBack
{
type
}

48
49
50
51

slip ;

52
53

54
55

// //

/ C++ \
| =========
|
|
| \\
/ F ield
| OpenFOAM: The Open S o u r c e CFD Toolbox
|
|
\\
/
O peration
| Version :
2.2.1
|
|
\\ /
A nd
| Web :
www.OpenFOAM. o r g
|
|
\\/
M anipulation
|
|
\/
FoamFile
{
version
2.0;
format
ascii ;
class
volVectorField ;
object
U;
}
// //

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

dimensions

[ 0 1 1 0 0 0 0 ] ;

internalField

u n i f o r m (45 0 0 ) ;

18
19
20
21
22
23
24
25
26
27

boundaryField
{
inlet
{
type
freestream ;
f r e e s t r e a m V a l u e u n i f o r m (45 0 0 ) ;
}

28
29
30
31
32
33

outlet
{
type
freestream ;
f r e e s t r e a m V a l u e u n i f o r m (45 0 0 ) ;
}

34
35
36
37
38
39

aircraftPatch
{
type
value
}

fixedValue ;
uniform (0 0 0) ;

40
41
42

top
{
type

43
44

slip ;

45
46
47

bottom
{

Jordi Casacuberta Puig

168

OPENFOAM GUIDE FOR BEGINNERS

type

48

slip ;

49
50

frontAndBack
{
type
}

51
52
53
54
55

slip ;

56
57

// //

Caution:
As in the current case there is not 0 directory, the dictionaries of p, U,
k, nut and omega are included within the last directory generated with
snappyHexMesh
The dictionaries of k, nut and omega are:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

/ C++ \
| =========
|
|
| \\
/ F ield
| OpenFOAM: The Open S o u r c e CFD Toolbox
|
|
\\
/
O peration
| Version :
2.2.1
|
|
\\ /
A nd
| Web :
www.OpenFOAM. o r g
|
|
\\/
M anipulation
|
|
\/
FoamFile
{
version
2.0;
format
binary ;
class
volScalarField ;
location
2 ;
object
k;
}
// //

17
18

dimensions

[ 0 2 2 0 0 0 0 ] ;

internalField

uniform 1 . 2 1 5 ;

19
20
21
22
23
24
25
26
27
28

boundaryField
{
inlet
{
type
value
}

fixedValue ;
uniform 1 . 2 1 5 ;

29
30
31
32
33
34

outlet
{
type
inletValue
value

Jordi Casacuberta Puig

inletOutlet ;
uniform 1 . 2 1 5 ;
uniform 1 . 2 1 5 ;

169

6. Fluid dynamics of a Very Light Aircraft

35
36

aircraftPatch
{
type
value
}

37
38
39
40
41

kqRWallFunction ;
uniform 1 . 2 1 5 ;

42

top
{

43
44

type

45

slip ;

46
47

bottom
{
type
}

48
49
50
51

slip ;

52

frontAndBack
{
type
}

53
54
55
56
57

slip ;

58
59

// //

/ C++ \
| =========
|
|
| \\
/ F ield
| OpenFOAM: The Open S o u r c e CFD Toolbox
|
|
\\
/
O peration
| Version :
2.2.1
|
|
\\ /
A nd
| Web :
www.OpenFOAM. o r g
|
|
\\/
M anipulation
|
|
\/
FoamFile
{
version
2.0;
format
binary ;
class
volScalarField ;
location
2 ;
object
nut ;
}
// //

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

dimensions

[ 0 2 1 0 0 0 0 ] ;

internalField

uniform 0 ;

19
20
21
22
23
24
25
26
27
28

boundaryField
{
inlet
{
type
value
}

calculated ;
uniform 0 ;

29
30

outlet

Jordi Casacuberta Puig

170

OPENFOAM GUIDE FOR BEGINNERS

31

type
value

32
33

calculated ;
uniform 0 ;

34
35

aircraftPatch
{
type
value
}

36
37
38
39
40

nutkWallFunction ;
uniform 0 ;

41

top
{

42
43

type
value

44
45

calculated ;
uniform 0 ;

46
47

bottom
{
type
value
}

48
49
50
51
52

calculated ;
uniform 0 ;

53

frontAndBack
{
type
value
}

54
55
56
57
58
59

calculated ;
uniform 0 ;

60
61

// //

/ C++ \
| =========
|
|
| \\
/ F ield
| OpenFOAM: The Open S o u r c e CFD Toolbox
|
|
\\
/
O peration
| Version :
2.2.1
|
|
\\ /
A nd
| Web :
www.OpenFOAM. o r g
|
|
\\/
M anipulation
|
|
\/
FoamFile
{
version
2.0;
format
binary ;
class
volScalarField ;
location
2 ;
object
omega ;
}
// //

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

dimensions

[ 0 0 1 0 0 0 0 ] ;

internalField

uniform 2 1 4 7 . 7 4 5 ;

19
20
21
22
23
24

boundaryField
{
inlet

Jordi Casacuberta Puig

171

6. Fluid dynamics of a Very Light Aircraft

25

type
value

26
27

fixedValue ;
uniform 2 1 4 7 . 7 4 5 ;

28
29

outlet
{
type
inletValue
value
}

30
31
32
33
34
35

inletOutlet ;
uniform 2 1 4 7 . 7 4 5 ;
uniform 2 1 4 7 . 7 4 5 ;

36

aircraftPatch
{
type
value
}

37
38
39
40
41

omegaWallFunction ;
uniform 2 1 4 7 . 7 4 5 ;

42

top
{

43
44

type

45

slip ;

46
47

bottom
{
type
}

48
49
50
51

slip ;

52

frontAndBack
{
type
}

53
54
55
56
57

slip ;

58
59

// //

k, t and are parameters required to simulate the case with a turbulence model.
Mathematically, they are determined as:
3
k = (|U|I)2
2

(6.5)

C0.25 k 0.5
l

(6.6)

C = 0.09k

(6.7)

Where |U| is the mean flow velocity, I is the turbulence intensity and l the turbulent
length scale. They can be computed as:

Jordi Casacuberta Puig

172

OPENFOAM GUIDE FOR BEGINNERS

I 2%

l 0.07 c
With these assumptions, k = 1.215, C = 0.109 and = 2147.745.
6.0.21.3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

Physical properties

/ C++ \
| =========
|
|
| \\
/ F ield
| OpenFOAM: The Open S o u r c e CFD Toolbox
|
|
\\
/
O peration
| Version :
2.2.1
|
|
\\ /
A nd
| Web :
www.OpenFOAM. o r g
|
|
\\/
M anipulation
|
|
\/
FoamFile
{
version
2.0;
format
ascii ;
class
dictionary ;
object
transportProperties ;
}
// //

16
17

transportModel

Newtonian ;

nu

nu [ 0 2 1 0 0 0 0 ] 1 . 5 e 07;

18
19
20
21

// //

/ C++ \
| =========
|
|
| \\
/ F ield
| OpenFOAM: The Open S o u r c e CFD Toolbox
|
|
\\
/
O peration
| Version :
2.2.1
|
|
\\ /
A nd
| Web :
www.OpenFOAM. o r g
|
|
\\/
M anipulation
|
|
\/
FoamFile
{
version
2.0;
format
ascii ;
class
dictionary ;
object
RASProperties ;
}
// //

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

RASModel

kOmegaSST ;

turbulence

on ;

18
19
20

Jordi Casacuberta Puig

173

6. Fluid dynamics of a Very Light Aircraft

21

printCoeffs

on ;

22
23

// //

Remember that although the medium is air, = 1.5107 to maintain the Reynolds
number as the dimensional analysis showed.
6.0.21.4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

Control

/ C++ \
| =========
|
|
| \\
/ F ield
| OpenFOAM: The Open S o u r c e CFD Toolbox
|
|
\\
/
O peration
| Version :
2.2.1
|
|
\\ /
A nd
| Web :
www.OpenFOAM. o r g
|
|
\\/
M anipulation
|
|
\/
FoamFile
{
version
2.0;
format
ascii ;
class
dictionary ;
object
controlDict ;
}
// //

16
17

application

simpleFoam ;

startFrom

latestTime ;

startTime

0;

stopAt

endTime ;

endTime

300;

deltaT

1;

writeControl

timeStep ;

writeInterval

1;

pur geWri te

0;

writeFormat

binary ;

writePrecision

6;

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

w r i t e C o m p r e s s i o n uncompressed ;

40
41

timeFormat

general ;

timePrecision

6;

42
43
44
45

runTimeModifiable true ;

Jordi Casacuberta Puig

174

OPENFOAM GUIDE FOR BEGINNERS

46
47
48
49
50
51
52

functions
{
#i n c l u d e r e a d F i e l d s
#i n c l u d e c u t t i n g P l a n e
#i n c l u d e f o r c e C o e f f s
}

53
54

// //

As it can be seen, at lines 47 through 52 the program is using external functions to


develop specific tasks. While the case is running, these external functions are called
using its dictionaries located within system. It facilitates the treatment of the code.
For instance, it is not necessary to include all the instructions to calculate the force
coefficients directly in controlDict. The dictionaries are shown in Section 6.0.21.6.
6.0.21.5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

Discretization and linear-solver settings

/ C++ \
| =========
|
|
| \\
/ F ield
| OpenFOAM: The Open S o u r c e CFD Toolbox
|
|
\\
/
O peration
| Version :
2.2.1
|
|
\\ /
A nd
| Web :
www.OpenFOAM. o r g
|
|
\\/
M anipulation
|
|
\/
FoamFile
{
version
2.0;
format
ascii ;
class
dictionary ;
object
fvSchemes ;
}
// //

16
17
18
19
20

ddtSchemes
{
default
}

steadyState ;

21
22
23
24
25
26

gradSchemes
{
default
grad (U)
}

Gauss l i n e a r ;
c e l l L i m i t e d Gauss l i n e a r 1 ;

27
28
29
30
31
32
33
34
35

divSchemes
{
default
none ;
d i v ( phi ,U)
bounded Gauss linearUpwindV grad (U) ;
d i v ( phi , k )
bounded Gauss upwind ;
d i v ( phi , omega ) bounded Gauss upwind ;
d i v ( ( n u E f f dev (T( grad (U) ) ) ) ) Gauss l i n e a r ;
}

Jordi Casacuberta Puig

175

6. Fluid dynamics of a Very Light Aircraft

36
37
38
39
40

laplacianSchemes
{
default
}

Gauss l i n e a r c o r r e c t e d ;

41
42
43
44
45

interpolationSchemes
{
default
linear ;
}

46
47
48
49
50

snGradSchemes
{
default
}

corrected ;

51
52
53
54
55
56

fluxRequired
{
default
p;
}

no ;

57
58

// //

/ C++ \
| =========
|
|
| \\
/ F ield
| OpenFOAM: The Open S o u r c e CFD Toolbox
|
|
\\
/
O peration
| Version :
2.2.1
|
|
\\ /
A nd
| Web :
www.OpenFOAM. o r g
|
|
\\/
M anipulation
|
|
\/
FoamFile
{
version
2.0;
format
ascii ;
class
dictionary ;
object
fvSolution ;
}
// //

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

solvers
{
p
{
solver
GAMG;
tolerance
1 e 7;
relTol
0.01;
smoother
GaussSeidel ;
nPreSweeps
0;
nPostSweeps
2;
c a c h e A g g l o m e r a t i o n on ;
agglomerator
faceAreaPair ;
nCellsInCoarsestLevel 10;
mergeLevels
1;

21
22
23
24
25
26
27
28
29
30
31

32

Jordi Casacuberta Puig

176

OPENFOAM GUIDE FOR BEGINNERS

U
{

33
34
35
36
37
38
39

solver
smoother
tolerance
relTol
nSweeps

smoothSolver ;
GaussSeidel ;
1 e 8;
0.1;
1;

solver
smoother
tolerance
relTol
nSweeps

smoothSolver ;
GaussSeidel ;
1 e 8;
0.1;
1;

40
41

k
{

42
43
44
45
46
47
48

49
50

omega
{
solver
smoother
tolerance
relTol
nSweeps
}

51
52
53
54
55
56
57
58
59

smoothSolver ;
GaussSeidel ;
1 e 8;
0.1;
1;

60
61
62
63
64
65
66
67

SIMPLE
{
nCorrectors
nNonOrthogonalCorrectors
pRefCell
pRefValue
}

1;
2;
0;
0;

68
69
70
71
72

potentialFlow
{
nNonOrthogonalCorrectors 10;
}

73
74
75
76
77
78
79
80
81
82
83
84
85
86

relaxationFactors
{
fields
{
p
}
equations
{
U
k
omega
}
}

0.3;

0.5;
0.5;
0.5;

87
88
89

cache
{

Jordi Casacuberta Puig

177

6. Fluid dynamics of a Very Light Aircraft

grad (U) ;

90
91

92
93

// //

6.0.21.6

External functions

This section contains the dictionaries used by the functions of controlDict. They
must be copied into files named readFiles, forceCoeffs and cuttingPlane respectively.
They are located within system.
readFields
1
2
3
4
5
6
7

/ C++ \
| =========
|
|
| \\
/ F ield
| OpenFOAM: The Open S o u r c e CFD Toolbox
|
|
\\
/
O peration
| Version :
2.2.1
|
|
\\ /
A nd
| Web :
www.OpenFOAM. o r g
|
|
\\/
M anipulation
|
|
\/

8
9
10
11
12
13
14

// Make s u r e a l l f i e l d s f o r f u n c t i o n O b j e c t s a r e l o a d e d . P r e v e n t s any
// p r o b l e m s r u n n i n g with e x e c F l o w F u n c t i o n O b j e c t s .
readFields
{
// Where t o l o a d i t from ( i f not a l r e a d y i n s o l v e r )
functionObjectLibs ( l i b f i e l d F u n c t i o n O b j e c t s . so ) ;

15

type
fields

16
17
18

readFields ;
(p U k) ;

19
20
21

// //

forceCoeffs
1
2
3
4
5
6
7

/ C++ \
| =========
|
|
| \\
/ F ield
| OpenFOAM: The Open S o u r c e CFD Toolbox
|
|
\\
/
O peration
| Version :
2.2.1
|
|
\\ /
A nd
| Web :
www.OpenFOAM. o r g
|
|
\\/
M anipulation
|
|
\/

8
9
10
11
12

forces
{
type
functionObjectLibs

Jordi Casacuberta Puig

forces ;
( l i b f o r c e s . s o ) ; // Lib t o l o a d

178

OPENFOAM GUIDE FOR BEGINNERS

outputControl
outputInterval
patches
calculated
pName
UName
rhoName
log
rhoInf
CofR

13
14
15

16
17
18
19
20
21
22

timeStep ;
1;
( a i r c r a f t P a t c h ) ; // Patch name o v e r f o r c e s w i l l be
p;
U;
r h o I n f ; // R e f e r e n c e d e n s i t y
true ;
1 . 2 2 5 ; // A i r d e n s i t y
( 0 0 0 ) ; // O r i g i n f o r moment c a l c u l a t i o n s

23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42

forceCoeffs
{
type f o r c e C o e f f s ;
functionObjectLibs ( l i b f o r c e s . so ) ;
patches ( aircraftPatch ) ;
// pName p ;
// UName U;
rhoName r h o I n f ;
rhoInf 1.225;
CofR ( 0 0 0 ) ;
l i f t D i r (0 1 0) ;
d r a g D i r (1 0 0 ) ;
pitchAxis (0 0 1) ;
magUInf 4 5 ; // F re e stream v e l o c i t y
l R e f 0 . 0 1 2 7 6 ; // Mean Chord
A r e f 0 . 0 0 1 2 1 8 ; // Ref . Area
outputControl timeStep ;
outputInterval 1;
}

43
44

// //

cuttingPlane
The cuttingPlane function generates a VTK plane cutting the fluid domain in a
specified direction. It can be easily open from the postProcessing directory once the
case has been run and allows a practial and rapid view of the p and U fields.
1
2
3
4
5
6
7

/ C++ \
| =========
|
|
| \\
/ F ield
| OpenFOAM: The Open S o u r c e CFD Toolbox
|
|
\\
/
O peration
| Version :
2.2.1
|
|
\\ /
A nd
| Web :
www.OpenFOAM. o r g
|
|
\\/
M anipulation
|
|
\/

8
9
10
11
12
13

cuttingPlane
{
type
surfaces ;
functionObjectLibs ( l i b s a m p l i n g . so ) ;
outputControl
outputTime ;

14

Jordi Casacuberta Puig

179

6. Fluid dynamics of a Very Light Aircraft

surfaceFormat
fields

15
16

vtk ;
( p U );

17

interpolationScheme cellPoint ;

18
19

surfaces
(
yNormal
{
type
cuttingPlane ;
planeType
pointAndNormal ;
pointAndNormalDict
{
basePoint
(0 0 0) ;
normalVector
(0 1 0) ;
}
interpolate
true ;
}
);

20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

35
36

// //

At the end of the pre-processing, the structure of directories, subdirectories and files
within aircraft should be as follows:

Jordi Casacuberta Puig

180

OPENFOAM GUIDE FOR BEGINNERS

0
k

nut

omega

polyMesh

triSurface

constant
extendedFeatureEdgeMesh

transportProperties

aircraft

RASProperties

controlDict

fvSchemes

fvSolutions

surfaceFeatureExtractDict

system

snappyHexMeshDict

readFields

cuttingPlane

forceCoeffs

6.0.22

Post-processing

6.0.22.1

Results of the simulation

The pressure field around the aircraft:

Jordi Casacuberta Puig

181

6. Fluid dynamics of a Very Light Aircraft

Figure 6.10: Pressure field around the aircraft (m2 /s2 )

The velocity field in the whole domain:

Figure 6.11: Velocity field in the domain of the aircraft case (m/s)

The velocity field around the aircraft:

Jordi Casacuberta Puig

182

OPENFOAM GUIDE FOR BEGINNERS

Figure 6.12: Velocity field around the aircraft (m/s)

At the end of the simulation, the values of drag coefficient and lift coefficient stabilized at:
CD = 0.0276
CL = 0.005
Although the value of the drag coefficient matches with other real very light aircrafts
(as for instance the Cessna 172), the lift coefficient is very low, and therefore the
aerodynamic efficiency (E = L/D) is far from the current commercial aircrafts.
As it was explained, the aircraft geometry used in this chapter was not designed
according to a realistic aerodynamic study (as it would have been CFD or wind
tunnel experiments).
Another consideration that must be done is the fact that although the case is set
turbulent, the wake of the aircraft shows a continuous appearance. It is because a
RAS turbulence model has been used, based on average flow conditions. If other
turbulence models had been used (as for instance LES or DNS), it would have been
possible to observe turbulence in the wake.
For Figures 6.11 and 6.12, the VTK plane obtained from the postProcessing directory
has been used.

Jordi Casacuberta Puig

183

Potrebbero piacerti anche