Upload
suresh501
View
265
Download
4
Embed Size (px)
DESCRIPTION
Open Foam -Meshing
Citation preview
Disclaimer
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Introductory OpenFOAM Course
University of Genoa, DICCA Dipartimento di Ingegneria Civile, Chimica e Ambientale
From 17th to 21th February, 2014
Your Lecturer
Joel GUERRERO
Matteo BARGIACCHI
This lecture is about meshing and mesh quality assessment for CFD computations
Generating high quality meshes is a critical step for CFD computations. Depending on the quality of the mesh you can get very different results, which can made post-processing and interpretation of the solution a difficult task, due to contrasting or misleading results because of meshing issues. This holds independently of the solver used.
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Meshing and mesh quality
This lecture is about meshing and mesh quality assessment for CFD computations
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Meshing and mesh quality
I do not know how much I will stress this, but try to always use a good quality mesh. Have always in mind, garbage in - garbage out. As I am a really positive guy, I rather say, good mesh - good results.
Todays lecture
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
1. Meshing preliminaries 2. Mesh quality assessment 3. Mesh conversion and manipulation utilities 4. Mesh generation using blockMesh and
snappyHexMesh 5. Mesh generation using open source tools 6. Hands-on session
Todays lecture
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
1. Meshing preliminaries 2. Mesh quality assessment 3. Mesh conversion and manipulation utilities 4. Mesh generation using blockMesh and
snappyHexMesh 5. Mesh generation using open source tools 6. Hands-on session
Meshing preliminaries
Mesh generation consist in dividing the physical domain into a finite number of discrete regions, called control volumes or cells in which the solution is sought (domain discretization).
Meshes used for the FVM method can consist of tetrahedras, pyramids, prisms, hexahedras or any kind of polyhedral element (or a mix of all of them).
The meshes can be unstructured or structured. In our discussion, when we talk about unstructured or structured meshes we refer specifically to the method used to generate them.
Meshing preliminaries
The data structure of the meshes used in the FVM is represented by the points and faces that make up each control volume.
The connectivity information of each cell (how faces and cells are connected) and cell/face neighbor information is also needed for FVM unstructured meshes.
Meshes used for the FDM method are made of hexahedra and they are known as single and/or multi-block structured meshes.
The connectivity information of the meshes used in the FDM is expressed as a two or three dimensional array, this is highly memory efficient as we do not need to store all the connectivity information of the faces and cells.
Meshing preliminaries
In the next slides, I will show a few meshes generated by using different meshing methods.
Also, I will present a table with a comparison of four commonly used mesh generation methods.
The figures of merit used to compare the meshes are related to the method used to generate the mesh and not to the flow solver.
All the methods that we are going to talk about, can generate a valid mesh to be used with the FVM. Remember, when we pass the mesh information to an unstructured FVM solver, we pass the data structure and connectivity information (points, faces and cells information).
Meshing preliminaries
Single-block C-type structured grid around a NACA 4412 airfoil
Meshing preliminaries
Multi-block structured grid around a NLR 7301 airfoil with flap
Meshing preliminaries
Unstructured triangular mesh around a NHLP-2D three element airfoil
Meshing preliminaries
Overlapping structured grid around a NLR 7301 airfoil with flap
Meshing preliminaries
Cartesian mesh around a Drela DAE11 low Reynolds airfoil
Meshing preliminaries STRUCTURED UNSTRUCTURED CARTESIAN OVERLAPPING
Geometric Flexibility/Adaptation
Grid Adaptation/Local Refinement
Viscous Computation
Moving/Deforming Meshes Quality
Interpolation/Conservation
Grid generation easiness
Memory Requirements
CPU Requirements
Good Fairly Good Mild Bad Very Bad
Meshing preliminaries
Unstructured Vs. Structured meshes, Who wins?
Meshing preliminaries A structured mesh requires as input the blocking definition (blue lines in the figure).
For complicated geometries, it can be extremely difficult arrive to the right blocking, it requires a lot user experience.
After defining the blocking, the mesh generation time is quite fast, in the order of seconds or minutes.
Unstructured meshes, only requires as input the element size on the lines and surfaces that def ine the geometry.
After defining the element size, the meshing process can be quite time consuming and memory expensive.
Meshing time is in the order of minutes or hours, even days.
Meshing preliminaries
Unstructured Hybrid Mesh (tetras, prisms and hexs) Cell count: approx. 5 000 000
Structured Mesh (hexahedrals) Cell count: approx. 5 000 000
Meshing preliminaries
Unstructured Hybrid Mesh (tetras, prisms and hexs) Cell count: approx. 5 000 000
Structured Mesh (hexahedrals) Cell count: approx. 5 000 000
Meshing preliminaries
Unstructured Hybrid Mesh (tetras, prisms and hexs) Cell count: approx. 5 000 000
Structured Mesh (hexahedrals) Cell count: approx. 5 000 000
Meshing preliminaries
Unstructured Hybrid Mesh (tetras, prisms and hexs) Cell count: approx. 5 000 000
Structured Mesh (hexahedrals) Cell count: approx. 5 000 000
Meshing preliminaries
Unstructured Hybrid Mesh (tetras, prisms and hexs) Cell count: approx. 5 000 000
Structured Mesh (hexahedrals) Cell count: approx. 5 000 000
Meshing preliminaries
Unstructured Hybrid Mesh (tetras, prisms and hexs) Cell count: approx. 5 000 000
Structured Mesh (hexahedrals) Cell count: approx. 5 000 000
Meshing preliminaries
Unstructured Vs. Structured meshes, Who wins?
Each mesh type has its advantages and disadvantages. At the end of the day, the mesh you use must has a good
overall quality and must be smooth. The mesh density should be high enough to capture all
relevant flow features. Wait, but what is a good mesh?. Mesh quality and
smoothness will be studied in the next slides.
Todays lecture
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
1. Meshing preliminaries 2. Mesh quality assessment 3. Mesh conversion and manipulation utilities 4. Mesh generation using blockMesh and
snappyHexMesh 5. Mesh generation using open source tools 6. Hands-on session
What is a good mesh? A standard rule of thumb is that the elements shape and distribution should
be pleasing to the eye. There is no written theory when it comes to mesh generation. Basically, the
whole process depends on user experience. The user can rely on grid dependency studies, but they are time consuming
and expensive. No single standard benchmark or metric exists that can effectively assess
the quality of a mesh, but you can rely on suggested best practices. Hereafter, I will present you the most common mesh quality metrics:
Orthogonality. Skewness. Aspect Ratio. Smoothness.
Mesh quality assessment
Mesh quality metrics. Mesh orthogonality
Mesh orthogonality is the angular deviation of the vector S (located at the face center f ) from the vector d connecting the two cell centers P and N.
Affects the gradient of the face center f. It adds diffusion to the solution.
Mesh quality assessment
Mesh quality metrics. Mesh skewness
Skewness is the deviation of the vector d that connects the two cells P and N, from the face center f. The deviation vector is represented with and is the point where the vector d intersects the face f .
Affects the interpolation of the cell centered quantities to the face center f. It adds diffusion to the solution.
Mesh quality assessment
fi
Mesh quality metrics. Mesh aspect ratio AR
Mesh aspect ratio AR is the ratio between the longest side and the shortest side .
Large AR are fine if gradients in the long direction are small. High AR smear gradients.
Mesh quality assessment
xy
Mesh quality metrics. Smoothness
Smoothness, also known as expansion rate, growth factor or uniformity, defines the transition in size between contiguous cells.
Large transition ratios between cells add diffusion to the solution. Ideally, the maximum change in mesh spacing should be less than 20%:
Mesh quality assessment
Smooth transition Steep transition
y2y1
1.2
Mesh quality assessment
f = P +
yy +O(y2) f = P +
yy +O(y2)
P fP
f
Element type close to the walls - Cell/Flow alignment
Hexahedrals, prisms, and quadrilaterals can be stretched easily to resolve boundary layers without losing quality.
Triangular and tetrahedral meshes have inherently larger truncation error. Less truncation error when faces aligned with flow direction and gradients.
Striving for quality For the same cell count, hexahedral meshes will give more accurate
solutions, especially if the grid lines are aligned with the flow.
The mesh density should be high enough to capture all relevant flow features. In areas where the solution change slowly, you can use larger elements.
To keep cell count low, use non-uniform meshes to cluster cells only where they are needed. Use local refinements and solution adaption to further refine only on selected areas.
In boundary layers, quad, hex, and prism/wedge cells are preferred over triangles, tetrahedras, or pyramids.
If you are not using wall functions (turbulence modeling), the mesh adjacent to the walls should be fine enough to resolve the boundary layer flow. This will rocket the cell count and increase the computing time.
Mesh quality assessment
Striving for quality Use hexahedral meshes whenever is possible, specially if high accuracy in
predicting forces is your goal (drag prediction) or for turbo machinery applications.
For complex flows without dominant flow direction, quad and hex meshes loose their advantages.
Keep orthogonality, skewness, and aspect ratio to a minimum.
Change in cell size should be smooth.
Remember, a poor quality mesh will generate inaccurate solutions and/or will slow down solution convergence.
Mesh quality assessment
Mesh quality metrics in OpenFOAM
In WM_PROJECT_DIR/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheck.C you will find the quality metrics used in OpenFOAM. Their maximum (or minimum) values are defined as follows:
Foam::scalar Foam::primitiveMesh::closedThreshold_ = 1.0e-6; Foam::scalar Foam::primitiveMesh::aspectThreshold_ = 1000; Foam::scalar Foam::primitiveMesh::nonOrthThreshold_ = 70; // deg Foam::scalar Foam::primitiveMesh::skewThreshold_ = 4; Foam::scalar Foam::primitiveMesh::planarCosAngle_ = 1.0e-6;
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh quality assessment
Checking mesh quality in OpenFOAM
OpenFOAM comes with the utility checkMesh which checks the validity of the mesh.
checkMesh will look for/check for: Mesh stats and overall number of cells of each type. Check topology (boundary conditions definitions). Check geometry and mesh quality (bounding box, cell volumes,
skewness, orthogonality, aspect ratio, and so on) If for any reason checkMesh finds errors, it will give you a message and it
will tell you what check failed. It will also write a set with the faulty cells, faces, points. These sets are
saved in the directory constant/polyMesh/sets/
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh quality assessment
Checking mesh quality in OpenFOAM
Mesh topology and patch topology errors must be repaired. You will be able to run with mesh quality errors such as skewness, aspect
ratio, minimum face area, and non-orthogonality. But remember, they will severely tamper the solution accuracy and eventually can made the solver blow-up.
Unfortunately, checkMesh does not repair these errors. You will need to check the geometry for possible errors and generate a new mesh.
To visualize the failed sets you can use the utility foamToVTK. This utility converts the failed sets to VTK format.
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh quality assessment
Checking mesh quality in OpenFOAM
To visualize the failed faces/cells/points in paraFoam you will need to proceed as follows:
foamToVTK -set_type name_of_sets
where set_type is the type of sets ( faceSet, cellSet, pointSet, surfaceFields) and name_of_sets is the name of the set in the directory constant/polyMesh/sets (highAspectRatioCells, nonOrthoFaces, wrongOrientedFaces, skewFaces, unusedPoints)
At the end, foamToVTK will create a directory named VTK, where you will find the failed faces/cells/points in VTK format. At this point you can use paraFoam to visualize the failed sets.
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh quality assessment
Checking mesh quality in OpenFOAM
We will now check the mesh quality of a sample case. From now on follow me.
Go to the directory $ptofc/mesh_conversion_manipulation/M2_wingbody. In the terminal type:
cd $ptofc/mesh_conversion_manipulation/M2_wingbody fluent3DMeshToFoam ./mesh/ascii.msh checkMesh
At this point check the output of the utility checkMesh. To write the failed sets to VTK format: foamToVTK -faceSet nonOrthoFaces mv VTK VTK1 foamToVTK -pointSet unusedPoints
Now you can visualize the faulty sets by using paraFoam.
Remember, each time you use the utility foamToVTK it will overwrite the directory VTK
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh quality assessment
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Non orthogonal faces (green) and unused points (yellow)
By following the instructions, you should get something like this
Mesh quality assessment
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
By following the instructions, you should get something like this
Mesh quality assessment
Non orthogonal faces (green) and unused points (yellow)
Todays lecture
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
1. Meshing preliminaries 2. Mesh quality assessment 3. Mesh conversion and manipulation utilities 4. Mesh generation using blockMesh and
snappyHexMesh 5. Mesh generation using open source tools 6. Hands-on session
Mesh conversion and manipulation utilities It is also possible to export a mesh generated with a third party software and
use it in OpenFOAM. Some of the utilities available for mesh conversion are listed below: ansysToFoam: converts an ANSYS input mesh file OpenFOAM format. cfx4ToFoam: converts a CFX 4 mesh to OpenFOAM format. fluent3DMeshToFoam: converts a Fluent mesh to OpenFOAM format. gambitToFoam: converts a GAMBIT mesh to OpenFOAM format. gmshToFoam: reads .msh file as written by Gmsh. ideasUnvToFoam: I-Deas unv format mesh conversion. plot3dToFoam: plot3d mesh (ascii/formatted format) converter. star4ToFoam: converts a STAR-CD (v4) PROSTAR mesh into OpenFOAM
format.
tetgenToFoam: Converts .ele and .node and .face files, written by tetgen.
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
In the User Guide you will find the complete listing
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh conversion and manipulation utilities OpenFOAM also comes with many mesh manipulation utilities. Some of
them are listed below: checkMesh: checks validity of a mesh. refineMesh: utility to refine cells in multiple directions. renumberMesh: renumbers the cell list in order to reduce the bandwidth,
reading and renumbering all fields from all the time directories
transformPoints: transforms the mesh points in the polyMesh directory according to the translate, rotate and scale options.
mirrorMesh: mirrors a mesh around a given plane. setSet: manipulate a cell/face/point/ set or zone interactively. refineWallLayer: utility to refine cells next to patches.
In the User Guide you will find the complete listing
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh conversion and manipulation utilities In OpenFOAM it is also possible to manipulate the geometries in STL
format. Some of the utilities available are listed below: surfaceTransformPoints: transform (scale/rotate) a surface. Like
transformPoints but for surfaces. surfaceCheck: checks geometric and topological quality of a surface. surfaceClean: removes baffles and collapses small edges, by removing
triangles. Converts sliver triangles into split edges.
surfaceFeatureExtract: extracts and writes surface edge features to file. surfaceMeshInfo: miscellaneous information about surface. surfaceMeshTriangulate: extracts triSurface from a polyMesh.
In the User Guide you will find the complete listing
Geometry and mesh manipulation in OpenFOAM We will now manipulate a STL geometry and a mesh. From now on follow me.
Go to the directory $ptofc/mesh_conversion_manipulation/M6_ahmed_body_transform In the terminal type:
cd $ptofc/mesh_conversion_manipulation/M6_ahmed_body_transform blockMesh surfaceCheck ./constant/triSurface/ahmed_body.stl surfaceTransformPoints -rollPitchYaw '(0 0 15)' ./constant/
triSurface/ahmed_body.stl ./constant/triSurface/rotated.stl surfaceTransformPoints -translate '(0 0.12 0)' ./constant/
triSurface/rotated.stl ./constant/triSurface/translated.stl surfaceTransformPoints -scale '(0.9 1.1 1.3)' ./constant/
triSurface/translated.stl ./constant/triSurface/scaled.stl
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh conversion and manipulation utilities
Geometry and mesh manipulation in OpenFOAM We will now manipulate a STL geometry and a mesh. From now on follow me.
Go to the directory $ptofc/mesh_conversion_manipulation/M6_ahmed_body_transform In the terminal type:
cd $ptofc/mesh_conversion_manipulation/M6_ahmed_body_transform surfaceSmooth ./constant/triSurface/scaled.stl 0.3 100 ./constant/
triSurface/smooth.stl surfaceFeatureExtract snappyHexMesh -overwrite transformPoints -rollPitchYaw '(0 10 -15)' transformPoints -scale '(2 1 1) checkMesh paraFoam
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh conversion and manipulation utilities
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
By following the instructions, you should get something like this
STL surface manipulation
Mesh conversion and manipulation utilities
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
By following the instructions, you should get something like this
Mesh conversion and manipulation utilities
Mesh manipulation
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
By following the instructions, you should get something like this
Mesh conversion and manipulation utilities
Mesh manipulation
Todays lecture
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
1. Meshing preliminaries 2. Mesh quality assessment 3. Mesh conversion and manipulation utilities 4. Mesh generation using blockMesh and
snappyHexMesh 5. Mesh generation using open source tools 6. Hands-on session
Mesh generation using blockMesh and snappyHexMesh
blockMesh For simple geometries, the mesh generation utility blockMesh (supplied with OpenFOAM), can be used. The blockMesh utility creates multiblock meshes. The mesh is generated from a dictionary file named blockMeshDict located in the constant/polyMesh directory. snappyHexMesh For complex geometries, the mesh generation utility snappyHexMesh (supplied with OpenFOAM), can be used. The snappyHexMesh utility generates 3D meshes containing hexahedra and split-hexahedra from a triangulated surface geometry in Stereolithography (STL) format. The mesh is generated from a dictionary file named snappyHexMeshDict located in the system directory and a triangulated surface geometry file located in the directory constant/triSurface.
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
blockMesh block topology
Refer to the User Guide for more Information
Mesh 1. 3D Cylinder (external mesh). Let us generate the mesh by using SnappyHexMesh.
From now on, follow me.
In the terminal window type:
cd $ptofc/sHM_1/M1_cyl blockMesh snappyHexMesh
(And by the way, take a look at the snappyHexMeshDict dictionary) checkMesh paraFoam
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
Mesh 1. 3D Cylinder (external mesh). Let us generate the mesh by using SnappyHexMesh.
From now on, follow me.
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
At this point, your mesh should looks like this
Mesh 1. 3D Cylinder (external mesh). Let us generate the mesh by using SnappyHexMesh.
From now on, follow me.
So What did we do? or
What did snappyHexMesh do?
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
So What did we do? SnappyHexMesh mesh generation process
Mesh generation with the snappyHexMesh utility The process of generating a mesh using snappyHexMesh will be described using
this figure. The objective is to mesh a rectangular shaped region (shaded grey in the figure)
surrounding an object described by and STL surface (external aerodynamics)
You can also generate the mesh for an internal aerodynamics simulation. Note that the schematic is 2D to make it easier to understand, even though
snappyHexMesh is a 3D meshing tool. This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
Creating the background hexahedral mesh Before snappyHexMesh is executed the user must create a background mesh of hexahedral cells that fills the entire region as shown in the figure. This can be done by using blockMesh.
So What did we do? SnappyHexMesh mesh generation process
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
Cell splitting at feature edges Cell splitting is performed according to the specification supplied by the user in the snappyHexMeshDict dictionary. The splitting process begins with cells being selected according to specified edge features as illustrated in the figure.
So What did we do? SnappyHexMesh mesh generation process
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
Cell splitting at surfaces Following feature edges refinement, cells are selected for splitting in the locality of specified surfaces as illustrated in the figure. The surface refinement (splitting) is performed according to the specification supplied by the user in the snappyHexMeshDict dictionary.
So What did we do? SnappyHexMesh mesh generation process
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
Cell removal Once the feature edges and surface splitting is complete, a process of cell removal begins. The region in which cells are retained are simply identified by a location vector within the region, this information is supplied by the user in the snappyHexMeshDict dictionary.
So What did we do? SnappyHexMesh mesh generation process
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
Cell splitting in specified regions Those cells that lie within one or more specified volume regions can be further split by a region (in the figure, the rectangular dark shaded region). This information is supplied by the user in the snappyHexMeshDict dictionary.
So What did we do? SnappyHexMesh mesh generation process
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
Snapping to surfaces After deleting the cells in the region specified and refining the volume mesh, the points are snapped on the surface to create a conforming mesh.
So What did we do? SnappyHexMesh mesh generation process
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
Mesh layers The mesh output from the snapping stage may be suitable for simulation, although it can produce some irregular cells along boundary surfaces. There is an optional stage of the meshing process which introduces boundary layer meshing in selected parts of the mesh. This information is supplied by the user in the snappyHexMeshDict dictionary.
So What did we do? SnappyHexMesh mesh generation process
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
Mesh 2. 3D Cylinder (external mesh). Let us generate the mesh by using SnappyHexMesh with feature edge
refinement. From now on, follow me.
In the terminal window type:
cd $ptofc/sHM_1/M2_cyl_er blockMesh surfaceFeatureExtract
(This utility uses surfaceFeatureExtractDict dictionary which is located in the system directory) paraview
(Take a look at the .obj files created by surfaceFeatureExtract, we use paraview instead of paraFoam because by default paraFoam reads the mesh generated by blockMesh. The .obj files are located in the directory constant/extendedFeatureEdgeMesh)
snappyHexMesh checkMesh paraFoam
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
Mesh 2. 3D Cylinder (external mesh). Let us generate the mesh by using SnappyHexMesh with feature edge
refinement. The utility surfaceFeatureExtract will create a file named *.eMesh (e.g.
banana.eMesh), this file will be saved in the directory constant/triSurface This file contains the information of the feature edges. By the way, try to read the file, it is easy to understand.
Next, you should tell to snappyHexMesh that you want to use refinement in the feature edges, and this is done by pointing to the *.eMesh file in the snappyHexMeshDict dictionary
// Explicit feature edge refinement features (
{ file banana.eMesh; level 4; }
); snappyHexMesh knows that the *.eMesh file is in constant/triSurface
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
Mesh 2. 3D Cylinder (external mesh). Let us generate the mesh by using SnappyHexMesh with feature edge
refinement.
At this point, you should have in your case directory two time directories 1 and 2 (if you chose a time step of 1 in your controlDict).
In the time directory 1, you should have the mesh with the castellated mesh. In the time directory 2 you should have the mesh with the conforming mesh (the
mesh after snapping). Additionally, if you chose to generate the boundary layer mesh, you should have a
time directory 3, where you should have the mesh with the inflation layer. We are going to deal with boundary layer meshing later on.
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
Mesh 2. 3D Cylinder (external mesh). Let us generate the mesh by using SnappyHexMesh with feature edge
refinement.
Now you must copy the mesh from the time directory 2 (or 3) to your constant directory. In the terminal type:
mv constant/polyMesh constant/polyMesh.org (To rename the background mesh folder, this is optional, but I highly recommended it)
cp -r 2/polyMesh constant/polyMesh (To copy the new mesh to your constant/polyMesh directory, this is compulsory)
rm -r 1 (If you do not want to keep this time folder)
rm -r 2 (If you do not want to keep this time folder)
Now you are ready to run.
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
Mesh 2. 3D Cylinder (external mesh). Let us generate the mesh by using SnappyHexMesh with feature edge
refinement.
Alternatively, snappyHexMesh can automatically overwrite the original background mesh contained in constant/polyMesh. In the terminal type:
snappyHexMesh -overwrite
If you use this option, you will not be able to visualize the intermediate steps.
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
Mesh 2. 3D Cylinder (external mesh). Let us generate the mesh by using SnappyHexMesh with feature edge
refinement.
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
At this point, your mesh should looks like this
Mesh 2. 3D Cylinder (external mesh). Let us generate the mesh by using SnappyHexMesh with feature edge
refinement.
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
Feature edge refinement No feature edge refinement
Mesh 3. Mixing elbow (internal mesh). Initial mesh. Let us generate the mesh by using SnappyHexMesh.
From now on, follow me.
In the terminal window type:
cd $ptofc/sHM_1/M3_mixing_elbow1 blockMesh surfaceFeatureExtract
(It will use an includedAngle of 130 degrees as defined in the dictionary) paraview
(Take a look at the .obj files created by surfaceFeatureExtract, we use paraview instead of paraFoam because by default paraFoam reads the mesh generated by blockMesh. The .obj files are located in the directory constant/extendedFeatureEdgeMesh)
snappyHexMesh checkMesh paraFoam
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
Mesh 3. Mixing elbow (internal mesh). Initial mesh. Let us generate the mesh by using SnappyHexMesh.
Alternatively, snappyHexMesh can automatically overwrite the original background mesh contained in constant/polyMesh. In the terminal type:
snappyHexMesh -overwrite
If you use this option, you will not be able to visualize the intermediate steps.
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
Mesh 3. Mixing elbow (internal mesh). Initial mesh. Let us generate the mesh by using SnappyHexMesh.
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
An includedAngle of 130 degrees does not resolve well the intersection between the two pipes.
Mesh 4. Mixing elbow (internal mesh). Improved mesh. Let us generate the mesh by using SnappyHexMesh.
From now on, follow me.
In the terminal window type:
cd $ptofc/sHM_1/M3_mixing_elbow2 blockMesh surfaceFeatureExtract
(It will use an includedAngle of 150 degrees as defined in the dictionary) paraview
(Take a look at the .obj files created by surfaceFeatureExtract, we use paraview instead of paraFoam because by default paraFoam reads the mesh generated by blockMesh. The .obj files are located in the directory constant/extendedFeatureEdgeMesh)
snappyHexMesh checkMesh paraFoam
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
Mesh 4. Mixing elbow (internal mesh). Improved mesh. Let us generate the mesh by using SnappyHexMesh.
Alternatively, snappyHexMesh can automatically overwrite the original background mesh contained in constant/polyMesh. In the terminal type:
snappyHexMesh -overwrite
If you use this option, you will not be able to visualize the intermediate steps.
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
Mesh 4. Mixing elbow (internal mesh). Improved mesh. Let us generate the mesh by using SnappyHexMesh.
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
By increasing the includedAngle to 150 degrees we are able to resolve well the intersection between the two pipes
Mesh 5. Sphere (external mesh). Let us generate first the geometry using blender (or whatever you want to
use) and then the mesh by using SnappyHexMesh. From now on, follow me.
For this tutorial you will first need to generate the geometry using blender or whatever you want to use, I will use blender. In the terminal type:
cd $ptofc/sHM_1/M4_sphere_sHM (The blender file and STL file are in the directory geometry)
blender (For geometry modeling. Do not forget to export the geometry in ascii STL format)
blockMesh snappyHexMesh checkMesh paraFoam cp -r 3/polyMesh constant/polyMesh
(To copy the new mesh to your constant/polyMesh directory, this is compulsory rm -r 1, rm -r 2, rm -r 3
(If you do not want to keep these time folders)
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
Mesh 5. Sphere (external mesh). Let us generate first the geometry using blender (or whatever you want to
use) and then the mesh by using SnappyHexMesh.
Alternatively, snappyHexMesh can automatically overwrite the original background mesh contained in constant/polyMesh. In the terminal type:
snappyHexMesh -overwrite
If you use this option, you will not be able to visualize the intermediate steps.
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
Mesh 5. Sphere (external mesh). Let us generate first the geometry using blender (or whatever you want to
use) and then the mesh by using SnappyHexMesh.
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
Mesh with no inflation layer. addLayers false; in snappyHexMeshDict
Mesh 5. Sphere (external mesh). Let us generate first the geometry using blender (or whatever you want to
use) and then the mesh by using SnappyHexMesh.
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
Mesh with inflation layer. addLayers true; in snappyHexMeshDict
Mesh 5. Sphere (external mesh). Let us generate first the geometry using blender (or whatever you want to
use) and then the mesh by using SnappyHexMesh.
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
Mesh with no inflation layers Mesh with inflation layers
Mesh 5. Sphere (external mesh). Inflation layers with different control parameters
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
Mesh 6. 2D Cylinder (external mesh). Let us generate the mesh by using SnappyHexMesh.
From now on, follow me.
In the terminal window type:
cd $ptofc/sHM_1/M5_2d_cylinder blockMesh snappyHexMesh checkMesh extrudeMesh
(Take a look at the dictionary extrudeMeshDict, this dictionary tells OpenFOAM to create the 2D mesh) checkMesh paraFoam
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
Mesh 6. 2D Cylinder (external mesh). Let us generate the mesh by using SnappyHexMesh.
Alternatively, snappyHexMesh can automatically overwrite the original background mesh contained in constant/polyMesh. In the terminal type:
snappyHexMesh -overwrite
If you use this option, you will not be able to visualize the intermediate steps.
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
Mesh 6. 2D Cylinder (external mesh).
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
Mesh 6. 2D Cylinder (external mesh).
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
Mesh 6. 2D Cylinder (external mesh).
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
Mesh 7. 3D Cylinder with periodic boundary conditions (external mesh).
Let us generate the mesh by using SnappyHexMesh. From now on, follow me.
In the terminal window type: cd $ptofc/sHM_1/M8_periodic_cylinder blockMesh snappyHexMesh checkMesh -latestTime createPatch
(Take a look at the dictionary createPatchDict, this dictionary will create two patches named periodic1 and periodic2, which contain the information regarding to the periodic bcs)
checkMesh -latestTime paraFoam
Note: the createPatch utility will create a new mesh in the time directory 3 (if you chose a deltaT equal to 1 in controlDict). This mesh has the periodic patches, now you can copy it to the folder constant/polyMesh
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
Mesh 7. 3D Cylinder with periodic boundary conditions (external mesh).
Alternatively, snappyHexMesh can automatically overwrite the original background mesh contained in constant/polyMesh. In the terminal type:
snappyHexMesh -overwrite
If you use this option, you will not be able to visualize the intermediate steps. In the same way, createPatch can overwrite the final mesh. In the terminal type:
createPatch -overwrite
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
Mesh 7. 3D Cylinder with periodic boundary conditions (external mesh).
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
Mesh 7. 3D Cylinder with periodic boundary conditions (external mesh).
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
Mesh 7. 3D Cylinder with periodic boundary conditions (external mesh).
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
Mesh 7. 3D Cylinder with periodic boundary conditions (external mesh).
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
Mesh 8. Meshing in parallel using snappyHexMesh. BWB body (external mesh) From now on, follow me.
In the terminal window type:
cd $ptofc/sHM_1/M9_bwb_parallel cp constant/triSurface/N2A_Hybrid.stl constant/triSurface/
surfacemesh.stl (The geometry was generated using openvsp)
surfaceTransformPoints scale (0.3048 0.3048 0.048) constant/triSurface/N2A_Hybrid.stl constant/triSurface/surfacemesh.stl (The geometry was generated using openvsp)
surfaceFeatureExtract blockMesh decomposePar
(Take a look at the dictionary decomposeParDict, here you need to specify the decomposition method and the number of partitions. Later on we are going to deal with running in parallel)
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
Mesh 8. Meshing in parallel using snappyHexMesh. BWB body (external mesh) From now on, follow me.
In the terminal window type:
mpirun np 8 snappyHexMesh parallel overwrite Notice the syntax used to run snappyHexMesh in parallel:
mpirun -np 8 snappyHexMesh parallel overwrite where mpirun is a shell script to use the mpi library (you need to install mpi), -np is the number of processors you want to use, -parallel is a flag that you shall always use if you want to run in parallel, and overwrite is an option specific to snappyHexMesh. paraFoam builtin
(To visualize the decomposed mesh)
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
Mesh 8. Meshing in parallel using snappyHexMesh. BWB body (external mesh) From now on, follow me.
In the terminal window type: mpirun np 8 checkMesh parallel
(To run checkMesh in parallel)
reconstructParMesh mergeTol 1e-06 constant (Reconstruct the mesh using geometry information only)
At this point you are ready to run the simulation, but first you will need to transfer the boundary and initial conditions to the decomposed mesh, to do this
decomposePar -fields
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
Mesh 8. Meshing in parallel using snappyHexMesh. BWB body (external mesh)
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
Mesh 8. Meshing in parallel using snappyHexMesh. BWB body (external mesh)
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
Mesh 8. Meshing in parallel using snappyHexMesh. BWB body (external mesh)
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
Mesh 9. Mixing elbow (internal mesh). Let us convert to OpenFOAM a mesh generated using Salome.
From now on, follow me.
Remember to export the mesh in UNV format in Salome. Then use the mesh converter utility ideasUnvToFoam to convert the mesh to OpenFOAM native format. In the terminal window type:
cd $ptofc/mesh_conversion_manipulation/M3_mixing_elbow_salome
salome (I added this alias to my .bashrc file. In case you do not have it, the mesh is in the directory ./mesh. The geometry is in the directory ./geometry)
ideasUnvToFoam ./mesh/Mesh_1.unv (The mesh is in the directory ./mesh)
checkMesh paraFoam
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
Mesh 10. Square tube with periodic boundary conditions (external mesh).
Let us convert the mesh from fluent format to OpenFOAM format. From now on, follow me.
In the terminal window type:
cd $ptofc/mesh_conversion_manipulation/M1_square_tube_periodic
fluent3DMeshToFoam ./mesh/ascii.msh (The mesh is in the directory ./mesh) Attention: The mesh must be in ascii format
createPatch (take a look at the dictionary createPatchDict) checkMesh paraFoam
Note: the createPatch utility will create a new mesh in the time folder 1 (if you chose a deltaT equal to 1 in controlDict). Remember to copy the folder 1/polyMesh to the folder constant/
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
Mesh 10. Square tube with periodic boundary conditions (external mesh).
Alternatively, createPatch can automatically overwrite the converted mesh contained in constant/polyMesh. In the terminal type:
createPatch -overwrite
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using blockMesh and snappyHexMesh
Todays lecture
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
1. Meshing preliminaries 2. Mesh quality assessment 3. Mesh conversion and manipulation utilities 4. Mesh generation using blockMesh and
snappyHexMesh 5. Mesh generation using open source tools 6. Hands-on session
Mesh generation using open source tools
Salome It is a complete pre and post processing application. It has quite extensive capabilities for creation and manipulation of solid geometries. Salome is capable of producing tetrahedral, hexahedral and prism meshes. For mesh generation the user has several algorithms available. Salome also comes with several mesh quality and manipulation tools.
Salome supports via Open Cascade the following solid geometry file formats: ACIS, Salome native BREP, IGES, and STEP. Solid geometries can be exported in ACIS, BREP, IGES, and STEP formats. Also STL (both ASCII and binary) can be used as the model export format.
Created meshes can be exported from salome in DAT, MED, I-deas UNV, and STL format (ASCII or binary). There is a utility for data conversion from UNV format to OpenFOAM mesh format.
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using open source tools
Engrid Engrid is a mesh generation software with CFD applications in mind. Engrid can generate tetrahedral meshes and prismatic boundary layer meshes.
Engrid can import Blender-Engrid files, GMSH files, and STL files (binary). Engrid also provides native export to OpenFOAM; this includes export capabilities for complete OpenFOAM cases (including boundary conditions), as well as experimental support for polyhedral cells.
GMSH Gmsh is a mesh generator with a build-in CAD engine and post-processor. It can generate 2D unstructured meshes (triangles or both triangles and quadrangles) and 3D unstructured meshes (tetrahedral). Gmsh can also be used to import STEP, BREP and IGES files and it can also be used for simple geometry modeling.
GMSH tetrahedral meshes can be converted into OpenFOAM format using the mesh converter utility. GMSH can also export meshes in I-deas UNV format.
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Friendliness Final quality of the mesh
BlockMesh
snappyHexMesh
Salome
engrid
GMSH
NETGEN
Triangle/Tetgen
Good Fairly Good Mild Bad Very Bad
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using open source tools
Mesh generation using open source tools Mesh 11. Mixing elbow (internal mesh).
Let us generate the mesh by using Salome. From now on, follow me.
At this point, you should have a geometry that looks like this one
Mesh generation using open source tools Mesh 11. Mixing elbow (internal mesh).
Let us generate the mesh by using Salome. From now on, follow me.
And at the end, our mesh should looks like this one (or close).
Mesh generation using open source tools Mesh 11. Mixing elbow (internal mesh).
Let us generate the mesh by using Salome. From now on, follow me.
For this tutorial, first you will need to create the geometry using Salome CAD module and then you will generate the mesh using Salome meshing module.
I will skip the geometry generation and mesh generation steps, as they will be covered in another tutorial.
I will only show you how to convert the mesh generated in Salome to OpenFOAM native format.
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using open source tools Mesh 11. Mixing elbow (internal mesh).
Let us generate the mesh by using Salome. From now on, follow me.
Remember to export the mesh in UNV format in Salome (.unv). Then use the mesh converter utility ideasUnvToFoam to convert the mesh to OpenFOAM native format.
In the terminal window type:
cd $ptofc/mesh_conversion_manipulation/M3_mixing_elbow_salome
ideasUnvToFoam ./mesh/Mesh_1.unv (The mesh is in the directory ./mesh)
checkMesh paraFoam
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using open source tools Mesh 12. Mixing elbow (internal mesh).
Let us generate first the geometry using Salome and then the mesh by using GMSH.
From now on, follow me.
For this tutorial, first you will need to create the geometry using Salome CAD module or any other CAD or geometry generation application, then you will generate the mesh using GMSH.
I will skip the geometry generation part. Remember, you can use any geometry generation application.
I highly recommend you to save the geometry in STEP format. However, any valid CAD exchange format will work.
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using open source tools Mesh 12. Mixing elbow (internal mesh).
Let us generate first the geometry using Salome and then the mesh by using GMSH.
From now on, follow me.
Remember to save the mesh in GMSH format (.msh). Then use the mesh converter utility gmshToFoam to convert the mesh to OpenFOAM native format.
In the terminal type: cd $ptofc/mesh_conversion_manipulation/M9_mixing_elbow_gmsh
(The geometry is in the directory ./geometry) gmsh
(In GMSH open the STEP file located in ./geometry and from this point on follow me.) gmshToFoam ./mesh/geo.msh
(The sample mesh is in the directory ./mesh. If you generated a mesh of your own, just add the right file name and path)
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using open source tools Mesh 12. Mixing elbow (internal mesh).
Let us generate first the geometry using Salome and then the mesh by using GMSH.
From now on, follow me.
If you did not assign the surface boundaries in GMSH, when you convert the mesh to OpenFOAM format, it will save only one patch. To automatically detect the patches (or surface boundaries), you can use the utility autoPatch. Believe me, this utility will make your life easier.
In the terminal type: cd $ptofc/mesh_conversion_manipulation/M9_mixing_elbow_gmsh
(The geometry is in the directory ./geometry) autoPatch 45
(It will save the new mesh in the time directory ./0.005.) paraFoam
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Mesh generation using open source tools Mesh 12. Mixing elbow (internal mesh).
Let us generate first the geometry using Salome and then the mesh by using GMSH.
And at the end, our mesh should looks like this one (or close).
Mesh generation using open source tools Mesh 12. Mixing elbow (internal mesh).
Let us generate first the geometry using Salome and then the mesh by using GMSH.
Mesh generation using open source tools Mesh 12. Mixing elbow (internal mesh).
Let us generate first the geometry using Salome and then the mesh by using GMSH.
Mesh generation using open source tools Mesh 13. Sphere (external mesh).
Let us generate first the geometry using blender and then the mesh by using Engrid.
From now on, follow me.
For this tutorial you will first need to generate the geometry using blender (or whatever you want to use). I will use blender. In the terminal type:
cd $ptofc/mesh_conversion_manipulation/M7_sphere_engrid (The blender file and STL file are already here)
blender (For geometry modeling. Do not forget to export the geometry in STL format)
$path_to_engrid/engrid/run.bash (For mesh generation)
Mesh generation using open source tools
Additional tutorials In the directories $ptofc/sHM_1, $ptofc/sHM_2, $ptofc/mesh_conversion_manipulation and $ptofc/geometries_meshers_tutorials, you will find many tutorials, try to go through each one to understand and get functional using the meshing tools.
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
Thank you for your attention
Todays lecture
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.
1. Meshing preliminaries 2. Mesh quality assessment 3. Mesh conversion and manipulation utilities 4. Mesh generation using blockMesh and
snappyHexMesh 5. Mesh generation using open source tools 6. Hands-on session
Hands-on session
In the courses directory ($ptofc) you will find many tutorials (which are different from those that come with the OpenFOAM installation), let us try to go through each one to understand and get functional using OpenFOAM. If you have a case of your own, let me know and I will try to do my best to help you to setup your case. But remember, the physics is yours.
This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM and OpenCFD trade marks.