CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Meshing & Mesh Conversion (https://www.cfd-online.com/Forums/openfoam-meshing/)
-   -   [Gmsh] gmsh errors on openfoam checkmesh (https://www.cfd-online.com/Forums/openfoam-meshing/224089-gmsh-errors-openfoam-checkmesh.html)

mariloo February 6, 2020 11:55

gmsh errors on openfoam checkmesh
 
5 Attachment(s)
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.

mzzmrt February 8, 2020 17:46

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

HPE February 9, 2020 11:29

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.

mariloo February 9, 2020 12:15

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 :(

NablaDyn February 9, 2020 12:59

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.

mariloo February 9, 2020 15:25

H NablaDyn! Do you mean I should create a structured mesh around the airfoil and then extrude it?

HPE February 9, 2020 16:00

>> 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 February 9, 2020 16:01

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.

NablaDyn February 10, 2020 02:12

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).

mariloo February 10, 2020 03:26

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?

NablaDyn February 10, 2020 03:53

Quote:

Originally Posted by mariloo (Post 757403)
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 (Post 757403)
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.

mariloo February 10, 2020 04:08

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.

NablaDyn February 10, 2020 04:12

Quote:

Originally Posted by mariloo (Post 757416)
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?

mariloo February 10, 2020 04:15

Yes exactly, the tip is fully immersed in the flow field and the root of the wing instead lies on the back plane surface.

NablaDyn February 10, 2020 04:26

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.

mariloo February 10, 2020 17:14

Thanks very much to everyone who replied �� I will try the solutions you suggested!

mariloo February 10, 2020 17:15

Thanks very much to everyone who replied 😊 I will try the solutions you suggested!


All times are GMT -4. The time now is 16:12.