SimScale CAE Forum

Layering for yPlus of less than 1


#1

While I have been running some large sims in my quest to create a meaningful Mesh Independence Study for my own project, I have been working with the project geometry of this topic so that I can get a better handle on the nuances of layering to a yPlus of < 1.

I am so close to having an 85 million volume mesh with 15 layers at an expansion ratio of 1.3 to a final layer of 0.00002 meters (that is a first layer thickness of only 0.0000005 meters on a 0.3 meter half span flying wing) that has a weighted 98.3% inflation and have received an error message that I can not track down.

My Openfoam results are that it created the mesh just fine with 0 illegal faces as you can see here:

To determine how to achieve this layering I first worked only on a small portion of the wing tip and can show the layering that will be achieved when I lick this weird error. Here are two images that show the layers. I have to show two images because it takes the full screen just to show 1 cell width of the 15 layers :wink:

And this 6 million cell mesh was 98.3% inflated and was only deflated at the sharp trailing edge:

So… why, after Openfoam says the 85 million cell mesh was created do I get an Error with no Mesh Operation Event Log and no mesh appears :cry:

Once we get past this little hurdle I will assemble my procedure from my notes and present it here. :upside_down_face::upside_down_face::upside_down_face:

Darren @1318980, you might be interested here :wink:

Thanks,
Dale


#2

@DaleKramer, this is most likely due to the machine running out of memory, I think the largest mesh I have seen actually come back was around 55 million cells. The lack of error I think is because it ran out of memory after the meshing process and there might not be any way to detect the cause. I’ll feed this back but for now, I would work on reducing overall mesh size, a quick way of doing that might be to reduce the number of cells in the normal direction since this is 2D?

Best,
Darren


#3

Thanks and darn, I am always trying to push the limits :wink:

I made a 61 million cell mesh yesterday for my canard project.

I will reduce # of layers till I get it to work.

I thought limit was ~100 million cells, oh well :upside_down_face:

What do you think of the layering I was able to get here?

What you mean 2D? That image was on the symmetry plane so it looks 2D (always harder to layer right at symmetry plane but I was able to do it as you can see :wink:)

Dale


#4

There is no hard limit, just whatever you can push from the instances, 61 is a lot, the most complex geometry I ever had used a mesh of around 30-35million cells but I was modelling the walls not fully resolving.

Ok, I thought it was a 2D aerofoil so would have suggested reducing the cells across the foil but if not the case this might not be possible.

Layering settings seem robust, there is a large size gradient in some areas, might cause some instability but we shall see if the numerics can handle it. How do you know that you need 0.0000005m? if you don’t mind me asking :slight_smile:

Best,
Darren


#5

I assume you mean the refinement level gradient as you move away from the surface. I chose to only do a surface refinement, to check the robustness of my layering method. You can always add some fineness closer to the BL layers with a feature refinement to a distance from the surface.

Again, I wanted to explore some limits of robustness of my layering method, so I went WAY beyond what he asked for…

I have now decided to stay away from such big files and concentrate of what @ksum requested which was a need for a first layer thickness of 1e-5 or below with 10 - 15 layers.

So, I did just that and easily made a 6 million cell mesh that is 98.6 % inflated with 15 layers at expansion ratio 1.3 to final layer of 0.0004m and 1st layer of 0.00001m.

I ran his projects single sim run on my mesh (without even checking that it was boundaried for a yPlus of 1) and here is the yPlus mapping of the top surface (some of those red pixels are over yPlus=10 but not many), looks like it worked pretty good :smile: :

This is basically a mapping like I would have expected by looking at the images of my first post.

I will soon post my layering procedure here :slight_smile:

Dale


#6

Nice one Dale! Good results! Thanks for sharing.

Best,
Darren


#7

And a 0-0.15 mapping:


#8

Nice, would love to find out how to stop those layers cancelling on the trailing edge… if your up for a challenge :wink:

Best,
Darren


#9

Don’t think it is possible. 15 layers takes a while to inflate from deflated. Any angular edge feature will cause a deflation at it. Just the way Snappy layers I think.

That lonely red deflation on the root rib is caused by a single face on the symmetry surface that Snappy decided is part of the wing surface and look how big that deflation is. Here is that single face:


#10

Yer, I was just thinking since we have made good progress documenting how to make layering more robust by altering the layering controls maybe there was a setting that controls this deflation. But your right I presume not since we haven’t found it yet.


#11

Yep, you never know, it may be possible, I can’t tell you how many hours it took me just to get a small handle on even one layering parameter that does not do what you expect it to do by thinking what the name means. The brute force method is not easy and eats up core hours too :wink:


#12

NOTE: This is an example procedure to show how I was able to layer a particularly difficult layering requirement. It is not a way to fix all layering issues. However, I do believe the methods I present here can be used to solve a lot of layering problems that you may be having. The parameter values that are causing your problems are likely not the same as mine were in this case but here is at least a method to figure which parameters are causing your layers to disappear and then you can play with those parameters. It is an iterative process :wink:

Before I show my layering solution for this geometry I would like to complain a little first :wink:

Although the end result is mainly a one parameter value change (’ Min normalized cell determinant’), the road I took to discovering that parameter and its required value was long indeed and I was GREATLY hindered by not having access to the full Meshing Log.

I spent many hours watching real time pages of log pass by, even capturing the passing lines in the clipboard and assembling a full log in a Notepad ++ document many times.

From this, some of the things I think I learned that are relevant are (I could be wrong about a lot of things beyond this point but it did lead me to some success) :

  1. When adding layers, Snappy is called twice. First to create the unlayered mesh and then called a second time to layer it. This begs the question, why can’t we layer an existing mesh?
  2. When Snappy starts layering, it appears to create a perfect set of layers on each geometry face that has all the layers you asked for, effectively a 100 % inflated mesh. The layers are fully wrapped around ALL the features but they are eventually removed from a lot of them (darn). We just have to figure out how to stop as much of this face removal as possible and still leave the mesh with a reasonable quality for simulation use.

With that knowledge I continued watching the log in real time as those layers disappeared in the layer quality checking iterations that are performed on that perfect 100% layered mesh.

I finally noticed that the KEY iteration segment to watch was at the end ‘Layer addition iteration 0’.
This is where I finally I had my AHA moment. I saw nearly 2,000,000 faces get discarded whose determinant was <0.001… Here is a screen capture of that location, unfortunately it is not the AHA moment when I saw 2,000,000 faces disappear but at least you can see 101,173 that disappear:

I realized that this end of ‘Layer addition iteration 0’ meshing log location is where most of the nice layers disappeared and this has now become the first place I look when I am having layering difficulties. It actually shows me which parameters are being failed. It is then up to me to decide whether relaxing these parameters will still give me a good enough mesh quality for simulation.

In my case I started trying a value of 1e-9 for ’ Min normalized cell determinant’ and I instantly retained a nearly 100% layering in the mesh that Snappy left for me.

Then I tried 1e-6 and still had nearly 100%, then 1e-4 and still had nearly 100% and then I left it there… Yeah (the default value of 1e-3 left only about 2% layering)

I have no idea if having a 1e-4 determinant cutoff vs the default 1e-3 value reduces my final mesh quality significantly but the mesh seemed to converge a simulation that was already in that project just fine.

The second most significant parameter to have correct is the ’ Min cell volume [m³]’. I chose my value of 1e-16 like this:

  1. Find your layer creation parameters. Mine were 15 layers to an FLT (final layer thickness) of 0.0004m at an ER (expansion ratio) of 1.3. These were likely originally determined by a need for an EWD (estimated wall thickness or 1st layer thickness) of 0.00001m as calculated by the Online y+ Calculator. (NOTE: If your are in the process of trying to create layers on a geometry, make sure your ’ Bounding Box geometry primitive’ is divided into sufficiently sized but SQUARE cells in all x,y and z axis. This will create a Level 0 SQUARE mesh grid on all x,y and z faces of the Background Mesh Box).

  2. Create an RLC (refinement level chart) in Excel. This shows RLEL (refinement level edge length) for all refinement levels you will use, like this (The ‘Axis Edge Length’ is the length of the ‘Background Mesh Box’ in the axis and the ‘# Cells along it’ is the meshing parameter ‘Number of cells in the ? direction’):
    RLChart

    Note, best practice is to make sure the whole surface of the geometry is refined to a level where the RLEL is more or less equal to the FLT (final layer thickness). My FLT=0.0004 and RLEL6 was 0.000625. This is a ‘get you close’ to the correct level to surface refine to rule. In my case level 6 was chosen and did work, level 5 did not create any layers and level 7 made the mesh much larger without a significant increase in inflated layer percentage.

  3. Calculate this value which I call MFLV (max first layer volume) as (RLEL#)(1st layer thickness)^2. In my case MFLV=(RLEL6)(EWD)^2 or (0.000625)*(.00001)^2 = 6.25e-14 . Then, I found that a MCV of about MFLV/1000 or 1e-16 was a good value. I determined that by real time watching the meshing log for the ‘Layer addition iteration 0’ meshing log location and making sure that not many cells less than my chosen MCV were being discarded from the layers. I hope that there is a better way to determine MCV but that is what I have for now.

The third most important parameter to have correct is the ’ Min tetrahedron-quality for cells’. This is a VERY confusing parameter. I ended up just having to turn it off for this case with a value of -1e+30.

There are a number of ‘Max Iteration…’ parameters that I changed from their defaults and I think I will continue to use the larger numbers because it is a pain to have a good layering setup stopped by too few iterations being done.

Here are all the Snappy parameters that I used (I hope I have discussed all the ones that were important in allowing me to get my 15 layers at this small EWD of 0.00001m):

CLICK IT TO SEE FULL IMAGE:


I wish the parameter name for each of those paramaters had the default value listed for it (beside the units bracket)

I will be editing this as I recall more details or fix something that I got wrong here based on my notes. I should post this before I lose all this work…

I hope that there is a long discussion following this post :wink: @1318980

Dale


Use of Bounding Box Layer , Y+ layer, boundary layer
Use of Bounding Box Layer , Y+ layer, boundary layer
Mesh Independence Study - Layering disappears across study meshes
'Validating the flow around an APC Slow Flyer Propeller' simulation project by Filiptheking
Boundary Layer Does Not Form - Except When Default Settings Used
Very thin boundary layers and y+ on complex geometry
Boundary layer inflation thickness
#13

@DaleKramer

This is typical snappyhexmesh. It is not easy to generate prism layers that has y+<1 while maintaining a good coverage.

On a side note, RANS does not require y+<1. A max y+=1 is enough. In reality, a max y+~5 is also acceptable on a large scale industrial mesh. This is because 0<y+<5 is a linear region, which only needs 2~3 cells when using RANS. For example:

  1. if y+=1 in the first layer, with a growth of 1.2, the second layer will have y+ = 1 * 1.2. The total y+ of the first and the second layer will be 1+1.2 = 2.2. Now, the third layer has y+ = 1 * 1.2 * 1.2 = 1.44, making the total y+ of the 3 layers 1+1.2+1.44 = 3.64.
  2. if y+ = 2 in the first layer, with a growth of 1.2, and following the math above, the total y+ of 3 layers will be 2+2 * 1.2+2 * 1.2 * 1.2 = 7.28, so you will have 2 layers within y+<5.
  3. if y+max= 5, then you will get at least 1 layer in this linear region.

#14

Hi Dale,

I’m looking at this after you shared on my post. Why do u say 101k cells disappeared? I see that this number is about negative volume, concavity etc… the number for min determinant is also much smaller?

Could you help me by explaining your conclusion further?

Weisheng


#15

@cweisheng

When I say ‘disappeared’, I mean that they were considered by Snappy to not meet the quality criteria that is set in your requested meshing parameters since, first of all Snappy begins by creating 100% of the layers you requested and then starts removing cells in the layered zone if they fail the quality criteria you have asked for.

Here is another way I tried to say that:

The quality criteria you ask for would normally be the defaults that SimScale has chosen but you are in control of those numbers and you can get less ‘supposedly bad’ cells removed from your end mesh if you relax some quality parameters.

Again, it is up to you to know how much those relaxations may affect your desired results (that is not easy to determine), but you CAN get a mesh that looks like it is better layered using my method :wink:


#16

@DaleKramer

Thanks again for the advice. I have taken the past few days to try out all the suggestions from everybody. Unfortunately, I am still not able to generate the BLs. When I have relaxed the mesh quality parameters too much, the whole mesh just fails - otherwise, it forms without BL.

Just wanted to check in terms of geometry preparation since I used to do it differently in another software. For the surfaces that you want BL to be generated, eg. the flying wing you did, was it one continuous geometry surface from top trailing edge to leading edge and all the way to the bottom trailing edge again? I used to split these out and I am not sure if this could be a problem in Snappy?

Appreciate if you can opine.


#17

Lets start again in your project support topic… I will start a new post there specific to your project.


Very thin boundary layers and y+ on complex geometry
#18

May I suggest meshing the model with cfmesh and import the mesh into Simscale for simulation? I tryed it a few times and the prism cells look much better with just a fraction of the setup complexity.

Could @Simscale implement the free version of cfmesh as an option alongside snappyHexMesh?


#19

WOW, I only had to see this and I was convinced:

Not wanting to take over your suggestion but I have created one of my polls for this :slight_smile:


#20

Thanks! Will try it out.