CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Meshing & Mesh Conversion

[Gmsh] gmsh errors on openfoam checkmesh

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 6, 2020, 11:55
Default gmsh errors on openfoam checkmesh
  #1
New Member
 
mariloo's Avatar
 
Mariya Verkhovodova
Join Date: Dec 2019
Posts: 11
Rep Power: 6
mariloo is on a distinguished road
Hello everybody!! I apologize in advance for my bad english, it's not my mothertongue.

I'm trying to create a 3D mesh of a finite wing NACA0012 for the purpose to study the tip vortices. I'm using Gmsh for meshing and OpenFoam for the CFD analysis.
The problem is that I need to create a 3D boundary layer around the finite wing and obviously it's not possible because gmsh currently allows to create only a 2D boundary layer field.
The only solution I found was to do a sort of offset of the profile, extrude it and then define the different surfaces and volumes. At the end I obtained a kind of boundary layer with structured mesh and the rest of domain was unstructured.
When I finally exported the mesh and converted it to Openfoam, I ran into different checkmesh errors such as negative volumes, non orthogonal faces, ecc. And I'm not able to proceed with any analysis.
I've been struggling for weeks now trying to understand how to fix this problem and I'm running out of time for my thesis project. Can anybody help?

In attached files you will find the .geo file, some screenshots of the mesh and of the checkmesh errors.
Attached Images
File Type: jpg imm1.jpg (202.4 KB, 16 views)
File Type: png imm2.png (130.1 KB, 17 views)
File Type: png imm3.png (60.2 KB, 17 views)
File Type: png errors.png (43.9 KB, 18 views)
Attached Files
File Type: txt Finite_wing.txt (13.3 KB, 4 views)
mariloo is offline   Reply With Quote

Old   February 8, 2020, 17:46
Default
  #2
Senior Member
 
Join Date: Mar 2014
Posts: 112
Rep Power: 12
mzzmrt is on a distinguished road
Open cells and negative cells errors are specially critical. You have to change some meshing parameters try to understand the cause of the problems, start with a coarser mesh. Possibly the problematic area is around the trailing edge.

On the other hand, for a wing-tip study meshing a certesian mesher may be a far easier solution to get a usable mesh so the options are snappyHexMesh and cfMesh.

Here is a sample case for cfMesh: github.com/petebachant/foilInBox-cfMesh
mzzmrt is offline   Reply With Quote

Old   February 9, 2020, 11:29
Default
  #3
HPE
Senior Member
 
HPE's Avatar
 
Herpes Free Engineer
Join Date: Sep 2019
Location: The Home Under The Ground with the Lost Boys
Posts: 932
Rep Power: 12
HPE is on a distinguished road
I think you can find a good number of tutorials in OpenFOAM to provide you at least 2D NACA0012 mesh. I think you can also find such tutorials online somewhere in the web or in OpenFOAMWiki.net. Once you have 2D mesh, by using `extrudeMesh` functionality, you can extrude the domain in the spanwise direction.

Please have another look for tutorials.
HPE is offline   Reply With Quote

Old   February 9, 2020, 12:15
Default
  #4
New Member
 
mariloo's Avatar
 
Mariya Verkhovodova
Join Date: Dec 2019
Posts: 11
Rep Power: 6
mariloo is on a distinguished road
I will start doing a coarser mesh and then I will try to refine it gradually. By the way you are right, I also think the problem could be the trailing edge, because it's very thin. However I cannot change the airfoil geometry and my supervisor said I must use gmsh
mariloo is offline   Reply With Quote

Old   February 9, 2020, 12:59
Default
  #5
Senior Member
 
NablaDyn's Avatar
 
Join Date: Oct 2015
Location: Germany
Posts: 100
Rep Power: 10
NablaDyn is on a distinguished road
You can find out which cells are causing trouble, e.g., using the -writeAllFields flag for checkMesh. You can then directly view cells of high skewness etc. in ParaView by applying a threshold filter on the quality field of interest.

3d tetras is perhaps the least suited mesh type for your problem. If your wing is not swept and tetras are not a must, I would go for 2d quads and extrude the final 2d mesh by one layer.
NablaDyn is offline   Reply With Quote

Old   February 9, 2020, 15:25
Default
  #6
New Member
 
mariloo's Avatar
 
Mariya Verkhovodova
Join Date: Dec 2019
Posts: 11
Rep Power: 6
mariloo is on a distinguished road
H NablaDyn! Do you mean I should create a structured mesh around the airfoil and then extrude it?
mariloo is offline   Reply With Quote

Old   February 9, 2020, 16:00
Default
  #7
HPE
Senior Member
 
HPE's Avatar
 
Herpes Free Engineer
Join Date: Sep 2019
Location: The Home Under The Ground with the Lost Boys
Posts: 932
Rep Power: 12
HPE is on a distinguished road
>> my supervisor said I must use gmsh

If you are a PhD candidate, don't give a f.ck with your supervisor. PhD supervision's role is limited to `facilitate` your work, they cannot tell you what to do.

OF will not operate with tetra-based meshes as good as it does with hexa-based meshes.

There are plenty of NACA0012 meshes available for your expense to be used in OF, for example:

https://turbmodels.larc.nasa.gov/naca0012_grids.html (particularly this one, if you want to use good quality grids)
https://develop.openfoam.com/Develop...Foam/airFoil2D
https://www.openfoam.com/documentati...irfoil-2d.html
https://develop.openfoam.com/Develop...rofoilNACA0012
https://develop.openfoam.com/Develop...yMaps/naca0012
https://develop.openfoam.com/Develop...onalRefinement
https://github.com/openfoamtutorials/airfoil_validation

Two side notes:
- OpenFOAM always uses unstructured mesh. Unlike the wrong usage, structured mesh means index-access of cell centres (not the hexahedral shape of cells). For OpenFOAM, the cell centre access is carried out by an indirect-addressing system, which is unstructured.

- There is no 2D mesh capability in OpenFOAM (apart from finiteArea modules). So 2D flow computations are achieved by making spanwise boundaries as cyclic, hence infinite span. If you have a 2D or one-cell thick mesh, you can extrude the spanwise direction by simply using `extrudeMesh` utility in OF, and make spanwise boundaries as symmetry. So the simulation will truly be 3D.

Hope it helps.
HPE is offline   Reply With Quote

Old   February 9, 2020, 16:01
Default
  #8
HPE
Senior Member
 
HPE's Avatar
 
Herpes Free Engineer
Join Date: Sep 2019
Location: The Home Under The Ground with the Lost Boys
Posts: 932
Rep Power: 12
HPE is on a distinguished road
Additionally, to get more detail out of `checkMesh`:

`checkMesh -allGeometry -allTopology`

You can add `-writeAllFields`option to visualise the mesh metrics as fields for convenience.

For any OF command you can use `-help`, or `banana` technique, where you write `banana` for an entry, and run the case, so that OF throws an error and provide you a list of available options.
HPE is offline   Reply With Quote

Old   February 10, 2020, 02:12
Default
  #9
Senior Member
 
NablaDyn's Avatar
 
Join Date: Oct 2015
Location: Germany
Posts: 100
Rep Power: 10
NablaDyn is on a distinguished road
Hi mariloo,
I think HPE laid it all out pretty clearly: Exhaust checkMesh, if need be. However, if you use hex/quad meshes you will probably run into fewer problems than with tets. And although OF is unstructured by design, it can access many favourable aspects of structured meshes through the resulting shape of the system matrix. It would be worthwhile to have a look at Jasak's or Juretic's theses as well as the popular CFD textbooks (Ferziger, Moukalled etc.) to get familiar with meshes and the role they play in terms of accuracy, stability, convergence. You will understand why tet is pretty much the worst choice for such regular geometries.

Also, I strongly agree with HPE regarding the restriction to use gmsh. In my experience it is rather useful for FEM and only rarely for CFD. There's plenty of better suited software out there for your problem than gmsh (cfmesh, megacads, blockmesh etc.) and I can see absolutely no reason why someone would prefer to use it except for the scripting function. But such is also natively achievable in megacads or blockmesh (and they are free as well).
NablaDyn is offline   Reply With Quote

Old   February 10, 2020, 03:26
Default
  #10
New Member
 
mariloo's Avatar
 
Mariya Verkhovodova
Join Date: Dec 2019
Posts: 11
Rep Power: 6
mariloo is on a distinguished road
You suggest to create a 2D structured mesh around the airfoil and at the tip and then extrude it to obtain a 3D mesh with hex? I will try this solution with gmsh and if it doesn't work I will speak to my supervisor and consider switching to a different meshing tool. If it was up to me I would have done it long before �� Antoher question: do you think if I make a more rounded surface tip instead of 90 angle surface would be better for meshing?
mariloo is offline   Reply With Quote

Old   February 10, 2020, 03:53
Default
  #11
Senior Member
 
NablaDyn's Avatar
 
Join Date: Oct 2015
Location: Germany
Posts: 100
Rep Power: 10
NablaDyn is on a distinguished road
Quote:
Originally Posted by mariloo View Post
You suggest to create a 2D structured mesh around the airfoil and at the tip and then extrude it to obtain a 3D mesh with hex?

Exactly, I think a traditional C-type mesh topology should work best for your case. Such is also the type of structured mesh downloadable from NASA suggested by HPE in one of the former posts. Since you assume a non-swept wing, one extrusion layer in normal direction is sufficient.



The easiest way, by far, would be to simply adopt the NACA0012 mesh already shipped with the OpenFOAM tutorials (just have a look at the $FOAM_TUTORIALS/compressible/rhoSimpleFoam/aeroFoil... case). It is given as highly parametric blockMeshDict, so: Ready to use and easy to customise. Even the entire case itself is ready to run.


Quote:
Originally Posted by mariloo View Post
I will try this solution with gmsh and if it doesn't work I will speak to my supervisor and consider switching to a different meshing tool. If it was up to me I would have done it long before �� Antoher question: do you think if I make a more rounded surface tip instead of 90 angle surface would be better for meshing?

I assume you are referring to the trailing edge? This is just one of the problems that can regularly occur when you employ an unstructured mesher to airfoil geometries as they often unsuccessfully try to resolve such features. When you use structured C-type meshes, this won't be an issue. The upper and lower mesh "branches" will then very elegantly connect at the trailing edge.
NablaDyn is offline   Reply With Quote

Old   February 10, 2020, 04:08
Default
  #12
New Member
 
mariloo's Avatar
 
Mariya Verkhovodova
Join Date: Dec 2019
Posts: 11
Rep Power: 6
mariloo is on a distinguished road
NablaDyn I actually refer to a finite wing case, I need to close the tip surface because I want to simulate tip vortices. I've seen there's no such case in openfoam tutorials.
mariloo is offline   Reply With Quote

Old   February 10, 2020, 04:12
Default
  #13
Senior Member
 
NablaDyn's Avatar
 
Join Date: Oct 2015
Location: Germany
Posts: 100
Rep Power: 10
NablaDyn is on a distinguished road
Quote:
Originally Posted by mariloo View Post
NablaDyn I actually refer to a finite wing case, I need to close the tip surface because I want to simulate tip vortices. I've seen there's no such case in openfoam tutorials.

Ok, so I understand you need a fully 3D setup where the wing tip is also fully immersed in the flow field. Right?
NablaDyn is offline   Reply With Quote

Old   February 10, 2020, 04:15
Default
  #14
New Member
 
mariloo's Avatar
 
Mariya Verkhovodova
Join Date: Dec 2019
Posts: 11
Rep Power: 6
mariloo is on a distinguished road
Yes exactly, the tip is fully immersed in the flow field and the root of the wing instead lies on the back plane surface.
mariloo is offline   Reply With Quote

Old   February 10, 2020, 04:26
Default
  #15
Senior Member
 
NablaDyn's Avatar
 
Join Date: Oct 2015
Location: Germany
Posts: 100
Rep Power: 10
NablaDyn is on a distinguished road
Alright, this is a different problem and makes strucutred meshing considerably more difficult, however still feasible. For structured meshes you will have to introduce some sort of transition/filling block(s) at the wing tip that reach(es) into the farfield. But such is usually elaborate and, in my opinion, would shift the interest back to unstructured approaches. But still, gmsh would be my last choice, i.a., because of the problem of feature capturing which you outlined above. Anyway, if you can convince your supervisor to change her/his mind, I would undoubtedly go for cfmesh. It is much easier to use than gmsh and also yields way better results for CFD. Even new users will be able to get a decent mesh within a few hours, rather than taking days getting familiar with specific GUIs etc.
NablaDyn is offline   Reply With Quote

Old   February 10, 2020, 17:14
Default
  #16
New Member
 
mariloo's Avatar
 
Mariya Verkhovodova
Join Date: Dec 2019
Posts: 11
Rep Power: 6
mariloo is on a distinguished road
Thanks very much to everyone who replied �� I will try the solutions you suggested!
mariloo is offline   Reply With Quote

Old   February 10, 2020, 17:15
Default
  #17
New Member
 
mariloo's Avatar
 
Mariya Verkhovodova
Join Date: Dec 2019
Posts: 11
Rep Power: 6
mariloo is on a distinguished road
Thanks very much to everyone who replied 😊 I will try the solutions you suggested!
mariloo is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[solidMechanics] Support thread for "Solid Mechanics Solvers added to OpenFOAM Extend" bigphil OpenFOAM CC Toolkits for Fluid-Structure Interaction 686 December 22, 2022 09:10
Superlinear speedup in OpenFOAM 13 msrinath80 OpenFOAM Running, Solving & CFD 18 March 3, 2015 05:36
Help for the small implementation in turbulence model shipman OpenFOAM Programming & Development 25 March 19, 2014 10:08
How to write k and epsilon before the abnormal end xiuying OpenFOAM Running, Solving & CFD 8 August 27, 2013 15:33
[Gmsh] 2D Mesh Generation Tutorial for GMSH aeroslacker OpenFOAM Meshing & Mesh Conversion 12 January 19, 2012 03:52


All times are GMT -4. The time now is 09:31.