29
5. Aerodynamics of a 2D airfoil NACA 23012 5. Aerodynamics of a 2D airfoil NACA 23012 5.0.12 Description of the case The current chapter studies flow around a 2D airfoil. Although it encompasses the study of external flow, there are significant differences with Chapter 3, such as the fact that an airfoil is a streamlined body, and thus the behaviour of the flow around it changes substantially. Besides the physics of the problem, Chapter 5 includes new features as the introduction of turbulence models and the creation of a mesh without using blockMesh. 5.0.13 Hypotheses Incompressible flow Turbulent flow Newtonian flow Bidimensional flow ( ∂z = 0) Negligible gravitatory effects Sea level conditions RAS turbulence modelling with wall functions 5.0.14 Physics of the problem The problem deals with an airfoil NACA 23012 flying at a speed of V = 45 m/s at sea level. As the medium is air (ν =1.5 × 10 -5 m 2 /s), the Reynolds number is Re = Vc ν = 45 · 1 1.5 × 10 -5 =3 × 10 6 Jordi Casacuberta Puig 116

5.Aerodynamics of a 2D airfoil NACA 23012 › _files › ...5. Aerodynamics of a 2D airfoil NACA 23012 5.Aerodynamics of a 2D airfoil NACA 23012 5.0.12Description of the case The current

  • Upload
    others

  • View
    51

  • Download
    1

Embed Size (px)

Citation preview

  • 5. Aerodynamics of a 2D airfoil NACA 23012

    5. Aerodynamics of a 2D airfoil

    NACA 23012

    5.0.12 Description of the case

    The current chapter studies flow around a 2D airfoil. Although it encompasses the

    study of external flow, there are significant differences with Chapter 3, such as the

    fact that an airfoil is a streamlined body, and thus the behaviour of the flow around

    it changes substantially. Besides the physics of the problem, Chapter 5 includes

    new features as the introduction of turbulence models and the creation of a mesh

    without using blockMesh.

    5.0.13 Hypotheses

    • Incompressible flow

    • Turbulent flow

    • Newtonian flow

    • Bidimensional flow ( ∂∂z

    = 0)

    • Negligible gravitatory effects

    • Sea level conditions

    • RAS turbulence modelling with wall functions

    5.0.14 Physics of the problem

    The problem deals with an airfoil NACA 23012 flying at a speed of V = 45 m/s at

    sea level. As the medium is air (ν = 1.5× 10−5 m2/s), the Reynolds number is

    Re =V c

    ν=

    45 · 11.5× 10−5

    = 3× 106

    Jordi Casacuberta Puig 116

  • OPENFOAM GUIDE FOR BEGINNERS

    where c is the chord of the airfoil and is equal to 1 m. The chord is the imaginary

    straight line joining the leading and trailing edges. The problem statement is shown

    at Figure 5.1.

    Figure 5.1: Airfoil NACA 23012 flying at 45 m/s and ambient pressure

    The airfoil NACA 23012 has been chosen because of its high aerodynamic perfor-

    mance at low flying velocities. It presents a high maximum lift coefficient (Clmax)

    and a high stall angle (αstall). Its geometric characteristics are:

    • Thickness: 12%

    • Maximum thickness position: 30%

    • Maximum chamber: 1.83%

    • Maximum chamber position: 13%

    The shape of the NACA 23012 is shown at Figure 5.2.

    Jordi Casacuberta Puig 117

  • 5. Aerodynamics of a 2D airfoil NACA 23012

    Figure 5.2: NACA 23012

    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 and

    dimensionless numbers involved in the problem:

    The continuity equation,

    ∇ ·U = 0 (5.1)

    The momentum equation,

    ∂U

    ∂t+ U · ∇U = −1

    ρ∇p + µ

    ρ∇2U (5.2)

    The Reynolds number,

    Re =c|U|ν

    (5.3)

    The lift coefficient (dimensionless force perpendicular to the flow),

    Cl =L

    1

    2ρ|U|2S

    (5.4)

    The drag coefficient (dimensionless force parallel to the flow),

    Cd =D

    1

    2ρ|U|2S

    (5.5)

    The moment coefficient (dimensionless moment of the airfoil calculated at the aero-

    dynamic center),

    Cm =M

    1

    2ρ|U|2Sc

    (5.6)

    Jordi Casacuberta Puig 118

  • OPENFOAM GUIDE FOR BEGINNERS

    For a low velocity flow and a surface with a given rugosity, Cl and Cd depend on

    the angle of attack and the Reynolds number:

    Cl = f(Re, α) or Cd = f(Re, α)

    The angle of attack (α) is the angle between the chord of the airfoil and the direction

    of the fluid velocity.

    At low values of α, there is a pressure gradient on the upper surface of the airfoil

    but it is not strong enough to detach the boundary layer. The flow around the

    airfoil is smooth, the drag is low and the lift excellent. The relation between the

    lift coefficient and the angle of attack is approximately linear. When α increases,

    the pressure gradient grows. Normally, at an angle of attack between 15o and 20o,

    the flow is completely detached on the upper surface. When it happens, the airfoil

    stalls.

    5.0.15 Pre-processing with α = 15o

    The following codes contain the information to simulate the case with Re = 3 ×106 using simpleFoam (steady-state solver for incompressible turbulent flow) and

    the Spalart-Allmaras turbulence model. As the current case includes new features

    and files, a general directory is going to be created with the name AirfoilCase and

    containing two files to create the mesh (without using blockMesh), as well as a

    subdirectoy containing the cases solved for different angles of attack (2DAirfoil).

    Within 2DAirfoil the names of the cases are going to be alpha0 (α = 0o), alpha5 (α =

    5o), etc. In particular, the current pre-processing section contains the instructions

    to simulate the airfoil for α = 15o (alpha15 case).

    5.0.15.1 Mesh generation

    As it happened with Chapter 3, the mesh is not going to be uniform. It is neces-

    sary to divide the mesh by regions, especially to provide a high refinement to the

    walls of the airfoil and downstream. However, in the current case, the geometry

    is more complex than a simple circular shape. Therefore, the mesh is going to be

    created with GNU Octave and Gmsh Mesh Generator. Then, it will be converted to

    OpenFOAM R©.

    The first step is to install these two softwares: GNU Octave is a high-level interpreted

    language, primarily intended for numerical computations. Gmsh Mesh Generator

    Jordi Casacuberta Puig 119

  • 5. Aerodynamics of a 2D airfoil NACA 23012

    contains 4 modules, for geometry description, meshing, solving and post-processing.

    They are both free software.

    Secondly, it is necessary to create two gedit sheets. The first is going to be named

    foilgmsh.m and contains the code shown in the Appendix, Chapter A.

    As it can be seen, this code was developed by an external author, who provided it

    selflessly. Before the instructions, it is explained how to use it and what parameters

    are necessary to define. The code can be entirely found in:

    code− saturne.org/forum/old forums files/614676387/foilgmsh.m

    Afterwards, a Script is going to be created to execute the previous code and intro-

    duce the output to Gmsh Mesh Generator. The results are going to be two new files,

    containing the created geometries and mesh. This mesh will be later converted to

    the OpenFOAM R© format. The Script must be named executeAirfoilMesher andcontains:

    1 #!/ bin /bash

    2

    3 a r ch i=”naca23012 . dat” #F i l e conta in ing the coo rd ina t e s o f the a i r f o i l ( . dat

    ex tens i on )

    4 a l f a=15

    5 yplus=100

    6 e t e r=”a”

    7 Re=3000000

    8 M=0.128

    9 T0=300

    10 N=” [100 , 40 , 30 , 30 ] ”

    11 bump=1

    12 cd /home///A i r f o i lCa s e #I f d i f f e r e n t , wr i t e how to ac c e s s

    fo i l gmsh .m

    13 octave −−s i l e n t −−eva l ” fo i l gmsh ( ’ $a r ch i ’ , $a l f a , $yplus , ’ $ e t e r ’ , $Re , $M, $T0 ,’$N ’ , $bump) ” #Executes the fo i l gmsh func t i on

    14 gmsh −3 naca23012 . dat . geo #Meshes with Gmsh Mesh Generator

    So, once the programs have been installed and the gedit sheets containing the pre-

    vious codes are ready:

    1.- Make the Script executable as it was shown in Section 4.0.11.3

    2.- Copy foilgmsh.m and executeAirfoilMesher within AirfoilCase

    3.- Copy a file with the coordinates of the airfoil (in this case the NACA 23012)

    with the extension .dat named naca23012.dat within AirfoilCase. It can be

    easily found in Internet

    Jordi Casacuberta Puig 120

  • OPENFOAM GUIDE FOR BEGINNERS

    4.- Access AirfoilCase and type in the terminal:

    ./executeAirfoilMesher

    5.- Select one of the created files (naca23012.dat.msh) and copy it inside an empty

    directory named alpha15

    6.- Copy a system folder from another case as it is necessary to convert the mesh

    to OpenFOAM R© (it does not matter what time-control setting it contains;it will be later correctly defined)

    7.- Access 2DAirfoil/alpha15

    8.- Type:

    gmshToFoam naca23012.dat.msh

    9.- The constant directory appears

    10.- Acces constant/polyMesh/boundary , change the name of the first patch (symmetry)

    to frontAndBack and define it as empty instead of patch (both, type and phys-

    icalType). Keep the second name (airfoil) but change its patch type to wall.

    Finally, change the third patch name (walls) to topAndBottom and its patch

    type to symmetryPlane instead of patch

    11.- The mesh is ready

    The mesh of the alpha15 case is:

    Jordi Casacuberta Puig 121

  • 5. Aerodynamics of a 2D airfoil NACA 23012

    Figure 5.3: Global view of the mesh of the alpha15 case

    Figure 5.4: Airfoil shape in the mesh of the alpha15 case

    Jordi Casacuberta Puig 122

  • OPENFOAM GUIDE FOR BEGINNERS

    Figure 5.5: Detail of the mesh grading at the walls of the alpha15 case

    Advice:

    The degree of refinement of the mesh and its relation to the treatment

    of the turbulent boundary layer is discussed in Section 5.0.17.2. It de-

    termines the value written in the fifth line of executeAirfoilMesher

    5.0.15.2 Boundary and initial conditions

    Besides the p and U files, as the case is set turbulent, two new files are necessary to be

    created. Their names are nut and nuTilda. These dictionaries contain the boundary

    conditions of the parameters used to implement the Spalart-Allmaras turbulence

    model. Before introducing the user to their calculation, the boundary conditions for

    p and U are:

    1 /∗−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−∗− C++ −∗−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−∗\2 | ========= | |3 | \\ / F i e l d | OpenFOAM: The Open Source CFD Toolbox |4 | \\ / O pera t i on | Vers ion : 2 . 2 . 1 |5 | \\ / A nd | Web: www.OpenFOAM. org |6 | \\/ M an ipu l a t i on | |7 \∗−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−∗/8 FoamFile

    9 {10 ve r s i on 2 . 0 ;

    11 format a s c i i ;

    12 c l a s s v o l S c a l a rF i e l d ;

    13 ob j e c t p ;

    Jordi Casacuberta Puig 123

  • 5. Aerodynamics of a 2D airfoil NACA 23012

    14 }15 // ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ //16

    17 dimensions [ 0 2 −2 0 0 0 0 ] ;18

    19 i n t e r n a l F i e l d uniform 0 ;

    20

    21 boundaryField

    22 {23 i n l e t

    24 {25 type f r e e s t r eamPre s su r e ;

    26 }27

    28 ou t l e t

    29 {30 type f r e e s t r eamPre s su r e ;

    31 }32

    33 a i r f o i l

    34 {35 type zeroGradient ;

    36 }37

    38 frontAndBack

    39 {40 type empty ;

    41 }42

    43 topAndBottom

    44 {45 type symmetryPlane ;

    46 }47 }48

    49 // ∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗ //

    1 /∗−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−∗− C++ −∗−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−∗\2 | ========= | |3 | \\ / F i e l d | OpenFOAM: The Open Source CFD Toolbox |4 | \\ / O pera t i on | Vers ion : 2 . 2 . 1 |5 | \\ / A nd | Web: www.OpenFOAM. org |6 | \\/ M an ipu l a t i on | |7 \∗−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−∗/8 FoamFile

    9 {10 ve r s i on 2 . 0 ;

    11 format a s c i i ;

    12 c l a s s vo lVec to rF i e ld ;

    13 ob j e c t U;

    14 }15 // ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ //16

    17 dimensions [ 0 1 −1 0 0 0 0 ] ;18

    19 i n t e r n a l F i e l d uniform (45 0 0) ;

    Jordi Casacuberta Puig 124

  • OPENFOAM GUIDE FOR BEGINNERS

    20

    21 boundaryField

    22 {23 i n l e t

    24 {25 type f r e e s t r eam ;

    26 f r ees t reamValue uniform (45 0 0) ;

    27 }28

    29 ou t l e t

    30 {31 type f r e e s t r eam ;

    32 f r ees t reamValue uniform (45 0 0) ;

    33 }34

    35 a i r f o i l

    36 {37 type f ixedValue ;

    38 value uniform (0 0 0) ;

    39 }40

    41 frontAndBack

    42 {43 type empty ;

    44 }45

    46 topAndBottom

    47 {48 type symmetryPlane ;

    49 }50 }51

    52 // ∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗ //

    The dictionaries for nut and nuTilda (they must be saved within 0 with these names)

    are:

    1 /∗−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−∗− C++ −∗−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−∗\2 | ========= | |3 | \\ / F i e l d | OpenFOAM: The Open Source CFD Toolbox |4 | \\ / O pera t i on | Vers ion : 2 . 2 . 1 |5 | \\ / A nd | Web: www.OpenFOAM. org |6 | \\/ M an ipu l a t i on | |7 \∗−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−∗/8 FoamFile

    9 {10 ve r s i on 2 . 0 ;

    11 format a s c i i ;

    12 c l a s s v o l S c a l a rF i e l d ;

    13 ob j e c t nut ;

    14 }15 // ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ //16

    17 dimensions [ 0 2 −1 0 0 0 0 ] ;18

    Jordi Casacuberta Puig 125

  • 5. Aerodynamics of a 2D airfoil NACA 23012

    19 i n t e r n a l F i e l d uniform 0 . 0386 ;

    20

    21 boundaryField

    22 {23 i n l e t

    24 {25 type f r e e s t r eam ;

    26 f r ees t reamValue uniform 0 . 0386 ;

    27 }28

    29 ou t l e t

    30 {31 type f r e e s t r eam ;

    32 f r ees t reamValue uniform 0 . 0386 ;

    33 }34

    35 a i r f o i l

    36 {37 type nutUSpaldingWallFunction ;

    38 value uniform 0 ;

    39 }40

    41 frontAndBack

    42 {43 type empty ;

    44 }45

    46 topAndBottom

    47 {48 type symmetryPlane ;

    49 }50 }51

    52 // ∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗ //

    1 /∗−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−∗− C++ −∗−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−∗\2 | ========= | |3 | \\ / F i e l d | OpenFOAM: The Open Source CFD Toolbox |4 | \\ / O pera t i on | Vers ion : 2 . 2 . 1 |5 | \\ / A nd | Web: www.OpenFOAM. org |6 | \\/ M an ipu l a t i on | |7 \∗−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−∗/8 FoamFile

    9 {10 ve r s i on 2 . 0 ;

    11 format a s c i i ;

    12 c l a s s v o l S c a l a rF i e l d ;

    13 ob j e c t nuTilda ;

    14 }15 // ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ //16

    17 dimensions [ 0 2 −1 0 0 0 0 ] ;18

    19 i n t e r n a l F i e l d uniform 0 . 1929 ;

    20

    21 boundaryField

    Jordi Casacuberta Puig 126

  • OPENFOAM GUIDE FOR BEGINNERS

    22 {23 i n l e t

    24 {25 type f r e e s t r eam ;

    26 f r ees t reamValue uniform 0 . 1929 ;

    27 }28

    29 ou t l e t

    30 {31 type f r e e s t r eam ;

    32 f r ees t reamValue uniform 0 . 1929 ;

    33 }34

    35 a i r f o i l

    36 {37 type f ixedValue ;

    38 value uniform 0 ;

    39 }40

    41 frontAndBack

    42 {43 type empty ;

    44 }45

    46 topAndBottom

    47 {48 type symmetryPlane ;

    49 }50 }51

    52 // ∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗ //

    νt (nut) and ν̃t (nuTilda) are parameters required to simulate the case with a turbu-

    lence model (as it was said, for this case it is used the Spalart-Allmaras one-equation

    model). Mathematically, they are determined as:

    ν̃t =

    √3

    2(|U|Il) (5.7)

    where |U| is the mean flow velocity, I is the turbulence intensity and l is the tur-bulent length scale. They can be computed as:

    I ≈ 5%

    l ≈ 0.07 · c = 0.07

    Jordi Casacuberta Puig 127

  • 5. Aerodynamics of a 2D airfoil NACA 23012

    With these assumptions, ν̃t = 0.1929. Then, a convenient option is to set ν̃t = 5νt

    in the freestream. The model then provides fully turbulent results and any regions

    like boundary layers that contain shear become fully turbulent.

    5.0.15.3 Physical properties

    1 /∗−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−∗− C++ −∗−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−∗\2 | ========= | |3 | \\ / F i e l d | OpenFOAM: The Open Source CFD Toolbox |4 | \\ / O pera t i on | Vers ion : 2 . 2 . 1 |5 | \\ / A nd | Web: www.OpenFOAM. org |6 | \\/ M an ipu l a t i on | |7 \∗−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−∗/8 FoamFile

    9 {10 ve r s i on 2 . 0 ;

    11 format a s c i i ;

    12 c l a s s d i c t i ona ry ;

    13 l o c a t i o n ” constant ” ;

    14 ob j e c t t r an spo r tP rope r t i e s ;

    15 }16 // ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ //17

    18 transportModel Newtonian ;

    19

    20 rho rho [ 1 −3 0 0 0 0 0 ] 1 . 2 2 5 ;21

    22 nu nu [ 0 2 −1 0 0 0 0 ] 1 . 5 e−05;23

    24 CrossPowerLawCoeffs

    25 {26 nu0 nu0 [ 0 2 −1 0 0 0 0 ] 1e−06;27 nuInf nuInf [ 0 2 −1 0 0 0 0 ] 1e−06;28 m m [ 0 0 1 0 0 0 0 ] 1 ;

    29 n n [ 0 0 0 0 0 0 0 ] 1 ;

    30 }31

    32 BirdCarreauCoef f s

    33 {34 nu0 nu0 [ 0 2 −1 0 0 0 0 ] 1e−06;35 nuInf nuInf [ 0 2 −1 0 0 0 0 ] 1e−06;36 k k [ 0 0 1 0 0 0 0 ] 0 ;

    37 n n [ 0 0 0 0 0 0 0 ] 1 ;

    38 }39

    40 // ∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗ //

    1 /∗−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−∗− C++ −∗−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−∗\2 | ========= | |3 | \\ / F i e l d | OpenFOAM: The Open Source CFD Toolbox |4 | \\ / O pera t i on | Vers ion : 2 . 2 . 1 |5 | \\ / A nd | Web: www.OpenFOAM. org |6 | \\/ M an ipu l a t i on | |

    Jordi Casacuberta Puig 128

  • OPENFOAM GUIDE FOR BEGINNERS

    7 \∗−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−∗/8 FoamFile

    9 {10 ve r s i on 2 . 0 ;

    11 format a s c i i ;

    12 c l a s s d i c t i ona ry ;

    13 l o c a t i o n ” constant ” ;

    14 ob j e c t RASProperties ;

    15 }16 // ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ //17

    18 RASModel Spa lartAl lmaras ;

    19

    20 turbu lence on ;

    21

    22 p r i n tCoe f f s on ;

    23

    24 // ∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗ //

    5.0.15.4 Control

    1 /∗−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−∗− C++ −∗−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−∗\2 | ========= | |3 | \\ / F i e l d | OpenFOAM: The Open Source CFD Toolbox |4 | \\ / O pera t i on | Vers ion : 2 . 2 . 1 |5 | \\ / A nd | Web: www.OpenFOAM. org |6 | \\/ M an ipu l a t i on | |7 \∗−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−∗/8 FoamFile

    9 {10 ve r s i on 2 . 0 ;

    11 format a s c i i ;

    12 c l a s s d i c t i ona ry ;

    13 l o c a t i o n ” system” ;

    14 ob j e c t con t r o lD i c t ;

    15 }16 // ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ //17

    18 app l i c a t i on simpleFoam ;

    19

    20 startFrom startTime ;

    21

    22 startTime 0 ;

    23

    24 stopAt endTime ;

    25

    26 endTime 10000 ;

    27

    28 deltaT 1 ;

    29

    30 wr i teContro l t imeStep ;

    31

    32 wr i t e I n t e r v a l 100 ;

    33

    34 purgeWrite 0 ;

    Jordi Casacuberta Puig 129

  • 5. Aerodynamics of a 2D airfoil NACA 23012

    35

    36 writeFormat a s c i i ;

    37

    38 wr i t eP r e c i s i o n 7 ;

    39

    40 writeCompress ion o f f ;

    41

    42 timeFormat gene ra l ;

    43

    44 t imePrec i s i on 6 ;

    45

    46 runTimeModif iable t rue ;

    47

    48 f un c t i on s

    49 (

    50 f o r c e s

    51 {52 type f o r c e s ;

    53 func t i onObjec tL ibs ( ” l i b f o r c e s . so ” ) ;

    54 patches ( a i r f o i l ) ;

    55 pName p ;

    56 UName U;

    57 rhoName rho In f ;

    58 rho In f 1 . 2 2 5 ;

    59 CofR (0 .2704 −0.0012 4 .0128) ;60 outputControl t imeStep ;

    61 output In t e rva l 100 ;

    62 }63 f o r c eCo e f f s

    64 {65 type f o r c eCo e f f s ;

    66 func t i onObjec tL ibs ( ” l i b f o r c e s . so ” ) ;

    67 patches ( a i r f o i l ) ;

    68 pName p ;

    69 UName U;

    70 rhoName rho In f ;

    71 rho In f 1 . 2 2 5 ;

    72 CofR (0 .2704 −0.0012 4 .0128) ;73 l i f t D i r (0 1 0) ;

    74 dragDir (1 0 0) ;

    75 pi tchAxi s (0 0 1) ;

    76 magUInf 45 ; //

    77 lRe f 1 ; //

    78 Aref 0 . 1 ; //

    79 outputControl t imeStep ;

    80 output In t e rva l 100 ;

    81 }82 ) ;

    83

    84 // ∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗ //

    5.0.15.5 Discretization and linear-solver settings

    1 /∗−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−∗− C++ −∗−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−∗\2 | ========= | |

    Jordi Casacuberta Puig 130

  • OPENFOAM GUIDE FOR BEGINNERS

    3 | \\ / F i e l d | OpenFOAM: The Open Source CFD Toolbox |4 | \\ / O pera t i on | Vers ion : 2 . 2 . 1 |5 | \\ / A nd | Web: www.OpenFOAM. org |6 | \\/ M an ipu l a t i on | |7 \∗−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−∗/8 FoamFile

    9 {10 ve r s i on 2 . 0 ;

    11 format a s c i i ;

    12 c l a s s d i c t i ona ry ;

    13 l o c a t i o n ” system” ;

    14 ob j e c t fvSchemes ;

    15 }16 // ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ //17

    18 ddtSchemes

    19 {20 de f au l t s t eadyState ;

    21 }22

    23 gradSchemes

    24 {25 de f au l t Gauss l i n e a r ;

    26 grad (p) Gauss l i n e a r ;

    27 grad (U) Gauss l i n e a r ;

    28 }29

    30 divSchemes

    31 {32 de f au l t none ;

    33 div ( phi ,U) Gauss l inearUpwind grad (U) ;

    34 div ( phi , nuTilda ) Gauss l inearUpwind grad ( nuTilda ) ;

    35 div ( ( nuEff∗dev (T( grad (U) ) ) ) ) Gauss l i n e a r ;36 }37 l ap lac ianSchemes

    38 {39 de f au l t none ;

    40 l a p l a c i a n ( nuEff ,U) Gauss l i n e a r co r r e c t ed ;

    41 l a p l a c i a n ( ( 1 |A(U) ) ,p) Gauss l i n e a r co r r e c t ed ;42 l a p l a c i a n ( DnuTildaEff , nuTilda ) Gauss l i n e a r co r r e c t ed ;

    43 l a p l a c i a n (1 , p) Gauss l i n e a r co r r e c t ed ;

    44 }45 i n t e rpo la t i onSchemes

    46 {47 de f au l t l i n e a r ;

    48 i n t e r p o l a t e (U) l i n e a r ;

    49 }50

    51 snGradSchemes

    52 {53 de f au l t c o r r e c t ed ;

    54 }55

    56 f luxRequ i red

    57 {58 de f au l t no ;

    59 p ;

    Jordi Casacuberta Puig 131

  • 5. Aerodynamics of a 2D airfoil NACA 23012

    60 }61

    62 // ∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗ //

    1 /∗−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−∗− C++ −∗−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−∗\2 | ========= | |3 | \\ / F i e l d | OpenFOAM: The Open Source CFD Toolbox |4 | \\ / O pera t i on | Vers ion : 2 . 2 . 1 |5 | \\ / A nd | Web: www.OpenFOAM. org |6 | \\/ M an ipu l a t i on | |7 \∗−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−∗/8 FoamFile

    9 {10 ve r s i on 2 . 0 ;

    11 format a s c i i ;

    12 c l a s s d i c t i ona ry ;

    13 l o c a t i o n ” system” ;

    14 ob j e c t f vSo lu t i on ;

    15 }16 // ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ //17

    18 s o l v e r s

    19 {20 p

    21 {22 s o l v e r GAMG;

    23 t o l e r an c e 1e−06;24 r e lTo l 0 . 1 ;

    25 smoother GaussSe ide l ;

    26 nPreSweeps 0 ;

    27 nPostSweeps 2 ;

    28 cacheAgglomeration true ;

    29 nCe l l s InCoar s e s tLeve l 10 ;

    30 agglomerator faceAreaPai r ;

    31 mergeLevels 1 ;

    32 }33

    34 U

    35 {36 s o l v e r smoothSolver ;

    37 smoother GaussSe ide l ;

    38 nSweeps 2 ;

    39 t o l e r an c e 1e−08;40 r e lTo l 0 . 1 ;

    41 }42

    43 nuTilda

    44 {45 s o l v e r smoothSolver ;

    46 smoother GaussSe ide l ;

    47 nSweeps 2 ;

    48 t o l e r an c e 1e−08;49 r e lTo l 0 . 1 ;

    50 }51 }52

    Jordi Casacuberta Puig 132

  • OPENFOAM GUIDE FOR BEGINNERS

    53 SIMPLE

    54 {55 nCorrector s 1 ;

    56 nNonOrthogonalCorrectors 2 ;

    57 pRefCel l 0 ;

    58 pRefValue 0 ;

    59 r e s i dua lCon t r o l

    60 {61 p 1e−5;62 U 1e−5;63 nuTilda 1e−5;64 }65 }66 r e l axa t i onFac t o r s

    67 {68

    69 f i e l d s

    70 {71 p 0 . 3 ;

    72 }73 equat ions

    74 {75 U 0 . 7 ;

    76 nuTilda 0 . 7 ;

    77 }78 }79

    80 // ∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗ //

    At the end of the pre-processing, the structure of directories, subdirectories and files

    within alpha15 should be as follows:

    Jordi Casacuberta Puig 133

  • 5. Aerodynamics of a 2D airfoil NACA 23012

    alpha15

    0

    p

    U

    νt

    ν̃t

    constant

    polyMesh

    transportProperties

    RASProperties

    system

    controlDict

    fvSchemes

    fvSolutions

    naca23012.dat.msh

    5.0.16 Post-processing

    5.0.16.1 Results of the simulation for α = 15o

    The velocity field:

    Figure 5.6: Velocity field around the NACA 23012 at α = 15o (m/s)

    The pressure field:

    Jordi Casacuberta Puig 134

  • OPENFOAM GUIDE FOR BEGINNERS

    Figure 5.7: Pressure field around the NACA 23012 at α = 15o (m2/s2)

    The streamlines around the airfoil:

    Figure 5.8: Streamlines around the NACA 23012 at α = 15o (m/s)

    It is possible to observe that at α = 15o the flow has started to detach due to the

    strong pressure gradient on the upper surface. However, 15o is not the maximum

    angle of attack (αstall) because the fluid is not fully detached and therefore stall has

    not yet happened.

    The vector field at the trailing edge (to appreciate the boundary layer detachment):

    Jordi Casacuberta Puig 135

  • 5. Aerodynamics of a 2D airfoil NACA 23012

    Figure 5.9: Velocity vectors around the NACA 23012 at α = 15o (m/s)

    The distribution of ν̃t in the domain:

    Figure 5.10: Distribution of ν̃t in the domain of the alpha15 case

    As it was explained in Chapter 3, the plot of the aerodynamic forces in front of

    the time gives information about the convergence of the case. In Figure 5.11 it is

    represented the lift coefficient:

    Jordi Casacuberta Puig 136

  • OPENFOAM GUIDE FOR BEGINNERS

    Figure 5.11: Evolution of the lift coefficient (ordinate axis) with the time (abscissaaxis) in the alpha15 case

    As it can be seen, the case has converged rapidly.

    5.0.16.2 Results of the simulation for a range of α. Plot of the main

    aerodynamic curves

    To simulate the NACA 23012 for different configurations (according to α), it is nec-

    essary to change this parameter before meshing. It has to be done in the parameter

    definition within executeAirfoilMesher . At the fourth line of the Script, the user can

    write the angle of attack (in degrees) at which the simulation will be carried out.

    Caution:

    For α > 15o, as the flow detaches, there are unsteady phenomena. Thus,

    simpleFoam would not be the appropriate solver for these cases

    Caution:

    Although the angle of attack changes from one case to the other, the

    velocity boundary conditions have to be set equal for all cases. This is

    because the flow velocity is not modified, but the geometric characteris-

    tics of the airfoil shape in the mesh

    Some representative results of the behaviour of the NACA 23012 for different con-

    figurations are:

    Jordi Casacuberta Puig 137

  • 5. Aerodynamics of a 2D airfoil NACA 23012

    Figure 5.12: Behaviour of the flow around the NACA 23012 at α = 0o (m/s)

    Figure 5.13: Behaviour of the flow around the NACA 23012 at α = 10o (m/s)

    Jordi Casacuberta Puig 138

  • OPENFOAM GUIDE FOR BEGINNERS

    Figure 5.14: Behaviour of the flow around the NACA 23012 at α = 20o (m/s)

    By using these simulations, the main aerodynamic curves have been plot (in a range

    between −10o and 15o with intervals of 5o). It can be done by copying the Cland Cd obtained with the simulations and plot their relation using Gnuplot and the

    instructions shown in Section 3.6.3. The curves are:

    Figure 5.15: Relation between Cl (ordinate axis) and α (abscissa axis) for the NACA23012

    Jordi Casacuberta Puig 139

  • 5. Aerodynamics of a 2D airfoil NACA 23012

    Figure 5.16: Relation between Cl (ordinate axis) and Cd (abscissa axis), polar curve,for the NACA 23012

    It can be seen that for near zero angles of attack, the relation between Cl and α is

    linear. However, it is shown that this trend starts to stabilize when high values of

    |α| are achieved due to the boundary layer detachment.

    5.0.17 Additional utilities

    5.0.17.1 Mesh conversion

    The user can generate meshes using other packages and convert them into the format

    that OpenFOAM R© uses. This has been done in Section 5.0.15.1 to convert a meshexported from Gmsh Mesh Generator by typing:

    gmshToFoam

    Furthermore, it is possible to convert meshes exported from other packages using

    instructions such as:

    ansysToFoam

    fluentMeshToFoam

    Jordi Casacuberta Puig 140

  • OPENFOAM GUIDE FOR BEGINNERS

    5.0.17.2 Computation of y+

    y+ is the dimensionless wall distance for a wall-bounded flow. It can be expressed

    as:

    y+ =u?y

    ν(5.8)

    where u? is the friction velocity

    (u? ≡

    √τwρ

    ), y is the distance to the nearest wall

    and ν is the kinematic viscosity of the fluid. y+ is commonly used in boundary layer

    theory and in defining the law of the wall.

    y+ plays a relevant role in the treatment of the boundary layer. The subdivision

    of the near-wall region in a turbulent boundary layer can be summarized as follows

    (Fluent, 2005 ):

    • y+ < 5: viscous sublayer region (velocity profile is assumed to be laminar andviscous stress dominates the wall shear)

    • 5 < y+ < 30: buffer region (both viscous and turbulent shear dominate)

    • 30 < y+ < 300: fully turbulent portion or log-law region (turbulent shearpredominates)

    In the alpha15 case, a wall function has been used to model the behaviour of the

    boundary layer. To use a wall function approach for a particular turbulence model

    with confidence, it is necessary to ensure that the y+ values are within a certain

    range. As in the current case a RAS model has been implemented, it is necessary

    to guarantee that the first node of the mesh falls within the log-law region. It is to

    ensure that 30 < y+ < 300.

    Caution:

    In addition to the concern about having a mesh with y+ values that are

    too large, it is necessary to be aware that if the y+ is too low then the

    first calculation point will be placed in the viscous sublayer region and

    the wall function will also be outside its validity

    Caution:

    If an attached flow is modeled, then generally a wall function approach

    can be used. If flow separation is expected and the accurate prediction

    Jordi Casacuberta Puig 141

  • 5. Aerodynamics of a 2D airfoil NACA 23012

    of the separation point will have an impact on the results then it would

    be advisable to resolve the boundary layer with a finer mesh

    OpenFOAM R© presents a utility to calculate and report y+ for all the wall patches.Note that as it depends on the local Reynolds number, it can only be obtained in

    the post-processing. Consequently only approximate values can be estimated when

    meshing.

    As in the current case a RAS turbulence model has been used, the instruction

    (written in the terminal) to obtain y+ is:

    yPlusRAS

    To view the results with ParaView it is necessary to select the yPlus box located

    within Volume Fields, choose the time at which the results will be consulted and

    select the wall patch (airfoil). The results:

    Figure 5.17: Distribution of y+ at the wall of the airfoil in the alpha15 case att = 10000 s

    Note that there are some regions where y+ is not within the required range. As it

    can be seen, it is basically located in the region of boundary layer detachment. In

    these regions the wall function approach would be out of its validity.

    Jordi Casacuberta Puig 142

  • OPENFOAM GUIDE FOR BEGINNERS

    5.0.17.3 Isobars around a body

    In this section it is explained how to create a contour plot across a plane. It will be

    used to plot the isobars around the NACA 23012 at α = 15o.

    First of all the user has to launch ParaView, click on internalMesh and select the

    pressure field. Then, with the alpha15.OpenFOAM module highlighted, go to Filters

    -> Alphabetical -> Slice. The Slice filter allows the user to specify a cutting plane

    making the case truly two-dimensional. For the current case click on Z Normal so the

    plane will cut the domain in the adequate direction. Afterwards, select the Slice1

    module and go to Filters -> Alphabetical -> Contour.

    To appreciate the isobars, select the Slice1 and Contour1 modules while keeping

    alpha15.OpenFOAM deselected. In the Properties menu of the Contour module, select

    the pressure field in the Contour By option and in the Isosurface panel click on New

    Range. Make sure that the From and To values coincide with the maximum and

    minimum of the legend and set the Steps option to 25. Finally, go to the Display

    menu and in the Color panel choose Solid Color in Color by instead of the pressure.

    Choose a color of your choice to represent the isobars. The results are then:

    Figure 5.18: Isobars around the NACA 23012 at the alpha15 case at t = 10000 s(m2/s2)

    5.0.17.4 Tube-like streamlines

    In Section 2.6.2 it was shown how to plot the streamlines. Additionally, in the cur-

    rent section it is explained how to represent tube-like streamlines. It may add more

    Jordi Casacuberta Puig 143

  • 5. Aerodynamics of a 2D airfoil NACA 23012

    realism to the simulation or simply a different way of representing the streamlines.

    The differences between both configurations can be observed in the following figures:

    Figure 5.19: Streamlines around the NACA 23012 at the alpha15 case at t = 10000s (m/s)

    Figure 5.20: Tube-like streamlines around the NACA 23012 at the alpha15 case att = 10000 s (m/s)

    To obtain a configuration like Figure 5.20 it is first necessary to plot the streamlines

    as it was shown in Section 2.6.2. In the current case, Number of Points has been set

    to 3000 and Radius to 2. Once it is generated, it is necessary to select the module of

    the streamlines and go to Filters -> Alphabetical -> Tube. Finally, the thickness of

    the tube-like streamlines can be adjusted by changing the Radius option. In Figure

    5.20 this parameter has been set to 0.01.

    Jordi Casacuberta Puig 144