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

[snappyHexMesh] SnappyHexMesh Refinement nCellsBetweenLevels

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By laymelek
  • 1 Post By wyldckat

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 31, 2011, 06:29
Default SnappyHexMesh Refinement nCellsBetweenLevels
  #1
New Member
 
Levent Aymelek
Join Date: Aug 2011
Posts: 12
Rep Power: 15
laymelek is on a distinguished road
Hi all,
I am trying to formulate effect of nCellsBetweenLevels parameter. I have meshed one case with different value.

I was thinking that when nCellsBetweenLevels=10 ( which i thought that is a very high value) there will be 10 cells between 2 levels of refinement in each direction. But as u can see from the screenshots its not like that at all. When i increase the value to 50, i get hardly 6 cells between two levels.

Does anyone can explain me what does the value of nCellsBetweenLevels exactly refers to?

nCellsBetweenLevels =10
noofcellbetweenlevels10.jpg
nCellsBetweenLevels =50
noofcellbetweenlevels50.jpg
rmaries likes this.
laymelek is offline   Reply With Quote

Old   August 16, 2014, 16:21
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings to all!

@laymelek: Sorry for the reaaaally late reply. That looks like a bug that existed on that older version of OpenFOAM .

I'm answering to this thread so that questions related to this parameter "nCellsBetweenLevels" this can be discussed in a single thread.

At the request of the forum member CFDUser_, I've added a new section "nCellsBetweenLevels" at openfoamwiki.net in the page respective to snappyHexMesh: http://openfoamwiki.net/index.php/Sn...sBetweenLevels

If anyone has questions about this, feel free to ask!

Best regards,
Bruno


PS: In case anyone is wondering: the CFD-Online forums prefer that discussions on a particular topic are kept in a single thread.
rmaries likes this.
__________________
wyldckat is offline   Reply With Quote

Old   August 17, 2014, 02:52
Default
  #3
Member
 
CFDUser
Join Date: Mar 2014
Posts: 59
Rep Power: 13
CFDUser_ is on a distinguished road
Dear Bruno,

What happened when you set nCellsBetweenLayers to 0? can you upload that picture too?
I have some suggestions if you may consider them as valid point.
1. When you consider a case by default please specify OpenFOAM version so that one can understand which version can reproduce the same results.
2. Since I have observed the definition of some parameters changed with different versions, please give us Dict files so that one can have clear idea about other parameters too.

Thanks a lot for your time and efforts.

Best Regards,
CFDUser_

Quote:
Originally Posted by wyldckat View Post
Greetings to all!

@laymelek: Sorry for the reaaaally late reply. That looks like a bug that existed on that older version of OpenFOAM .

I'm answering to this thread so that questions related to this parameter "nCellsBetweenLevels" this can be discussed in a single thread.

At the request of the forum member CFDUser_, I've added a new section "nCellsBetweenLevels" at openfoamwiki.net in the page respective to snappyHexMesh: http://openfoamwiki.net/index.php/Sn...sBetweenLevels

If anyone has questions about this, feel free to ask!

Best regards,
Bruno


PS: In case anyone is wondering: the CFD-Online forums prefer that discussions on a particular topic are kept in a single thread.
CFDUser_ is offline   Reply With Quote

Old   August 17, 2014, 11:55
Default
  #4
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Dear CFDUser_,

Thanks for the feedback!

Quote:
Originally Posted by CFDUser_ View Post
What happened when you set nCellsBetweenLayers to 0? can you upload that picture too?
Ooops, I forgot to document the valid values. I've updated the subsection with an entry "Valid values": http://openfoamwiki.net/index.php/Sn...sBetweenLevels

Quote:
Originally Posted by CFDUser_ View Post
I have some suggestions if you may consider them as valid point.
1. When you consider a case by default please specify OpenFOAM version so that one can understand which version can reproduce the same results.
Good reminder, I forgot to indicate which versions that analysis applies to. I've updated the subsection accordingly: http://openfoamwiki.net/index.php/Sn...sBetweenLevels

Quote:
Originally Posted by CFDUser_ View Post
2. Since I have observed the definition of some parameters changed with different versions, please give us Dict files so that one can have clear idea about other parameters too.
Strange, I thought that the wiki page already had an indication of where examples could be found. I've added a new section "Examples" on how they can be found: http://openfoamwiki.net/index.php/Sn...xMesh#Examples

Beyond this, feel free to edit the wiki page and improve it!

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   August 18, 2014, 01:14
Default
  #5
Member
 
CFDUser
Join Date: Mar 2014
Posts: 59
Rep Power: 13
CFDUser_ is on a distinguished road
Dear Bruno,

Good day . Thanks once again for your explanations.
what is gapLevelIncrement in refine surfaces sub-dict?


Thanks & Regards,
CFDUser_
CFDUser_ is offline   Reply With Quote

Old   August 18, 2014, 16:51
Default
  #6
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi CFDUser_,

If you document in that wiki page one or more parameter(s) with which you are already familiar with, I can try next weekend to figure out and document "gapLevelIncrement".

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   August 19, 2014, 08:01
Default
  #7
Member
 
CFDUser
Join Date: Mar 2014
Posts: 59
Rep Power: 13
CFDUser_ is on a distinguished road
Dear Bruno,

Coming 2-3 months are like hectic time for me. I will upload some of the valid cases in feature. My analysis are problem specific, so its not good to update in wiki pages. I will find out better way to post as I cant post my current cases as well.

Thanks & Regards,
CFDUser_


Quote:
Originally Posted by wyldckat View Post
Hi CFDUser_,

If you document in that wiki page one or more parameter(s) with which you are already familiar with, I can try next weekend to figure out and document "gapLevelIncrement".

Best regards,
Bruno
CFDUser_ is offline   Reply With Quote

Old   August 30, 2014, 09:39
Default
  #8
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi CFDUser_,

Quote:
Originally Posted by CFDUser_ View Post
My analysis are problem specific, so its not good to update in wiki pages. I will find out better way to post as I cant post my current cases as well.
Well, the reason why I used one of the cases from the snappyWiki was because it was a very simple case in which certain features can be tested.

It's very likely that if you extract only the problematic location of your geometry and create a base mesh only for that location, you'll be able to test a lot faster and a lot more possible workarounds for the problems you are getting with the whole geometry on that particular location.
Furthermore, those small test cases will then be so unrelated to the real geometry, that it will probably be almost impossible to deduce what it was from.

Beyond this, I'm quoting some feedback you sent me over PM back on August 26th, because this way it'll be easier for me to keep track of the things I still want to do in the near future, and because this way it's kept a public record of who discovered what:
Quote:
Originally Posted by CFDUser_
If you see in your documentation for nCellsBetweenLevels, you said "it's an error of 1 missing layer at level 1" for level 2 to 3. Actual reason is level0 is not exactly equal to base mesh cell size. Its equal to a factor times base mesh level 0 size. That factor is defined to balance number of faces in two different levels fall adjacent to each other. Since for nCellsBetweenLevels 2 the ratio is very high, for the next level (means nCellsBetweenLevels = 3), it won't choose cells in level0 to refine. Instead of the it will refine mode cells in level1.
This explanation will not improve confidence to choose right value for nCellsBetweenLevels but it will give some in-depth understanding for it.

Update if you are fully convinced with reason.
It's the end of the week for me and my brain isn't very cooperative today I'll keep a note to look into this as soon as my brain is rested and able to figure this out

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   November 10, 2018, 14:00
Default
  #9
New Member
 
Join Date: Oct 2018
Posts: 5
Rep Power: 8
Agit is on a distinguished road
Hello everyone,
I am new in this forum, but I would still like to know, if there is a fix for this bug? I am having the exact same trouble meshing with SHM.
Agit is offline   Reply With Quote

Old   November 11, 2018, 18:22
Default
  #10
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Quote:
Originally Posted by Agit View Post
if there is a fix for this bug? I am having the exact same trouble meshing with SHM.
Quick request: Please be more specific to what bug you are referring to.I've taken a quick look at the posts above and there is no clear indication of any bug existing here.
wyldckat is offline   Reply With Quote

Old   November 12, 2018, 09:06
Default
  #11
New Member
 
Join Date: Oct 2018
Posts: 5
Rep Power: 8
Agit is on a distinguished road
Sorry. I seem to have the same problem as the OP.

I am using snappyHexMesh to mesh a simple geometry. When I set up the value nCellsBetweenLevels to 10, my resulting mesh does not have 10 cells between each level. When I set it up to 100 I get a significant change, but still not 100 cells, but someting like 12.
Could you please give me some advice?


It is almost like what OP has written:

Quote:
Originally Posted by laymelek View Post
nCellsBetweenLevels =10
Attachment 9028
nCellsBetweenLevels =50
Attachment 9029
Agit is offline   Reply With Quote

Old   November 12, 2018, 18:18
Default
  #12
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Quick answer: OK... what about the instructions I wrote on the aforementioned wiki page section:
Quote:
And what about when it doesn't look like it's respecting at all the value you've defined?
  1. Well, keep in mind the layer indicated earlier in this subsection: what matters is that the cells are all at the same distance from a particular wall... and if the algorithm has got a hard time figuring out to which wall it was meant to be measuring the distance, then it makes it a lot harder to figure out where the layers should change resolution.
  2. The other possibility is that the algorithm is trying to be conservative and/or is respecting the parameter minRefinementCells.
  3. Or perhaps the parameters maxLocalCells and/or maxGlobalCells are the constraint that limits the how many refinement layers can in fact be used, without going over the requested limit.
Did you check those settings?
wyldckat is offline   Reply With Quote

Old   November 14, 2018, 04:36
Default
  #13
New Member
 
Join Date: Oct 2018
Posts: 5
Rep Power: 8
Agit is on a distinguished road
First of all, thanks for your reply.
I read the instructions and checked my SHM-file. Neither point 2 and 3 is the reason for the error. I did not really understand what is meant by point 1
Quote:
Well, keep in mind the layer indicated earlier in this subsection: what matters is that the cells are all at the same distance from a particular wall... and if the algorithm has got a hard time figuring out to which wall it was meant to be measuring the distance, then it makes it a lot harder to figure out where the layers should change resolution.
My case is a simple flow around a rectangular cylinder. The interflow is 5*D (where D is the height of the rectangular shape). The backflow is 15*D and the domainheight is 14*D. I have also a refinementBox and a refinementCylinder. The level of my rectangular surface is set to 4 and the refinementRegion is set to 2.


Here is a screenshot of the case. Although I set nCellsBetweenLevels to 100, the cells between levels are less than 20.
Domain.png
Agit is offline   Reply With Quote

Old   December 22, 2018, 17:33
Default
  #14
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Quick answer: Sorry for the late reply, but here is what I've gotten with OpenFOAM 6 (up commit d8da4bd09212, Dec 4 21:32:25):
  1. The attached "with20.png" image shows what with 20 cells per level got me.
  2. The attached "with100.png" image shows what with 100 cells per level got me.
  3. Attached is the case "testcase.tar.gz" that I used for the last run, i.e. 100.
What I saw in practice:
  1. In the case with 20 cells, I think I saw only 19 cells, at least in one direction.
  2. In the case with 100 cells, I used the ruler filter to measure that it had 15 metres along Z, which at 0.2m width, gave me only 75 cells and not 100.
    • However, it seemed to me that the limitation was triggered because it has stopped seeing more cells along Y and X, hence it stopping at 75 and not 100.
So, what can be done as a workaround:
  • Use the distance based algorithm instead, e.g.:
    Code:
        refinementRegions
        {
            refinementBox
            {
                mode distance;
                levels ((1.0 2) (20.0 1));
            }
        }
    which is then shown on the attached image "distance_based.png". This sets a level 2 for 1m distance from the surface of the refinement box, along with a level 1 for a distance up to 20m.
  • You can use any geometry as a reference for the refinement regions.
Attached Images
File Type: jpg with20.jpg (196.2 KB, 109 views)
File Type: jpg with100.jpg (195.7 KB, 96 views)
File Type: jpg distance_based.jpg (195.3 KB, 85 views)
Attached Files
File Type: gz testcase.tar.gz (6.3 KB, 16 views)
wyldckat 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
[snappyHexMesh] snappyHexMesh sticking point natty_king OpenFOAM Meshing & Mesh Conversion 11 February 20, 2024 10:12
[snappyHexMesh] SnappyHexMesh running killed! Mark JIN OpenFOAM Meshing & Mesh Conversion 7 June 14, 2022 02:37
[snappyHexMesh] Adding layers goes wrong with SnappyHexMesh Elise OpenFOAM Meshing & Mesh Conversion 1 April 22, 2013 03:32
killed "snappyHexMesh" parkh32 OpenFOAM Pre-Processing 2 April 8, 2012 18:12
[snappyHexMesh] snappyHexMesh aborting Tobi OpenFOAM Meshing & Mesh Conversion 0 November 10, 2010 04:23


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