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: Structured variation in gridsize (https://www.cfd-online.com/Forums/openfoam-meshing/194226-gmsh-structured-variation-gridsize.html)

Alasir October 11, 2017 19:56

Gmsh: Structured variation in gridsize
 
Greetings!

While I have a rudimentary understanding of how to use the Transfinite Surface and Recombine Surface functions to make a structured mesh, I'm more confused on getting them to make a structured mesh whos mesh density varies.


Problem description:
I have a channel. Inside, on the bottom of the channel, there is a series of complex geometries. I want to make the inlet, outle, and both sides cyclic. As such, I need to make those (perfectly rectangular) surfaces structured (the kind of structure is irrelevant, as long as it matches the opposing side). I manage to do this when I use the same gridsize everywhere on the surface, but I want to make the bottom part much denser than the top.

Anyone know how to do this or can link me to a good tutorial for this? I can seem to find any that deal with this issue.

Flowkersma October 12, 2017 06:02

Hi Anders,

There are basically two different stretching functions available for a line in GMSH. One applies the stretching to one end of the line and another to both ends of the line (Progression and Bump).
The GMSH documentation has a tutorial which shows how to use them.

Regards,
Mikko

dokeun June 12, 2019 01:29

How to calculate grid size when Progression or Bump is used?
 
Dear Mikko and other Gmsh users.

Is there formulation to calculate grid size when progression or bump is used in gmsh?

Thank you in advance :)

Flowkersma June 12, 2019 07:38

HI Dokeun,

The progression uses geometric series for the refinement. I don't know about the bump.

dokeun June 20, 2019 08:14

Thank you for your link, Mikko.

I need to scrutinize the page and search for other resources.

Iíll post when I get some info.

Mondal131211 July 10, 2019 19:19

Quote:

Originally Posted by dokeun (Post 736807)
Thank you for your link, Mikko.

I need to scrutinize the page and search for other resources.

Iíll post when I get some info.

Hi Dokeun,


Did you find your answer about progression and Bump? I am also looking for a clarity of progression and Bump in Gmsh. If you got it, Can you please share it for me?


Cheers
Razon

dokeun July 12, 2019 11:23

1 Attachment(s)
Quote:

Originally Posted by Mondal131211 (Post 738617)
Hi Dokeun,


Did you find your answer about progression and Bump? I am also looking for a clarity of progression and Bump in Gmsh. If you got it, Can you please share it for me?


Cheers
Razon

Hi,

Sorry for late reply. Actually I didn't think about this problem so much.

But I studied to reply to your question and I have the answer for 'progression' for now.

The progression is geometric sequence(https://www.mathsisfun.com/algebra/s...geometric.html)

For a given curve, let the length of it as 'l' and this is the sum of a geometric series.

When you transfinite the curve with the number of points(np) and progression(r). Then the relationship among the first distance(a), total curve length(l), number of points(np) and progression(r)

in the viewpoint of geometric series, np is to be replaced with number of 1D elements(n = np-1, ex: if there is 11 points then number of 1D elements are 10)

Then, according to the formula for the sum of geometric series...
Code:

l=a(r^n - 1)/(r-1)
rearranging this equation yields.
Code:

a=l*(r-1)/(r^n - 1)
For example, if you transfinite a curve in which l = 100 with np = 11, r = 2 then the first point is to be 0.097751710....
simple code is as below
Code:

Point(1) = {0, 10, 0, 1e-1};
Point(2) = {100, 10, 0, 1e-1};
Line(1) = {1, 2};
Transfinite Curve {1} = 11 Using Progression 2;

and check the screen shot I attached.

Actually you can find a explantion for progress in gmsh guide
Code:

(Progression 2 meaning for example that each line element in the series will be twice as long as the preceding one).
For the bump we can check the code in line 181.

https://gitlab.onelab.info/gmsh/gmsh.../meshGEdge.cpp

It's not easy to understand but you might calculate the first point with your setting at least.

Good luck

Mondal131211 July 17, 2019 23:23

3 Attachment(s)
Quote:

Originally Posted by dokeun (Post 738783)
Hi,

Sorry for late reply. Actually I didn't think about this problem so much.

But I studied to reply to your question and I have the answer for 'progression' for now.

The progression is geometric sequence(https://www.mathsisfun.com/algebra/s...geometric.html)

For a given curve, let the length of it as 'l' and this is the sum of a geometric series.

When you transfinite the curve with the number of points(np) and progression(r). Then the relationship among the first distance(a), total curve length(l), number of points(np) and progression(r)

in the viewpoint of geometric series, np is to be replaced with number of 1D elements(n = np-1, ex: if there is 11 points then number of 1D elements are 10)

Then, according to the formula for the sum of geometric series...
Code:

l=a(r^n - 1)/(r-1)
rearranging this equation yields.
Code:

a=l*(r-1)/(r^n - 1)
For example, if you transfinite a curve in which l = 100 with np = 11, r = 2 then the first point is to be 0.097751710....
simple code is as below
Code:

Point(1) = {0, 10, 0, 1e-1};
Point(2) = {100, 10, 0, 1e-1};
Line(1) = {1, 2};
Transfinite Curve {1} = 11 Using Progression 2;

and check the screen shot I attached.

Actually you can find a explantion for progress in gmsh guide
Code:

(Progression 2 meaning for example that each line element in the series will be twice as long as the preceding one).
For the bump we can check the code in line 181.

https://gitlab.onelab.info/gmsh/gmsh.../meshGEdge.cpp

It's not easy to understand but you might calculate the first point with your setting at least.

Good luck

Hi Dokeun,


Fantastic explanation. It does make sense to me.

First of all, sorry for my late reply as I was not at my office. I understood your explanation about progression. Now lets be a bit more realistic about whats happening in the Gmsh screen when playing with progression. Please have a look at the attachment. I made a simple square cube with 10x10 cells using Gmsh. Lets say, I would like to keep more dense cells close to the left wall (line 1) using progression. I played with changing progression value but no luck so far.


Could you please tell how can I do that?


Cheers
Razon

dokeun July 18, 2019 09:28

Quote:

Originally Posted by Mondal131211 (Post 739257)
Hi Dokeun,


Fantastic explanation. It does make sense to me.

First of all, sorry for my late reply as I was not at my office. I understood your explanation about progression. Now lets be a bit more realistic about whats happening in the Gmsh screen when playing with progression. Please have a look at the attachment. I made a simple square cube with 10x10 cells using Gmsh. Lets say, I would like to keep more dense cells close to the left wall (line 1) using progression. I played with changing progression value but no luck so far.


Could you please tell how can I do that?


Cheers
Razon

Hi
you have to choose 2 curves for transfinite. The left and the right.
if the grids are not even after transfinite, then
Probably you can fix it just change the sign for one side of the curves

If the curve numbers are 1 ,2 then

From
Transfinite curve {1, 2}
To
Transfinite curve {1, -2}

Good luck~


All times are GMT -4. The time now is 17:23.