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

[Gmsh] Gmsh: Structured variation in gridsize

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 11, 2017, 20:56
Question Gmsh: Structured variation in gridsize
  #1
Member
 
Anders Utnes
Join Date: May 2017
Location: Norway
Posts: 34
Rep Power: 4
Alasir is on a distinguished road
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.
Alasir is offline   Reply With Quote

Old   October 12, 2017, 07:02
Default
  #2
Senior Member
 
Mikko
Join Date: Jul 2014
Location: The Hague, The Netherlands
Posts: 197
Rep Power: 7
Flowkersma is on a distinguished road
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
Flowkersma is offline   Reply With Quote

Old   June 12, 2019, 02:29
Default How to calculate grid size when Progression or Bump is used?
  #3
Member
 
Dokeun, Hwang
Join Date: Apr 2010
Location: Korea, Republic of
Posts: 94
Rep Power: 11
dokeun is on a distinguished road
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
dokeun is offline   Reply With Quote

Old   June 12, 2019, 08:38
Default
  #4
Senior Member
 
Mikko
Join Date: Jul 2014
Location: The Hague, The Netherlands
Posts: 197
Rep Power: 7
Flowkersma is on a distinguished road
HI Dokeun,

The progression uses geometric series for the refinement. I don't know about the bump.
Flowkersma is offline   Reply With Quote

Old   June 20, 2019, 09:14
Default
  #5
Member
 
Dokeun, Hwang
Join Date: Apr 2010
Location: Korea, Republic of
Posts: 94
Rep Power: 11
dokeun is on a distinguished road
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.
dokeun is offline   Reply With Quote

Old   July 10, 2019, 20:19
Default
  #6
Member
 
Mondal
Join Date: Sep 2018
Location: Canberra ACT
Posts: 54
Rep Power: 3
Mondal131211 is on a distinguished road
Quote:
Originally Posted by dokeun View Post
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
Mondal131211 is offline   Reply With Quote

Old   July 12, 2019, 12:23
Default
  #7
Member
 
Dokeun, Hwang
Join Date: Apr 2010
Location: Korea, Republic of
Posts: 94
Rep Power: 11
dokeun is on a distinguished road
Quote:
Originally Posted by Mondal131211 View Post
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
Attached Images
File Type: jpg transfinite with progress 2.jpg (10.4 KB, 9 views)

Last edited by dokeun; July 12, 2019 at 12:49. Reason: grammer
dokeun is offline   Reply With Quote

Old   July 18, 2019, 00:23
Default
  #8
Member
 
Mondal
Join Date: Sep 2018
Location: Canberra ACT
Posts: 54
Rep Power: 3
Mondal131211 is on a distinguished road
Quote:
Originally Posted by dokeun View Post
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
Attached Images
File Type: png progression value 1.png (5.7 KB, 0 views)
File Type: png progression value 1.2.png (9.9 KB, 0 views)
Attached Files
File Type: gz cube.tar.gz (324 Bytes, 0 views)
Mondal131211 is offline   Reply With Quote

Old   July 18, 2019, 10:28
Default
  #9
Member
 
Dokeun, Hwang
Join Date: Apr 2010
Location: Korea, Republic of
Posts: 94
Rep Power: 11
dokeun is on a distinguished road
Quote:
Originally Posted by Mondal131211 View Post
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~
dokeun is offline   Reply With Quote

Reply

Tags
cyclic, gmsh, mesh density, structured mesh

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
[Gmsh] Structured meshing in Gmsh the_phew OpenFOAM Meshing & Mesh Conversion 17 August 3, 2017 11:00
[Gmsh] Gmsh: Unstructured to Structured Mesh geometry ChasingNeutrons OpenFOAM Meshing & Mesh Conversion 0 November 22, 2016 13:55
structured and unstructured grids user Main CFD Forum 6 November 25, 2010 02:14
Structured Mesh in GMSH vitor Main CFD Forum 4 April 28, 2010 09:15
[Gmsh] Import problem ARC OpenFOAM Meshing & Mesh Conversion 0 February 27, 2010 11:56


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