You are on page 1of 15

Open Source Scientific Software (OSSS) Group

at ResearchGate.net

Manual 1:
Using Salome-Meca,
OpenFOAM,
and ParaView
Version: 2010-05-01
Author and © :
Kai Velten (Geisenheim, Germany)

➔ This group provides a forum to introduce useful Open Source Scientific Software
(OSSS) to the community as well as a forum for mutual support and the exchange
of ideas and experiences. It is intended to cover packages such as OpenFOAM for
CFD, structural mechanics and PDE's, R for statistics and ODE's, Maxima for
computer algebra, Salome for grid generation, ParaView for postprocessing, gmesh
for CAE and CAD and so on.

➔ If you like, join our group at


http://www.researchgate.net/group/Open_Source_Scientific_Software_OSSS/
Open Source Scientific Software (OSSS) Group at ResearchGate.net

Today, OpenFOAM is the most powerful OSSS for applications such as computational fluid
dynamics (CFD), structural mechanics or general PDE's, cf. Jasak (2009), Nilsson (2006)
and a great number of other scientific papers using OpenFOAM shich you may find e.g. at
scholar.google.com.
The fastest way to get acquainted with a software like OpenFOAM is to work with
examples. The example described in the next sections is a flow problem, but almost the
same procedure can also be used when OpenFOAM is applied e.g. to problems from
structural mechanics or to general PDE problems.
Currently, only Linux versions of OpenFO
AM are provided at OpenFOAM's official website openfoam.com. In the web, you will find
some efforts to transfer OpenFOAM on other platforms, such as freefoam.sourceforge.net.
However, the simplest and most comfortable way to use OpenFOAM on arbitrary platforms
such as Windows, Mac or Linux is a system called CAELinux, see caelinux.com. We
recommend to use CAELinux "virtualized" using VirtualBox (virtualbox.org). The procedure
is described in Manual 2 in the "Files" section of the OSSS page at researchgate.net.
Once CAELinux is installed this way, the following packages are available that will be used
in the example below:
➔ Salome-Meca for the preprocessing
➔ OpenFoam to solve the PDE
➔ ParaView for the postprocessing (see paraview.org and Squillacote, 2008).
See Velten (2009) for more background on CAELinux, CFD, structural mechanics and
general PDE's.

1 Flow problem
Assume a geometry consisting of a large
cylinder with a small cylinder on top like this:
Assume that a fluid enters this volume with 1
m/s through the bottom surface of the big
cylinder, and that the fluid leaves the system
through the top surface of the small cylinder.
The resulting flow pattern will now be
computed using OpenFOAM in CAELinux
2009.

Manual 1: Using Salome-Meca, OpenFOAM, and ParaView -2 -


Open Source Scientific Software (OSSS) Group at ResearchGate.net

2 Geometry construction and mesh generation in Salome-


Meca

1. Start Salome-Meca as follows:


Applications – CAELinux – Salome-Meca

2. Choose the geometry module in the drop down list


and select "New" in the next window.

3. Choose
New Entity – Primitives – Cylinder
and make these selections:

4. Generate a second cylinder the same way, but with a radius of 0.5 (0.5 m, since SI units
are used).

Manual 1: Using Salome-Meca, OpenFOAM, and ParaView -3 -


Open Source Scientific Software (OSSS) Group at ResearchGate.net

5. Use the menu


Operations – Transformation – Translation
to translate the inner cylinder 1 m upward in the z direction:

6. Fuse the two cylinders into a single object using


Operations – Boolean – Fuse
with these settings:

Manual 1: Using Salome-Meca, OpenFOAM, and ParaView -4 -


Open Source Scientific Software (OSSS) Group at ResearchGate.net

7. Choose
New Entity – Group – Create
to define the boundaries for the fluid flow simulation.

7.1. Definition of the outlet boundary where the fluid leaves the system:

Use the
mouse to
highlight the
top surface.

Manual 1: Using Salome-Meca, OpenFOAM, and ParaView -5 -


Open Source Scientific Software (OSSS) Group at ResearchGate.net

7.2 Definition of the impermeable walls of the cylinder:

Manual 1: Using Salome-Meca, OpenFOAM, and ParaView -6 -


Open Source Scientific Software (OSSS) Group at ResearchGate.net

7.3 Definition of the inlet boundary where the fluid enters the system:

inlet

8. Start the mesh module using the drop down list from step 2 above.

Manual 1: Using Salome-Meca, OpenFOAM, and ParaView -7 -


Open Source Scientific Software (OSSS) Group at ResearchGate.net

9. Choose
Mesh – Create Mesh
and apply the following settings:

Note: Press the button in the Hypothesis line to open up the "Hypothesis Construction"
window.

10. Click on "Mesh" in the Object Browser, right click to open the context menu below, then
choose Compute (or do the same thing in the Mesh menu).

Manual 1: Using Salome-Meca, OpenFOAM, and ParaView -8 -


Open Source Scientific Software (OSSS) Group at ResearchGate.net

11. The resulting mesh looks like this:

12. To integrate the boundaries of the flow problem into the mesh file, choose
Mesh – Create Groups from Geometry
and then apply the following selections:

13. After selecting Mesh_1, export the mesh in unv-format using

Manual 1: Using Salome-Meca, OpenFOAM, and ParaView -9 -


Open Source Scientific Software (OSSS) Group at ResearchGate.net

File – Export – UNV file


which gives Mesh_1.unv

3 Solution of the flow problem in OpenFOAM

1. Close Salome_Meca and choose


Applications – CAELinux – OpenFOAM terminal
to open up a special terminal that accepts OpenFOAM commands.

2. Type
mkdir example
to generate a working directory.

3. We are going to compute incompressible, laminar flow here, which means we need
OpenFOAM's icoFoam solver. If you want to know more about this and other available
solvers, see section "3.5 Standard solvers" on page 83 in the file UserGuide.pdf which is
located in:
/home/caelinux/OpenFOAM/OpenFOAM-1.5/doc/Guides-a4
For quick access to this directory and the user guide you may start e.g. with
Places – Home Folder
in CAELinux. Several icoFoam examples can be found in
/home/caelinux/OpenFOAM/OpenFOAM-1.5/tutorials/icoFoam
We will solve our flow problem by a modification of the "cavity" example in that directory.
To do this, copy the cavity directory into the working directory, e.g. by typing something like
cp -r /home/caelinux/OpenFOAM/OpenFOAM-1.5/tutorials/icoFoam /home/caelinux/example

4. Copy Mesh_1.unv into /home/caelinux/example/cavity.

5. Within that directory, use the command


ideasUnvToFoam Mesh_1.unv
to generate a mesh in appropriate openFOAM format.

Manual 1: Using Salome-Meca, OpenFOAM, and ParaView -10 -


Open Source Scientific Software (OSSS) Group at ResearchGate.net

6. To define the pressure boundary conditions, edit the file "p" in the cavity/0 directory. An
appropriate editor is automatically invoked if you choose
Places – Home Folder
and then go to examples/cavity/0
In the "p" file, we need to change the "boundaryField". In the OpenFOAM's original cavity
example that we are editing here, the boundaryField looks like this:

"movingWall", "fixedWalls" etc. are the boundaries in OpenFOAM's original cavity


example, so we must replace these by conditions on the boundaries of our example: inlet,
outlet, and wall. We use the following settings here (which you can easily modify to solve
other flow problems):

7. Velocity Boundary conditions


are imposed by editing the "U"
file in cavity/0 similar to step 6. We use the following settings:

Manual 1: Using Salome-Meca, OpenFOAM, and ParaView -11 -


Open Source Scientific Software (OSSS) Group at ResearchGate.net

Note that we are imposing 1 m/s inflow in the positive z direction as required by the
problem described above.

8. Now the flow problem is solved by typing


icoFoam
in the OpenFOAM terminal.

Manual 1: Using Salome-Meca, OpenFOAM, and ParaView -12 -


Open Source Scientific Software (OSSS) Group at ResearchGate.net

3.1 Postprocessing in ParaView

1. Type
paraFoam
in the OpenFOAM terminal to start ParaView with the data of the flow computation. You
can read some basic facts about ParaView's structure in OpenFOAM's UserGuide.pdf (see
above). We will skip all general considerations here and just see how we can quickly
generate a meaningful plot.

2. In the "Properties" tab of the "Object Inspector", apply the following settings:

3. Use the color bar button and drop down list immediately below the File menu to color
the figure according to pressure levels:

Manual 1: Using Salome-Meca, OpenFOAM, and ParaView -13 -


Open Source Scientific Software (OSSS) Group at ResearchGate.net

After a little editing of the background color and the color bar options, this gives:

4. Now you can e.g. use


Filters – Common – Glyph
to generate an arrow plot. To see the arrow plot, first click on the top eye symbol in the
"Pipeline Browser" to hide the plot generated above, then click on "Apply" in the
"Properties" tab of the "Object Inspector" for the "Glyph1" plot. After a little editing of the
options, you may generate a plot like this:

Manual 1: Using Salome-Meca, OpenFOAM, and ParaView -14 -


Open Source Scientific Software (OSSS) Group at ResearchGate.net

5. If you want to see the arrows in the original geometry, reactivate the first plot using the
top eye symbol in the "Pipeline Browser". After a little editing of the properties of the first
plot you may arrive at something like this:

Note that the "opacity" option has been used here to make the geometry transparent.

4 References

H. Jasak, OpenFOAM: Open Source CFD in research and industry, International Journal
of Naval Architecture and Ocean Engineering, Vol 1, No 2, 89-94, 2009.
H. Nilsson, Evaluation of OpenFOAM for CFD of turbulent flow in water turbines, 23 rd IAHR
Symposium, Yokohama, Japan, 2006.
A. Squillacote, The Paraview Guide, Kitware, Inc., 2008.
K. Velten, Mathematical Modeling and Simulation, Wiley-VCH, 2009.

Manual 1: Using Salome-Meca, OpenFOAM, and ParaView -15 -

You might also like