Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

Meshing using SALOME

Original by Otto Jõeleht


August 2017

Introduction
Following tutorial is composed using OpenFOAM-4.1 and OpenFOAM-4.x. For
viewing the results and for post-processing Paraview-5.0.1 is used. In creation
of object and the mesh SALOME-8.2.0 was used.

The tutorial’s goal is to:


• create car-shaped 3D object

• Mesh it using SALOME application


• run a simulation
• see the results using Paraview

Meshing
First we need to create a car. In order to create 3D objects there are many
different application, but it is important to keep in mind that the file you’re
importing is in BREP, STEP, IGES, STL or XAO format. In this tutorial we
are using SALOME application in order to create our object, because we will
mesh the object using the same application. You can download the application
and fin the installation guide can be found here:
http://www.salome-platform.org/downloads/current-version

If you have experience in creating 3D objects, then you can just import the
car’s object using (File → Import).

If you don’t have any experience in creation of 3D models, then you can create
a new car model by making use of 2 boxes: (New Entity → Primitives → Box).

1
The box below can be made using size measures (1). The box on the top needs
to be made using two points (New Entity → Point), points are divided into
diagonals (2).

Now you need to create a Background Mesh around the car. It is again made
by using a box made by making use of two points. Note that, in order for the-
re should be some space behind the car and below the car’s bottom side and
car’s base (If car is located at z = 0, then the background mesh box should be
z = −0.2).

Next you need to cut the car out of the box (Operations → Boolean → Cut). If
the cutting process fails (for more complicated cars), then you should increase
the tolerance limit (Repair → Limit tolerance).

2
Now you need to name different parts of the car. The names should be as follow:
• The input hole (inlet)
• The output hole (outlet)

• Roof (top)
• Bottom (bottom)
• Two sides (sides)
• The body of the car (autoKeha) - name it like this because another script
later has coded it in using this name.
To do that you need to right click on the cut and select Create Group, and then
type the parts (except the carBody) in, in the numbered order.

3
The car body can be added as follow. Select ”Select All”, and from the menu
on the left and then select all recently added parts. After that click ”Remove”.

Next you need to change ”Geometry”to ”Meshüsing a menu on the top.


Now you need to create a Mesh using your cut pieces (Mesh → Create Mesh).
If the user can make use of some cluster, then you can use the parameters
in the parentheses in order to create a more thick Mesh. https://en.
wikipedia.org/wiki/Computer cluster
The mesh is a Tetrahderal, 3D algorithm is NETGEN 3D, next to Hypothesis
selection click on gear wheel icon and select NETGEN 3D Parameters.

4
If an error appears on the missing libgfortran package, then it is often
resolved by installing libgfortran3:i386 or libgfortran3. On Ubuntu 16.04
write following to the terminal: ”sudo apt-get install libgfortran3”.
In the opened window choose Fineness: Custom and Growth Rate change to 0.01
(0.005, and Max. Size 0.5 and Min. Size 0.1 (those are if you’re on a cluster)).
In she submenu ”2D”choose NETGEN 1D-2D algorithm and NETGEN 2D. For
Parameters hypothesis change Growth Rate to 0.01 (0.005, and Max. Size 0.5
and Min. Size 0.1) then change Nb. Segs per Edge to 6 (or 8 if on cluster), Nb.
Segs per Radius change to 8 (or 10). Then click on Apply and Close.

In the left menu, right-click on your just made Mesh and select ”Compute”.
This procedure is needed in oder to even display the Mesh.

If you get a warning, that the Meshi could not be displayed, because Mesh
Size exceeds current limit, then the limit can be changed as follows: File
→ Preferences → General → Automatic Update Size limit.
Now you need to right-click on your mesh on the left menu and choose Create
Groups from Geometry. Now choose all your Mesh pieces under Elements and
Nodes.

5
Now you have made a car Mesh together with a Background Mesh. Now you
need to export it. In order to do that right-click on the mesh and select Export
→ UNV file.

Running the simulation


Now you need to set up OpenFOAM simulation folder. You can download the
main folder from: https://gitlab.com/otto96/iseAuto
If you can run the simulations on a cluster, then you can continue with
”iseAutoKLASTER”folder.
In the folder is a ÄllrunKaust”, constant and system folders, Allclean ja Allrun
scripts (for working with a cluster there’s also a SLURM job submission script).
Lets call this folder ”Main folder”. You need to put your exported UNV file into
the main folder.

Next you have to copy 0 folder from AllrunKaust into the main folder. If you
named Mesh parts as in the tutorial, then you don’t have to change anything
in the folder, if not then you have to change each file in 0 folder - change the
parts under BoundaryFields accordingly.

6
In 0 folder initial conditions are described. In each file there is a dimen-

sions” field. This field corresponds to the international SI units system [kg
m s K mol A cd]. In the file ”p”describes the placement of pressure, U is
the movement of air, k and omega corresponed to k-omega turbulence model
(https://en.wikipedia.org/wiki/K%E2%80%93omega turbulence model).

In Constant folder turbulence settings and transport settings. In transport set-


tings it is written that you’re dealing with the air which comes in from the inlet.
In turbulence settings is described that we are dealing with laminar flow. If we
change simulation type to RAS, then we get the model using k-omega turbu-
lence model. In the Constant folder we will also have ”polyMesh”folder, which
describes the mesh we created earlier.

In the system folder there is controlDict (description of simulations duration,


the step length of the simulation and printouts parameters), decomposeParDict
(described the mesh distribution when using parallel computing), fvSchemes
(numerical computation conditions, which are calculated during the simulation)
and fvSolution (where are equations calculations, tolerance and algorithms op-
tions).

Next you need to open a terminal and move to the main folder. Now you first
need to run a command ideasUnvToFoam auto1.unv”. with that command you

create a mesh for OpenFOAM application. Secondly you need to prepare the
parallel computation. For that open the decomposeParDict.
NumberOfSubdomains is the number of cores to use (default 2), method
describes the distribution method, simpleCoeffs describes the method
parameters. NB! When n(x y z) then x*y*z=numberOfSubdomains.
Run command decomposePar”, which gives each processor its own part to

calculate (folders will appear - processor0...processorN). Now you can run the
simulation using command mpirun -np 2 pimpleFoam -parallel”, where 2 is the

number of cores to use.

After the end of the simulation you need to run command reconstructPar”,

which adds up different calculations from different cores. Simulation is now
finished and ready for visualisation. The folders with numbers are different ti-
mesteps when the simulation output was written.

In order to display the output use command paraFoam”. In the window click

Apply in the left menu. Now choose option Slice.

7
In the left under Properties untick Show Plane checkbox, and click on button
Y Normal. After that Apply. Turn the slice so you could see it. From the top,
most leftmost menu choose parameter U to be displayed, now by controlling the
time you can see the wind resistance in time to your car.
https://youtu.be/ Uf QPUMg U

Cutting your Mesh in Z Normal direction, you can see cross section of the wind
resistance.

Outputs from decomposeParDicti and simulation


solution speed relation
iseAuto
Used processor:
• AMD Turion X2 Dual-Core Mobile RM-74 @ 2.2 GHz (2 threadi)
2 second simulation with one thread:
ExecutionTime=257.73 s
2 s simulation with two threads, simple method (2 1 1):
ExecutionTime=116.82 s
2 s simulation with two threads, simple method (1 2 1):
ExecutionTime=127.11 s
2 s simulation with two threads, simple method (1 1 2):
ExecutionTime=130.59 s

Used processor:

8
• Intel Xeon Processor E5-2660 v2 @ 2.2 GHz (20 threadi)
2 second simulation with one thread:
ExecutionTime=55.83 s
2 s simulation with two threads, simple method (2 1 1):
ExecutionTime=57.93 s
2 s simulation with two threads, simple method (1 2 1):
ExecutionTime=62.51 s
2 s simulation with two threads, simple method (1 1 2):
ExecutionTime=63.96 s

iseAutoKLASTER
Processor:
• Intel Xeon Processor E5-2660 v2 @ 2.2 GHz (20 threadi)

2 s simulation 100 threads, simple method (10 5 2):


ExecutionTime = 3981.54 s
2 s simulation 100 threads, simple method (100 1 1):
ExecutionTime = 3798 s
2 s simulation 400 threads, simple method (400 1 1):
ExecutionTime = 1878.37 s

Differences between iseAuto and iseAutoKLAS-


TER Meshi.
Like we can see from previous chapter then there are substantial differences be-
tween calculating the simulation. For iseAuto mesh you need to calculate 10 905
cells, for iseAutoKLASTER mesh you need 1 453 513 cells. Such a difference is
seen in the results as well.

9
Strong Scaling in iseAutoKLASTER
In High Performance Computing different number of Sub-Domains are used to
make use of Strong Scaling (using different amount of memory is called weak
scaling). Calculating Strong Scaling works as the following:
• t1 is one Sub-Domain’s calculation time

• N i the count of Sub-Domains


• tN is N the speed it takes with n Sub-Domains
t1
· 100%
N · tN
In this case the Strong Scaling is the following: (simple method (n 1 1))
t1 = 267962s
Sub-Domain count Calculation time Efficiency
400 1878.37 s 35,7%
200 1907.45 s 70,2%
100 3798 s 70,6%
50 11045.1 s 48.5%
25 19636.1 s 54,6%

10

You might also like