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: "Physical Volume" of a NACA airfoil? (https://www.cfd-online.com/Forums/openfoam-meshing/142741-gmsh-physical-volume-naca-airfoil.html)

sisi October 8, 2014 11:32

Gmsh: "Physical Volume" of a NACA airfoil?
 
1 Attachment(s)
I am trying to mesh a NACA airfoil that can be later on imported into OpenFOAM. I searched for information about that on the internet. That's what I found so far:

https://community.dur.ac.uk/g.l.ingr...torial2012.pdf

On page 5 the tutorial says that one have to define a "Physical Volume". The attached file shows what I have so far. Gmsh shows up two volumes (yellow points). One inside the Airfoil (Volume 1) and the other one outside the airfoil (Volume 2). Which volume do I have to select!?

alexeym October 8, 2014 11:54

Hi,

cause you need to mesh volume around airfoil (as you need to know flow around the airfoil), you have to select volume outside the airfoil.

sisi October 8, 2014 15:44

1 Attachment(s)
Ok, that sounds logical. Thank you. I combined the two surfaces into one surface (see attached file). When I press "3" nothing happens!? What's wrong here?

alexeym October 9, 2014 03:25

2 Attachment(s)
Hi,

what's the version of your Gmsh? 2.8.5 was able to produce the mesh. Though with certain nuances:
  • Mesh is prismatic (I think everybody will prefer hexagonal mesh).
  • There is a plane at one side of the airfoil that should not be there (shown with green on attached picture). Though this plane disappears after GEO -> MSH -> gmshToFoam procedure (see second attachment).

sisi October 10, 2014 04:34

I am using Gmsh Version 2.8.3 (Ubuntu 14.04). Sometimes meshing works but I can't zoom in or out. Gmsh stops responding or freezes frequently. I will try the latest stable version 2.8.5.

Why is Gmsh meshing inside the airfoil..!?

alexeym October 10, 2014 11:34

Hi,

Quote:

Originally Posted by sisi (Post 513676)
I am using Gmsh Version 2.8.3 (Ubuntu 14.04). Sometimes meshing works but I can't zoom in or out. Gmsh stops responding or freezes frequently. I will try the latest stable version 2.8.5.

I've just checked 2.8.5 on Linux and it builds the mesh more-or-less OK (previously I've checked the file on OS X).

Quote:

Why is Gmsh meshing inside the airfoil..!?
Well... frankly speaking I'm quite surprised that Gmsh builds anything at all ;) In general I use the following sequence during definition of the mesh in Gmsh (let's assume that we're building unstructured mesh):

1. Define points - you've done it.
2. Define lines connecting points - you've done it.
3. Define surfaces (in you case those will be several plane surfaces - outer boundaries and couple of ruled surfaces - surface of the airfoil) - you've started doing it...
4. Define geometric volumes using bounding surfaces defined during step 3 - well, you've decided to go straightly to defining physical surfaces and volumes.
5. Finally I define physical groups of surfaces (future patches) and physical volume (only one but still we need to define it).

I guess, in case of your file, Gmsh is trying to guess volumes those it needs to mesh. Sometimes Gmsh does it successfully, sometimes - not (for example it decides to mesh additional plane).

sisi October 10, 2014 15:13

1 Attachment(s)
Thank you for your help. I have attached my newest version. I tried to follow your instructions:

1. Points
2. Lines (Splines, Line Loop, Rotate Line)
3. Surfaces

That seems to work now. And I tried Gmsh 2.8.5., too. This version seems to work better.

I have one more question:

Quote:

Originally Posted by alexeym (Post 513502)

Though with certain nuances:
  • Mesh is prismatic (I think everybody will prefer hexagonal mesh).

How can I adjust these settings?

alexeym October 12, 2014 06:53

1 Attachment(s)
Hi,

to generate structured meshes, you need to utilize transfinite lines (and then surfaces, and volumes) - http://www.geuz.org/gmsh/doc/texinfo...ructured-grids.

Though to use transfinite algorithm you have to modify mesh file. Gmsh can use this algorithm for surfaces with 4 corners and volumes with 6 corners. So you have to divide the area around the airfoil as shown on attached figure, as usual define points, lines, surfaces and volumes and then first define lines as transfinite:

Code:

Transfinite Line {line entity numbers} = <number of points on the line>;
And after all lines are described as transfinite, you can define surfaces and volumes as transfinite using:

Code:

Transfinite Surface "*";
Recombine Surface "*";

Transfinite Volume "*";

With transfinite lines you can control density of the mesh using "Using Progression" clause in line definition. So you can have more dense mesh near the surface of the airfoil and more coarse mesh in the areas of low flow parameters gradients.

Maybe you'll need to move point A to the left to reduce non-orthogonality of the mesh around point F.

sisi October 13, 2014 08:35

1 Attachment(s)
Ok, so my plan is as follows: I will start with an unstructured grid (easily meshed, rapid generation, quick progress etc...). So I can go on learning OpenFOAM. When I got my first results I will try to create a structured grid.

I have attached the newest version of my .geo file. Before I go on converting the mesh to OpenFOAM can someone please double check my .geo file?

@ alexeym: Thank you so much for your support! :)

alexeym October 13, 2014 09:10

Gmsh 2.8.5 has generated quite descent mesh, here's checkMesh output:

Code:

Checking geometry...
    Overall domain bounding box (-5 -5 0) (6 5 1)
    Mesh (non-empty, non-wedge) directions (1 1 1)
    Mesh (non-empty) directions (1 1 1)
    Boundary openness (-4.10252e-18 2.52463e-18 -9.75447e-16) OK.
    Max cell openness = 2.09221e-16 OK.
    Max aspect ratio = 846.979 OK.
    Minimum face area = 3.26324e-06. Maximum face area = 0.278444.  Face area magnitudes OK.
    Min volume = 3.26324e-06. Max volume = 0.0251815.  Total volume = 109.898.  Cell volumes OK.
    Mesh non-orthogonality Max: 34.1439 average: 7.41136
    Non-orthogonality check OK.
    Face pyramids OK.
    Max skewness = 0.491911 OK.
    Coupled point location match (average 0) OK.

Mesh OK.

You can add

Code:

Mesh 3;
Save "NACA2415AngleOfAttack12.msh";

to the end of GEO file, so gmsh will generate and save mesh automatically.

sisi October 13, 2014 10:36

Quote:

Originally Posted by alexeym (Post 514088)
You can add

Code:

Mesh 3;
Save "NACA2415AngleOfAttack12.msh";

to the end of GEO file, so gmsh will generate and save mesh automatically.

Meshing works but I get the following error message: Unknown command 'Save' :confused:

alexeym October 13, 2014 11:43

Hi,

I'm also :confused: cause my Gmsh doesn't complain about Save (even installed 2.8.3 to check).

sisi October 13, 2014 16:33

Sorry, my fault :rolleyes:

Edit: I wrote a GNU Octave script to create the geo file and the reason for the error was that I forgot to add a new line:

Code:

...
fprintf(fileID,'Mesh 3;\r\n');
fprintf(fileID,'Save "%s";\r\n',filenameMsh)



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