Module 2
Module 2
Lecture 1
Module 2 - Lecture 1 1
Roadmap
Module 2 - Lecture 1 2
CFD simulation workflow
Geometry description
Mesh generation
Visualization
Module 2 - Lecture 1 3
CFD simulation workflow
GEOMETRY
MESHING
GEOMETRY
MESH
SOLVER CO-PROCESSING
PARAMETRIZATION
OPTIMIZATION
VISUALIZATION
Parametric or optimization
Module 2 -approach
Lecture 1 Simulation loop 5
CFD simulation workflow
PARALLEL ASYNCHRONOUS OR CONCURRENT DRIVER
MULTIDIMENSIONAL OR PARAMETRIC STUDY
DESIGN OF EXPERIMENTS
SENSITIVITY ANALYSIS
OPTIMIZATION STUDY
UNCERTAINTY QUANTIFICATION
ROBUST DESIGN AND OPTIMIZATION UNDER UNCERTAINTY
MULTIOBJECTIVE OPTIMIZATION
SURROGATE BASED OPTIMIZATION
AUTOMATIC POST-PROCESSING
Concurrent approach
Module 2- Simulation
Lecture 1 nested loop 6
CFD simulation workflow
This list does not enumerate all the open source applications available. It only shows those applications that I like
to use or I feel confortable with. Module 2 - Lecture 1 7
Module 2
Lecture 2
Module 2 - Lecture 2 1
Roadmap
Module 2 - Lecture 2 2
Geometry generation using open source tools
The best way to learn how to use the geometry generation tools is by doing.
Hereafter we are going to show you how to get started with the geometry
generation tools. The rest is on you.
There are many video tutorials available on internet for each specific tool, so
feel free to surf the web.
There are always many ways to accomplish a task when creating a
geometry, this give you the freedom to work in a way that is comfortable to
you. Hereafter we are going to show you our way.
There is no wrong or right way to generate a geometry. The only rule you
should keep in mind is that by the end of the day you should get a unique
clean and watertight geometry.
Remember, the quality of the mesh and hence of the solution,
greatly depends on the geometry. So always do your best when
creating the geometry.
Module 2 - Lecture 2 3
Geometry generation using open source tools
Potential geometry issues
Missing faces. Cracks.
Small faces. Gaps.
Misaligned faces. Free faces, edges, nodes.
Overlapping faces. Hard edges.
Sliver faces (high aspect-ratio). Small edges.
Repeated faces. Sharp angles.
Several surfaces connected to a single Repeated edges.
surface. High curvature NURBS.
among others
These issues must be fixed in order to create a smooth, clean, watertight body and to
prevent meshing issues
In general, when generating the geometry and by using good geometry generation
practices, we should not experience these geometry issues.
At the end of the day we are interested in getting a smooth, clean, watertight body.
Usually, we find these issues when importing or exporting the geometry from/to different
formats.
Module 2 - Lecture 2 4
Geometry generation using open source tools
So, how do we prepare the geometry for mesh generation?
Module 2 - Lecture 2 5
Geometry generation using open source tools
Geometry repair/cleanup
Module 2 - Lecture 2 6
Geometry generation using open source tools
Geometry repair/cleanup
Module 2 - Lecture 2 7
Geometry generation using open source tools
Geometry repair/cleanup
Module 2 - Lecture 2 8
Geometry generation using open source tools
Geometry repair/cleanup
Module 2 - Lecture 2 9
Geometry generation using open source tools
Geometry repair/cleanup
Sew faces
Align faces
Delete overlapping faces
Connect/disconnect edges
Module 2 - Lecture 2 10
Geometry generation using open source tools
Geometry repair/cleanup
Module 2 - Lecture 2 11
Geometry generation using open source tools
Geometry repair/cleanup
Module 2 - Lecture 2 12
Geometry generation using open source tools
Geometry repair/cleanup
Module 2 - Lecture 2 13
Geometry generation using open source tools
Many times, it is not necessary to model all the details of the geometry. In these
cases you should consider simplifying the geometry (geometry defeaturing).
Geometry defeaturing can save you a lot of time when generating the mesh.
So be smart, and use it whenever is possible.
Original Geometry
Defeatured Geometry
Module 2 - Lecture 2 14
Geometry generation using open source tools
On-shape: it is a full-cloud 3D CAD system. It runs in a web browser and on any
device with a working web browser. It has the same capabilities of commercial CAD
systems. You can create a free account and start to use it with immediately.
http://www.openvsp.org/
Sketch-Up: is a direct 3D modeling tool. There are many plugins available that extend
Sketch-Up capabilities.
http://www.sketchup.com/
Free-CAD: is a history based CAD tool (parametric design). Light CAD software, good
for not very complicated mechanical designs.
http://sourceforge.net/apps/mediawiki/free-cad/
Salome: is a history based CAD tool (parametric design). It has quite extensive
capabilities for creation and manipulation of solid geometries.
http://www.salome-platform.org/
Module 2 - Lecture 3 1
Todays lecture
Module 2 - Lecture 3 2
Geometry generation using open source tools
Introduction to SALOME
Module 2 - Lecture 3 4
2D geometry model
Using SALOME to draw a 2D cylinder case
Module 2 - Lecture 3 5
Geometry generation using open source tools
$PTOFC/meshes_and_geometries/salome_cylinder2d
Module 2 - Lecture 3 6
Geometry generation using open source tools
Before we start
If you are using our virtual machine or using the lab workstations, you will need to source OpenFOAM (load
OpenFOAM environment).
$> of3x
Remember, every time you open a new terminal window you need to source OpenFOAM.
By default, when installing OpenFOAM you do not need to do this. This is our choice as we have many
things installed and we want to avoid conflicts between applications.
To use Salome you will need to invoke it. Type in the terminal:
$> salome
Module 2 - Lecture 3 7
2D geometry model
Module 2 - Lecture 3 8
2D geometry model
Module 2 - Lecture 3 9
2D geometry model
Module 2 - Lecture 3 10
2D geometry model
Familiarizing with the geometry graphic interface
3D Viewer
Menu Bar
Main Controls
Toolbars
Pipeline Browser
Module 2 - Lecture 3 11
2D geometry model
Familiarizing with the geometry graphic interface
Basic entities
Primitve entities
Boolean operations
Transformations
General operations
Entities generation
Build entities
You will find a lot of additional operations and functions in the textual menu
Module 2 - Lecture 3 12
2D geometry model
Familiarizing with the geometry graphic interface
Rotate
Zoom
Pan
Zoom
Module 2 - Lecture3D
3 Viewer 13
2D geometry model
Lets create a primitive entity:
New Entity Primitives - Rectangle
Module 2 - Lecture 3 14
2D geometry model
Translate the rectangle
Operation Transformation - Translation
Module 2 - Lecture 3 15
2D geometry model
Create the cylinder circle
New Entity Primitives - Disk
Module 2 - Lecture 3 16
2D geometry model
Create the cylinder circle
Operations Boolean - Cut
Module 2 - Lecture 3 17
2D geometry model
Module 2 - Lecture 3 18
2D geometry model
Module 2 - Lecture 3 19
Python scripting
We have saved the Salome project in a .hdf file, but we can also
produce a trace of every action we have performed so far.
This trace will be saved in Python script, a human readable file.
This file can be used, in the dull way, to bring us back to the point where
we were at the saving time.
However, this is what we do when we save the file in the .hdf format.
The great power of scripting is that you can also modify all the
parameters you have used during the geometry and mesh generation
process.
Now go to File Dump study and chose a python file name, e.g.
cylinder2d.py
Module 2 - Lecture 3 20
Python scripting
Everything we did in Salome by mouse-clicking will be reproduced by
textual input in the python syntax.
For instance, in the GUI mode you cannot modify a geometry once you
have created it, and moreover this change does not reflect on other
geometries.
One possibility is to use the Notebook in the GUI interface, but it does
not allow you the same flexibility as scripting.
Module 2 - Lecture 3 22
Python scripting
We can now parametrize a copy of this file in order and test the power of
this procedure.
Module 2 - Lecture 3 23
Python scripting
This is a small change in the cylinder2D.py script that you may try.
Lets find the following lines:
Disk_1 = geompy.MakeDiskR(1, 1)
Cut_1 = geompy.MakeCutList(Face_1, [Disk_1], True)
Disk_1 = geompy.MakeDiskR(1, 1)
geomObj_1 = geompy.MakeCutList(Face_1, [Disk_1], True)
Scale_1 = geompy.MakeScaleAlongAxes(Disk_1, O, 1, 0.5, 1)
Cut_1 = geompy.MakeCutList(Face_1, [Scale_1], True)
If you load the new python script, something like this should appear
Module 2 - Lecture 3 25
Python scripting
run Salome in the bash
When dealing with parametrization problems (but not only) its useful to
execute our python scripts in the bash:
or
Mesh_1.ExportUNV( r'Mesh_1.unv' )
Module 2 - Lecture 3 26
3D geometry model
Module 2 - Lecture 3 27
Geometry generation using open source tools
Using SALOME to draw and to mesh a simplified mixing elbow
Module 2 - Lecture 3 28
Geometry generation using open source tools
Our goal
Module 2 - Lecture 3 29
Geometry generation using open source tools
$PTOFC/meshes_and_geometries/salome_elbow3d
Module 2 - Lecture 3 30
3D geometry model
Lets create a primitive entity:
New Entity Primitives - Disk
Module 2 - Lecture 3 31
3D geometry model
Creation of a plane passing through the origin and
perpendicular to Z
New Entity Basic Plane
Module 2 - Lecture 3 32
3D geometry model
We define an extrusion path as follows
New Entity Basic 2D Sketch
Module 2 - Lecture 3 33
3D geometry model
We define an extrusion path as follows
New Entity Basic 2D Sketch
Fist point
X: 0 Y:0
Click Apply
Add the new point coordinates and Apply
X: 3 Y: 0
Add the elbow arc and Apply
Element type: arc
Type: direction
Direction: tangent
Radius: 1,5 Ange: 90
Module 2 - Lecture 3 34
3D geometry model
We define an extrusion path as follows
New Entity Basic 2D Sketch
Module 2 - Lecture 3 35
3D geometry model
We define an extrusion path as follows
New Entity Basic 2D Sketch
Module 2 - Lecture 3 36
3D geometry model
Extrusion of Disk_1 along the path line
New Entity Generation Extrusion Along Path
Module 2 - Lecture 3 37
3D geometry model
Adding a point in the outlet center
New Entity Basic - Point
Coordinates
X: 4.5 Y: 4.5 Z:0
Press Apply and Close
Module 2 - Lecture 3 38
3D geometry model
We create a second disk related to the secondary inlet
New Entity Primitives - Disk
Module 2 - Lecture 3 39
3D geometry model
Extruding Disk_2 to model the secondary inlet
New Entity Generation - Extrusion
Module 2 - Lecture 3 40
3D geometry model
Lets fuse Pipe_1 with Extrusion_1
Operations Boolean - Fuse
Module 2 - Lecture 3 41
3D geometry model
Module 2 - Lecture 3 42
Exporting the geometry
facet normal -1 0 0
outer loop
vertex -1.5 1.5 -1.5
vertex -1.5 -1.5 -1.5
vertex -1.5 -1.5 1.5
endloop
endfacet
Module 2 - Lecture 3 44
Exporting the geometry
solid solid1
facet normal -1 0 0
outer loop
vertex -1.5 1.5 -1.5
vertex -1.5 -1.5 -1.5
facet vertex -1.5 -1.5 1.5
endloop
endfacet solid1
facet normal -1 0 0
outer loop
facet ...
endloop
endfacet
endsolid solid1
solid solid2
facet normal 0 1 0
outer loop
...
facet endloop
endfacet
facet normal 0 1 0 solid2
outer loop
facet ...
endloop
endfacet
endsolid solid2
Module 2 - Lecture 3 45
Exporting the geometry
l Binary format is lighter (usually ~ 1/3 of hard drive space) but cannot be edited
via text editor.
l However, the facet splitting can be done by hand just with simple geometries.
With longer surfaces, the splitting can be done by using surfaceFeatureEdges
l Having all the .stl in binary format can however be advantageous if we have to
merge different parts of the surface together.
Module 2 - Lecture 3 46
Roadmap
Module 2 - Lecture 3 47
3D geometry model
https://cad.onshape.com/
The projects are saved in the Onshape cloud storage storage with public
and private sharing options and its possible to export the geometries in a
number of traditional formats such as STEP, STL, Parasolid, etc.
Module 2 - Lecture 3 48
3D geometry model
Module 2 - Lecture 3 49
3D geometry model
User folders by
projects type Documents
list Project preview and details
Tools bar
Drop down
geometry
elements View cube
menu
Interactive 3D
modeler viewer
Tabs menu
Versions
and history
menu
Module 2 - Lecture 3 53
3D geometry model
In the bar menu of the Part Studio Tab you will find the Feature toolbar:
Sketch creation and basic
modifications
Entitiy adjustements
Module 2 - Lecture 3 54
3D geometry model
Selection
Rotate
Pan
Zoom
Module 2 - Lecture 3 55
3D geometry model
And finally, some keyboard shortcuts that may turn out useful for your
work:
General 3D Viewer Sketch mode
purposes
Module 2 - Lecture 3 56
3D geometry model
In a newly created document, left click on the Document menu and then
on Workspace units to choose a metric length unit.
Document menu
Module 2 - Lecture 3 57
3D geometry model
Exit from the Workspace units window and left click on the Sketch
button and select the Front plane as the Sketch plane
Dont worry about sizing, the extent of the geometry elements can be
easily adjusted after having created the sketches
Module 2 - Lecture 3 59
3D geometry model
After having selected the second point of the line, the line allows you
the definition of the next point in order to create a polyline. You can
escape the polyline creation by pressing the Esc key.
Now its time to draw the arc of our extrusion pattern. Select 3 point
arc (or the shortcut a) and specify in the order: the initial point, the final
point and the arc radius.
Module 2 - Lecture 3 60
3D geometry model
The final horizontal line follows the arc final point .Lets draw it.
Snap
indicator
Snapping indicators will pop up when you are selecting the second
point of an element and are useful to obtain basic alignment or sizing.
Module 2 - Lecture 3 61
3D geometry model
E.g. the tangent button (or the shortcut t) ensures that the selected
sketch entity is tangent to the second selected entity. Try to use the
tangent function between our arc and the horizontal line.
Snap indicators
Now you should see the horizontality and tangential snap indicators
appearing when the mouse arrows hover on the horizontal line.
Module 2 - Lecture 3 62
3D geometry model
The dimension toolbar button (or the shortcut d) is an handy tool that
allows adjusting the size of the sketch elements. Leave the mouse
arrow on the dimension button to see the instructions and enable the
dimensions of the three elements.
If you prefer, you can switch off the Front plane view by right clicking on
Front from the drop-down element list and then left clicking on Hide
Module 2 - Lecture 3 63
3D geometry model
For the moment, we have finished working on Sketch 1, close it by left
clicking on the green sign.
Lets change the view to a normal to the Top plane and create a new
sketch on this plane.
Select the Center point circle entity (shortcut c) and draw a circle
centered in the axis origin with a diameter equal to 1.
Module 2 - Lecture 3 64
3D geometry model
In Onshape, the extrustion along a path is performed by the Sweep
operator. Close the Sketch 2 and leave the mouse over the Sweep tool
in the Feature toolbar to see the instructions.
Sweep
Module window
2 - Lecture 3 65
3D geometry model
The Sweep window requires the definition of the sketch to sweep and
the sketch of the path. We are interested in doing a Solid sweep, the
results is a brand new Part.
In the Onshape language, Parts are 3D geometries that are separated
components of an Assembly and can be treated separately. The
Assembly Tab allow the manipulation of group of Parts and manages
their connection.
Final entities
Destination of the
new Part
Sketch to be swept
Sweep patch
Transparency
Module 2 - Lecture 3 66
3D geometry model
Now we want to create our secondary mixing inlet. We can use the
extrustion function but first we need to create a plane parallel to the
existing Right plane. We will draw our next circle sketch in the new
plane.
Click on the Plane button from the Feature toolbar. We will define the
Right plane starting entity with an Offset distance equal to 1.
Module 2 - Lecture 3 67
3D geometry model
For the next step Id recommend to hide the Right plane from the
geometry drop-down menu and use a view that is normal to Plane 1,
now you should know how to do it.
Create a new sketch and a Center point circle to realize a 0.5 diameter
circle that lays on Plane 1 at the level of the elbow. The center of the
circle must intersect the Z axis, if it doesnt dont worry, you can adjust it
later.
The Concentric tool will be used to make the new circle concentric with
respect to the outlet face.
Module 2 - Lecture 3 68
3D geometry model
Close the Sketch 3 and perform an Extrustion (shortkey shift-e) having
selected the new circle face. We will perform a Blind type extrusion with
a depth equal to 3.
Module 2 - Lecture 3 69
3D geometry model
Close the Sketch 3 and perform an Extrustion (shortkey shift-e) having
selected the new circle face. We will perform a Blind type extrusion with
a depth equal to 3.
Module 2 - Lecture 3 70
3D geometry model
After the latest operation our 3D mixing elbow model is complete.
Module 2 - Lecture 3 71
Exporting the geometry
We can export our solid in the STL form by right clicking on our Part in
the Part Studio list and left click on Export.
Lets choose the Text STL format and Meter units.
Module 2 - Lecture 3 72
Exporting the geometry
The exported STL geometries can be open in paraview to check the
final result.
$> paraview elbow3d.stl
You can also check the quality of the STL geometry by taking
advantage of the surfaceCheck OpenFOAM utility.
Module 2 - Lecture 3 73