Professional Documents
Culture Documents
Submitted by
Dr Ravichandran K S
100 Feet Ring Road, BSK III Stage, Bangalore - 560 085. Tel : 26721983
CERTIFICATE
(Examiner 1) (Examiner 2)
Currently there are many CFD software packages available in the market.
But most of them are costly because of their license fees. Also the
commercial CFD codes cannot be modified to suit the user‘s needs. For
those who want to develop their own code this is not helpful as there is
less scope for learning here.
To tackle this problem OpenSource Softwares came into play. One such
CFD software is OpenFOAM. It is written in C++ language for Linux
Operating System developed by OpenCFD Ltd.
We would like to thank Dr Ravichandran K S for his time and support and
suggestions without which the successful completion of this project would
not have been possible.
1.2 OpenFOAM
OpenFOAM stands for Open Source Field Operation and
Manipulation. It is written in C++ for the Linux Operating system. It is
developed by OpenCFD Ltd. It has a large user base across most areas of
This tutorial provides a short step by step guide to calculating the flow
around an airfoil using the OpenFOAM package. It introduces the
important features of OpenFOAM. The author uses NACA 5012 airfoil for
this illustration. Meshing is done using gmsh. It is then converted to
FOAM mesh. The necessary boundary conditions are set up in the
respective text files. The system directories are suitably altered. The
solver used is simpleFoam.
Once the solution converges, the next step is post-processing. The post-
processor used here is ParaView. The pressure and velocity contours are
obtained. This tutorial introduces us to OpenFOAM environment. We get
to learn the basic functions of OpenFOAM.
PROJECT DETAILS
3.1 OpenFOAM
The next screen allows the user to select the memory (RAM) that your
host system (Windows) will allow the guest system (Ubuntu) to use. It is
not critical to select the optimal value now, because it can be modified
later, but the user should try to choose something that balances the
demands of both the host and guest system. Ideally, a value of 1.5 GB or
above is recommended for the VM otherwise it may run too slowly. In the
next Virtual Hard Disk menu, the user should use the default options
(Boot Hard Disk and Create new hard disk). Click Next.
-In the Ubuntu VM, create a new OpenFOAM directory, e.g. by opening a
terminal window (Applications->Accessories->Terminal) and typing:
mkdir $HOME/OpenFOAM
and adding the user name to the vboxsf group, e.g. for user ubuntu the
group entry might look like
vboxsf:x:1001:ubuntu
For more information about shared folder access, see the following How-
To page (http://www.ubuntugeek.com/how-to-access-windows-host-
shared-folders-from-ubuntu-guest-in-virtualbox.html).
Installation Problems
The .deb files for different versions of Ubuntu supplied can be downloaded
directly from the following locations:
http://www.openfoam.org/download/ubuntu/dists/quantal/main/binary-
amd64/openfoam220_0-1_amd64.deb
http://www.openfoam.org/download/ubuntu/dists/quantal/main/binary-
i386/openfoam220_0-1_i386.deb
http://www.openfoam.org/download/ubuntu/dists/precise/main/binary-
amd64/openfoam220_0-1_amd64.deb
http://www.openfoam.org/download/ubuntu/dists/precise/main/binary-
User Configuration
1. Open the .bashrc file in the user‘s home directory in an editor, e.g.
by typing in a terminal window (note the dot)
gedit ~/.bashrc
2. At the bottom of that file, add the following line (see Note 1) and
save the file
source /opt/openfoam220/etc/bashrc
Note 1: If a similar line has already been added to the user‘s .bashrc file,
e.g. for a previous version of OpenFOAM, then the line should be deleted
or, alternatively, commented out by inserting a # at the beginning of the
line.
Note 2: If a user wishes to execute icoFoam in the same terminal
Getting Started
cp -r $FOAM_TUTORIALS $FOAM_RUN
cd $FOAM_RUN/tutorials/incompressible/icoFoam/cavity
blockMesh
icoFoam
paraFoam
solvers
that are each designed to solve a specific problem in computational
continuum mechanics;
utilities
that perform simple pre-and post-processing tasks, mainly involving
data manipulation and algebraic calculations.
Incompressible flow
boundaryFoam Steady-state solver for
incompressible, 1D turbulent
flow, typically to generate
boundary layer conditions at an
inlet, for use in a simulation
channelFoam Incompressible LES solver for
flow in a channel
icoFoam Transient solver for
incompressible, laminar flow of
Compressible flow
rhoCentralFoam Density-based compressible flow
solver based on central-upwind
schemes of Kurganov and
Tadmor
rhoCentralDyMFoam Density-based compressible flow
solver based on central-upwind
schemes of Kurganov and
Tadmor with moving mesh
capability and turbulence
modelling
rhoSimplecFoam Steady-state SIMPLEC solver for
laminar or turbulent RANS flow of
compressible fluids
rhoSimpleFoam Steady-state SIMPLE solver for
laminar or turbulent RANS flow of
compressible fluids
sonicFoam Transient solver for trans-
sonic/supersonic, laminar or
turbulent flow of a compressible
gas
Electromagnetics
electrostaticFoam Solver for electrostatics
magneticFoam Solver for the magnetic field
generated by permanent
magnets
mhdFoam Solver for
magnetohydrodynamics (MHD):
incompressible, laminar flow of a
conducting fluid under the
influence of a magnetic field
Finance
financialFoam Solves the Black-Scholes
equation to price commodities
Mesh generation
blockMesh A multi-block mesh generator
Extrude mesh from existing patch (by default outwards
extrudeMesh facing
normals; optional flips faces) or from patch read from file.
Mesh conversion
ansysToFoam Converts an ANSYS input mesh file, exported from I-DEAS,
to OpenFOAM format
cfx4ToFoam Converts a CFX 4 mesh to OpenFOAM format
fluent3DMeshToFoam Converts a Fluent mesh to OpenFOAM format
fluentMeshToFoam Converts a Fluent mesh to OpenFOAM format including mul-
tiple region and region boundary handling
foamMeshToFluent Writes out the OpenFOAM mesh in Fluent mesh format
gambitToFoam Converts a GAMBIT mesh to OpenFOAM format
gmshToFoam Reads .msh file as written by Gmsh
Mesh manipulation
attachMesh Attach topologically detached mesh using prescribed mesh
modifiers
checkMesh Checks validity of a mesh
mergeMeshes Merge two meshes
refineMesh Utility to refine cells in multiple directions
Post-processing at
walls
wallGradU Calculates and writes the gradient of U at the wall
wallShearStress Calculates and writes the wall shear stress, for the specified
times
Calculates and reports yPlus for all wall patches, for the
yPlusLES spec-
ified times
Calculates and reports yPlus for all wall patches, for the
yPlusRAS spec-
ified times when using RAS turbulence models
A constant directory
that contains a full description of the case mesh in a
subdirectory polyMesh and files specifying physical properties for the
application concerned, e.g.transportProperties.
A system directory
containing individual files of data for particular fields. The data can be:
either, initial values and boundary conditions that the user must specify to
define the problem; or, results written to file by OpenFOAM. Note that the
OpenFOAM fields must always be initialised, even when the solution does
not strictly require it, as in steady-state problems. It is sufficient to say now
that since we usually start our simulations at time t =0, the initial conditions
are usually stored in a directory named 0 or 0.000000e+00, depending on
the name format specified. For example, in the cavity tutorial, the velocity
field U and pressure field p are initialised from
files 0/U and 0/p respectively.
The main post-processing tool provided with OpenFOAM is a reader module to run
with ParaView, an open-source, visualization application. The module is compiled
into 2 libraries, PV3FoamReader and vtkPV3Foam using version 3.10.1 of
ParaView supplied with the OpenFOAM release (PVFoamReader and vtkFoam in
ParaView version 2.x). It is recommended that this version of ParaView is used,
although it is possible that the latest binary release of the software will run
adequately. Further details about ParaView can be found at
http://www.paraview.org and further documentation is available at
http://www.kitware.com/products/paraviewguide.html.
ParaView uses the Visualisation Toolkit (VTK) as its data processing and rendering
engine and can therefore read any data in VTK format. OpenFOAM includes the
foamToVTK utility to convert data from its native format to VTK format, which
means that any VTK-based graphics tools can be used to post-process OpenFOAM
cases. This provides an alternative means for using ParaView with OpenFOAM. For
users who wish to experiment with advanced, parallel visualisation, there is also
In summary, we recommend the reader module for ParaView as the primary post-
processing tool for OpenFOAM. Alternatively OpenFOAM data can be converted
into VTK format to be read by ParaView or any other VTK -based graphics tools.
paraFoam is strictly a script that launches ParaView using the reader module
supplied with OpenFOAM. It is executed like any of the OpenFOAM utilities either
by the single command from within the case directory or with the -case option
with the case path as an argument, e.g.:
ParaView is launched and opens the window shown in Figure 3.3.1. The case is
controlled from the left panel, which contains the following:
lists the modules opened in ParaView, where the selected modules are
highlighted in blue and the graphics for the given module can be
enabled/disabled by clicking the eye button alongside;
Properties panel
contains the input selections for the case, such as times, regions and fields;
Display panel
Information panel
ParaView operates a tree-based structure in which data can be filtered from the
top-level case module to create sets of sub-modules. For example, a contour plot
of, say, pressure could be a sub-module of the case module which contains all the
pressure data. The strength of ParaView is that the user can create a number of
sub-modules and display whichever ones they feel to create the desired image or
animation. For example, they may add some solid geometry, mesh and velocity
vectors, to a contour plot of pressure, switching any of the items on and off as
necessary.
The general operation of the system is based on the user making a selection and
then clicking the green Apply button in the Properties panel. The additional
buttons are: the Reset button which can be used to reset the GUI if necessary;
and, the Delete button that will delete the active module.
The Properties panel for the case module contains the settings for time step,
regions and fields.
The controls are described in Figure 3.3.2. It is particularly worth noting that in
the current reader module, data in all time directories are loaded into ParaView (in
the reader module for ParaView 2.x, a set of check boxes controlled the time that
were displayed).
As with any operation in paraFoam, the user must click Apply after making any
changes to any selections. The Apply button is highlighted in green to alert the
user if changes have been made but not accepted. This method of operation has
the advantage of allowing the user to make a number of selections before
accepting them, which is particularly useful in large cases where data processing
There are occasions when the case data changes on file and ParaView needs to
load the changes, e.g. when field data is written into new time directories. To load
the changes, the user should check the Update GUI button at the top of the
Properties panel and then apply the changes.
The Display panel contains the settings for visualising the data for a given case
module.
the data range may not be automatically updated to the max/min limits of a
field, so the user should take care to select Rescale to Data Range at
appropriate intervals, in particular after loading the initial case module;
clicking the Edit Color Map button, brings up a window in which there are
two panels:
1. The Color Scale panel in which the colours within the scale can be
chosen. The standard blue to red colour scale for CFD can be selected
by clicking Choose Preset and selecting Blue to Red Rainbox HSV.
2. The Color Legend panel has a toggle switch for a colour bar legend
and contains settings for the layout of the legend, e.g. font.
the underlying mesh can be represented by selecting Wireframe in the
Representation menu of the Style panel;
the geometry, e.g. a mesh (if Wireframe is selected), can be visualised as a
single colour by selecting Solid Color from the Color By menu and specifying
the colour in the Set Ambient Color window;
the image can be made translucent by editing the value in the Opacity text
box (1 = solid, 0 = invisible) in the Style panel.
ParaView duplicates functionality from pull-down menus at the top of the main
window and the major panels, within the toolbars below the main pull-down
menus. The displayed toolbars can be selected from Toolbars in the main View
menu. The default layout with all toolbars is shown in Figure 3.3.4 with each
toolbar labelled. The function of many of the buttons is clear from their icon and,
with tooltips enabled in the Help menu, the user is given a concise description of
the function of any button.
A contour plot is created by selecting Contour from the Filter menu at the top
menu bar. The filter acts on a given module so that, if the module is the 3D case
module itself, the contours will be a set of 2D surfaces that represent a constant
value, i.e. isosurfaces. The Properties panel for contours contains an Isosurfaces
list that the user can edit, most conveniently by the New Range window. The
chosen scalar field is selected from a pull down menu.
Very often a user will wish to create a contour plot across a plane rather than
producing isosurfaces. To do so, the user must first use the Slice filter to create
the cutting plane, on which the contours can be plotted. The Slice filter allows the
user to specify a cutting Plane, Box or Sphere in the Slice Type menu by a center
and normal/radius respectively. The user can manipulate the cutting plane like
any other using the mouse.
The user can then run the Contour filter on the cut plane to generate contour
lines.
Vector plots are created using the Glyph filter. The filter reads the field selected in
Vectors and offers a range of Glyph Types for which the Arrow provides a clear
vector plot images. Each glyph has a selection of graphical controls in a panel
The remainder of the Properties panel contains mainly the Scale Mode menu for
the glyphs. The most common options are Scale Mode are: Vector, where the
glyph length is proportional to the vector magnitude; and, Off where each glyph is
the same length. The Set Scale Factor parameter controls the base length of the
glyphs.
3.3.1.6 Streamlines
Streamlines are created by first creating tracer lines using the Stream Tracer
filter. The tracer Seed panel specifies a distribution of tracer points over a Line
Source or Point Cloud. The user can view the tracer source, e.g. the line, but it is
displayed in white, so they may need to change the background colour in order to
see it.
The distance the tracer travels and the length of steps the tracer takes are
specified in the text boxes in the main Stream Tracer panel. The process of
achieving desired tracer lines is largely one of trial and error in which the tracer
lines obviously appear smoother as the step length is reduced but with the
penalty of a longer calculation time.
Once the tracer lines have been created, the Tubes filter can be applied to the
Tracer module to produce high quality images. The tubes follow each tracer line
and are not strictly cylindrical but have a fixed number of sides and given radius.
When the number of sides is set above, say, 10, the tubes do however appear
cylindrical, but again this adds a computational cost.
The simplest way to output an image to file from ParaView is to select Save
Screenshot from the File menu. On selection, a window appears in which the user
This tutorial will describe how to pre-process, run and post-process a case
involving isothermal, incompressible flow in a two dimensional square domain.
The geometry is shown in Figure 3.4.1 in which all the boundaries of the square
are walls. The top wall moves in the x-direction at a speed of 1 m/s while the
other 3 are stationary. The flow will be assumed laminar and will be solved on a
uniform mesh using the icoFoam solver for laminar, isothermal, incompressible
flow.
Fig 3.4.1: The geometry of the lid driven cavity.
Mesh generation: Open the Terminal window. In preparation of editing case files
and running the first cavity case, the user should change to the case directory in
the Terminal window to:
Mesh is generated just by typing blockMesh in the Terminal window. To check the
mesh type checkMesh. The message Mesh Ok should be displayed.
To edit the mesh, the user can go to cavity/constant/polyMesh/blockMeshDict file and
edit required parameters.
Boundary Conditions: Once the mesh generation is complete, the user can look
at this initial fields set up for this case. The case is set up to start at time 0s, so
the initial field data is stored in a 0 sub-directory of the cavity directory. The 0
sub-directory contains 2 files, p and U, one for each of the pressure (p) and
velocity (U) fields whose initial values and boundary conditions must be set.
There are 3 principal entries in field data files:
dimensions:
specifies the dimensions of the field, here kinematic pressure;
internalField:
the internal field data which can be uniform, described by a single value; or
nonuniform, where all the values of the field
must be specified;
boundaryField:
the boundary field data that includes boundary conditions and data for all the
boundary patches.
For this case cavity, the boundary consists of walls only, split into 2 patches
named: (1) fixedWalls for the fixed sides and base of the cavity; (2) movingWall
for the moving top of the cavity. As walls, both are given a zeroGradient boundary
condition for p, meaning ―the normal gradient of pressure is zero‖. The
frontAndBack patch represents the front and back planes of the 2D case and
therefore must be set as empty.
In this case, as in most we encounter, the initial fields are set to be uniform. Here
the pressure is kinematic, and as an incompressible case, its absolute value is not
relevant, so is set to uniform 0 for convenience.
The user can similarly examine the velocity field in the 0/U file. The dimensions
are those expected for velocity, the internal field is initialised as uniform zero,
which in the case of velocity must be expressed by 3 vector components,
A color bar can be included by either by clicking the Toggle Color Legend Visibility
button in the Active Variable Controls toolbar, or by selecting Show Color Legend
from the View menu. Clicking the Edit Color Map button, either in the Active
Variable Controls toolbar or in the Color panel of the Display window, the user can
set a range of attributes of the color bar, such as text size, font selection and
numbering format for the scale. The color bar can be located in the image window
by drag and drop with the mouse.
Vector plots: select Glyph from the Filter->Alphabetical menu. In the resulting
Properties panel, the velocity field, U, is automatically selected in the vectors
menu, since it is the only vector field present. By default the Scale Mode for the
glyphs will be Vector Magnitude of velocity but, since we may wish to view the
velocities throughout the domain, the user should instead select off and Set Scale
Factor to 0.005. On clicking Apply, the glyphs appear but, probably as a single
color, e.g. white. The user should color the glyphs by velocity magnitude which,
as usual, is controlled by setting Color by U in the Display panel. The user should
also select Show Color Legend in Edit Color Map. The output is shown in Figure
3.4.3.
On clicking Apply the tracer is generated. The user should then select Tube from
the Filter menu to produce high quality streamline images. For the image in this
report, we used: Num. sides 6; Radius 0.0003; and, Radius factor 10. The
streamtubes are coloured by velocity magnitude. On clicking Apply the image in
Figure 3.4.4 should be produced.
This tutorial explains the basic working of OpenFOAM and paraFoam. Now we
move on to the actual project.
directory. This file contains all the coordinates of the vertices in gmsh format.
ss_lc = 0.005;
Point(1000) = { 0.99591000, 0.00228000, 0.00000000, ss_lc};
Point(1001) = { 0.98332000, 0.00530000, 0.00000000, ss_lc};
Point(1002) = { 0.96256000, 0.01018000, 0.00000000, ss_lc};
Point(1003) = { 0.93397000, 0.01672000, 0.00000000, ss_lc};
Point(1004) = { 0.89801000, 0.02463000, 0.00000000, ss_lc};
Point(1005) = { 0.85526000, 0.03361000, 0.00000000, ss_lc};
Point(1006) = { 0.80644000, 0.04331000, 0.00000000, ss_lc};
Point(1007) = { 0.75236000, 0.05339000, 0.00000000, ss_lc};
Point(1008) = { 0.69393000, 0.06349000, 0.00000000, ss_lc};
Point(1009) = { 0.63212000, 0.07325000, 0.00000000, ss_lc};
Point(1010) = { 0.56799000, 0.08233000, 0.00000000, ss_lc};
Point(1011) = { 0.50264000, 0.09037000, 0.00000000, ss_lc};
Point(1012) = { 0.43719000, 0.09706000, 0.00000000, ss_lc};
Point(1013) = { 0.37278000, 0.10208000, 0.00000000, ss_lc};
Point(1014) = { 0.31051000, 0.10521000, 0.00000000, ss_lc};
Point(1015) = { 0.25148000, 0.10627000, 0.00000000, ss_lc};
Point(1016) = { 0.19674000, 0.10519000, 0.00000000, ss_lc};
Point(1017) = { 0.14722000, 0.10201000, 0.00000000, ss_lc};
Point(1018) = { 0.10381000, 0.09684000, 0.00000000, ss_lc};
Point(1019) = { 0.06726000, 0.08992000, 0.00000000, ss_lc};
Point(1020) = { 0.03818000, 0.08151000, 0.00000000, ss_lc};
Point(1021) = { 0.01707000, 0.07189000, 0.00000000, ss_lc};
//Pressure Side
ps_lc = 0.005;
Point(1023) = { 0.01700000, 0.02808000, 0.00000000, ps_lc};
Point(1024) = { 0.03794000, 0.01835000, 0.00000000, ps_lc};
Point(1025) = { 0.06672000, 0.00963000, 0.00000000, ps_lc};
Point(1026) = { 0.10283000, 0.00209000, 0.00000000, ps_lc};
Point(1027) = { 0.14567000, -0.00415000, 0.00000000, ps_lc};
Point(1028) = { 0.19450000, -0.00902000, 0.00000000, ps_lc};
Point(1029) = { 0.24852000, -0.01252000, 0.00000000, ps_lc};
Point(1030) = { 0.30681000, -0.01473000, 0.00000000, ps_lc};
Point(1031) = { 0.36841000, -0.01581000, 0.00000000, ps_lc};
Point(1032) = { 0.43228000, -0.01596000, 0.00000000, ps_lc};
Point(1033) = { 0.49736000, -0.01537000, 0.00000000, ps_lc};
Point(1034) = { 0.56253000, -0.01428000, 0.00000000, ps_lc};
Step 3: The Vertices.DAT.geo file contains only vertices coordinates but we need
to create a control volume around the airfoil to analyze the flow. Add the following
lines to the above file.
// Put a Spline fit through the appropriate points - note that we could
// also use BSpline but you end up with a different shape
Spline(1000) = {1000:1046,1000};
Point(1100) = { 5, 4, 0, edge_lc};
Point(1101) = { 5, -4, 0, edge_lc};
Point(1102) = { -5, -4, 0, edge_lc};
Point(1103) = { -5, 4, 0, edge_lc};
Line(1) = {1100,1101};
Line(2) = {1101,1102};
Line(3) = {1102,1103};
Line(4) = {1103,1100};
//Having defined all the lines used for the geometry Spline(1000) is the aerofoil and
// Line(1) to Line(4) are the edges we now tell gmsh how they are related
Extrude {0, 0, 1} {
Surface{1};
Layers{1};
Recombine;
}
Physical Surface("back") = {1027};
Physical Surface("front") = {1};
Physical Surface("top") = {1022};
Physical Surface("exit") = {1010};
Physical Surface("bottom") = {1014};
Physical Surface("inlet") = {1018};
Physical Surface("aerofoil") = {1026};
Physical Volume("internal") = {1};
This is the final Vertices.DAT.geo file after creating spline and control volume. It
also names the boundary patches.
Step 5: Create a new directory with another name, say, NACA4412. Paste the
mesh file into this directory. Paste the 3 directories of OpenFOAM – 0, constant
and system from tutorials of OpenFOAM i.e. simpleFoam solver, into this
directory.
Step 6: The mesh has to be converted into OpenFOAM format. Open the Terminal
window and change the working directory to NACA4412.
Type gmshToFoam Vertices.DAT.msh and the mesh will be converted into OpenFOAM
format.
FoamFile
{
version 2.0;
format ascii;
class polyBoundaryMesh;
location "constant/polyMesh";
object boundary;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* //
7
(
front
{
type empty;
nFaces 202612;
startFace 302716;
}
back
{
type empty;
nFaces 202612;
startFace 505328;
}
exit
{
type patch;
nFaces 80;
startFace 707940;
}
bottom
{
type patch;
nFaces 100;
startFace 708020;
}
inlet
{
type patch;
nFaces 80;
//
*************************************************************************
//
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
inlet
{
type freestreamPressure;
}
exit
{
type freestreamPressure;
}
aerofoil
{
type zeroGradient;
}
bottom
{
type freestreamPressure;
}
front
{
type empty;
}
back
{
type empty;
}
}
// ************************************************************************* //
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
boundaryField
{
inlet
{
type freestream;
freestreamValue uniform (23.15 0 0);
}
exit
{
type freestream;
freestreamValue uniform (23.15 0 0);
}
top
{
type freestream;
bottom
{
type freestream;
freestreamValue uniform (23.15 0 0);
}
aerofoil
{
type fixedValue;
value uniform (0 0 0);
}
front
{
type empty;
}
back
{
type empty;
}
}
// ************************************************************************* //
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object nut;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -1 0 0 0 0];
boundaryField
{
inlet
{
type freestream;
freestreamValue uniform 0.14;
}
top
{
type freestream;
freestreamValue uniform 0.14;
}
bottom
{
type freestream;
freestreamValue uniform 0.14;
}
aerofoil
{
type nutUSpaldingWallFunction;
value uniform 0;
}
front
{
type empty;
}
back
{
type empty;
}
}
// ************************************************************************* //
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object nuTilda;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* //
dimensions [0 2 -1 0 0 0 0];
exit
{
type freestream;
freestreamValue uniform 0.14;
}
top
{
type freestream;
freestreamValue uniform 0.14;
}
bottom
{
type freestream;
freestreamValue uniform 0.14;
}
aerofoil
{
type fixedValue;
value uniform 0;
}
front
{
type empty;
}
back
{
type empty;
}
}
//
*************************************************************************
//
Other parameters:
In the constant/transportProperties file change rho value to 1.225 and nu to 1.46e-05.
functions
{
forces
{
type forceCoeffs;
functionObjectLibs ( "libforces.so" );
outputControl timeStep;
outputInterval 1;
patches
(
aerofoil
);
pName p;
UName U;
rhoName rhoInf;
log true;
rhoInf 1;
CofR ( 0.25 0 0 );
liftDir ( 0 1 0 );
dragDir ( 1 0 0 );
pitchAxis ( 0 0 1 );
magUInf 23.15;
lRef 1;
Aref 0.05;
}
}
Solving:
Open the Terminal window and change the working directory to NACA4412. Type
simpleFoam and the solution begins. Once the solution is converged next step is
post-processing.
Post-processing:
In the Terminal window type paraFoam. The results are viewed at the time step at
which the result converges. Pressure and velocity profiles are obtained. Velocity
vector plot colored by pressure is also obtained. Next is to obtain the surface
pressure plot and from that obtain Cp Vs x/c. Follow the below given steps.
Fig 3.4.8: Pressure variation around airfoil for 0 degrees angle of attack.
Fig 3.4.9: Velocity variation around airfoil for 0 degrees angle of attack.
This is a stator propeller section. Chord length = 0.05m, span = 0.05m. Fluid
used is air at standard atmospheric conditions at a velocity of 23.15m/s
(45knots). Reynolds number = 79660. Control volume dimensions are
0.45mx0.4mx0.05m. Rest all other parameters are same as NACA 4412 analysis.
The analysis done is same as NACA 4412 analysis.
The pressure and velocity profiles are shown below.
Pressure is in pascals and velocity in m/s.
Cp Vs x/c Cp
1
0.5
0
Cp
-1
-1.5
x/c
1 Cp Vs x/c Cp
0
0 0.2 0.4 0.6 0.8 1 1.2
Cp
-1
-2
-3 x/c
Cp vs x/c Cp
1
0.5
0
-0.5 0 0.2 0.4 0.6 0.8 1 1.2
-1
-1.5
Cp
-2
-2.5
-3
-3.5
-4
-4.5
x/c
For validation lift coefficient (Cl) and drag coefficient (Cd) are plotted for different
angles of attack. These values are compared with the experimental values. The
maximum difference is noted. Experimental results are obtained from a paper:
‗Visualization of stall characteristics of airfoils using the smoke wire technique‘ by
Wu and Tsung Ju, The University of Texas, 1992.
0 0.33356 0.38
5 0.8061 0.84
10 1.223 1.21
12 1.3568 1.32
14 1.456 1.39
15 1.50489 1.42
16 1.53021 1.45
17 1.53872 1.25
18 1.52671 1.24
0.8
0.6
0.4
0.2
0
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
alpha
Cl Cl exp
Cd vs alpha
0.2
0.15
Cd
0.1
0.05
0
0 2 4 6 8 10 12 14 16 18 20
alpha
OpenFOAM gives stall angle as 17 degrees and experiments show stall angle as 16
degrees. Comparing the above values we conclude that the OpenFOAM results and
experimental results closely match with a maximum difference of 23% in Cl after
stall. Before stall the values fairly match. Near the stall, flow separation occurs.
Spalart Allmaras turbulence model is not able to solve properly during flow
separation. Also it is not possible to simulate all experimental conditions in
software. Because of all these factors we see a difference of 23% in the values.
With this we can say that OpenFOAM works close to any other commercial CFD
0.4
0.2
0
0 2 4 6 8 10 12 14 16 18 20
alpha
1m 1.6m 2m
0.12
0.1
0.08
0.06
Cd
0.04
0.02
0
0 2 4 6 8 10 12 14 16 18 20
alpha
1m 1.6m 2m
From the above Results we can see that Cl values for different Reynolds number
are almost the same. Theoretically Cd should decrease with increase in Reynolds
number because of reduced friction. The same trend is observed in OpenFOAM
values.
With reference to the above analysis, we can say that OpenFOAM is giving fairly
good results. The results closely match the experimental results. We can say that
OpenFOAM is validated.
Further the NACA 4412 airfoil was analyzed using FLUENT. Analysis was done for
inviscid and viscous flows. The results are as tabulated below.
Cl Vs Alpha
1.8
1.6
1.4
1.2
1
Cl
0.8 cl-viscous
0.6 Cl-inviscid
0.4
0.2
0
0 5 10 15 20 25
Alpha
Fig 4.1.6: Cl vs alpha FLUENT results for viscous and inviscid flows.
As expected the Cl values for inviscid flow is greater than that for viscous flow. Cl
Vs Alpha plot follows the experimental trend and shows a linear variation before
stall.
Cl Vs Alpha
3
2.5
1.5
Cl
0.5
0
0 5 10 15 20 25 30 35
Angle of Attack
0.9
0.8
0.7
0.6
Cd
0.5
0.4
0.3
0.2
0.1
0
0 5 10 15 20 25 30 35
Alpha
Cp Vs x/c
3
2.5
1.5
Cp
0.5
0
0 0.2 0.4 0.6 0.8 1 1.2
-0.5
x/c
Alpha Cl Cd
0 0.7605 0.11267
5 1.18553 0.1424
10 1.55081 0.2132
15 1.826 0.3009
20 1.9852 0.41956
25 2.03825 0.5652
26 2.03664 0.5979
27 2.03308 0.6323
28 2.02306 0.6675
29 2.0055 0.7036
30 1.98283 0.7415
Table 4.2.2: Cl and Cd Vs Alpha
Cl Vs alpha
2.5
1.5
Cl
0.5
0
0 5 10 15 20 25 30 35
alpha
0.7
0.6
0.5
Cd
0.4
0.3
0.2
0.1
0
0 5 10 15 20 25 30 35
alpha
Cp Vs x/c
2
1.5
0.5
Cp
0
0 0.2 0.4 0.6 0.8 1 1.2
-0.5
-1
-1.5
-2
x/c
Cl vs alpha
2
1.8
1.6
1.4
1.2
1
Cl
0.8
0.6
0.4
0.2
0
0 5 10 15 20 25
alpha
0.7
0.6
0.5
0.4
Cl
0.3
0.2
0.1
0
0 5 10 15 20 25
alpha
Cp Vs x/c
1.5
0.5
0
Cp
-1
-1.5
-2
x/c
-2.5
2
1.8
1.6
1.4
1.2
1
Cl
0.8
0.6
0.4
0.2
0
0 5 10 15 20 25 30 35
Angle
0.7
0.6
0.5
Cd
0.4
0.3
0.2
0.1
0
0 5 10 15 20 25 30 35
Angle
Analysis of NACA 4412 airfoil and airfoil section for marine propeller was
done using simpleFoam solver. It can also be done using icoFoam,
pimpleFoam and other solvers.
Analysis of airfoil sections for the rotor can also be done.
A 3-dimensional propeller can be modelled by stacking up all the airfoil
sections. It can also be analyzed using OpenFOAM.
These are just some problems to be solved, but there is lot more to be
explored in OpenFOAM.