|
[Sponsors] |
[Other] Contribution a new utility: refine wall layer mesh based on yPlus field |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
November 28, 2012, 19:21 |
Contribution a new utility: refine wall layer mesh based on yPlus field
|
#1 |
Senior Member
Daniel WEI (老魏)
Join Date: Mar 2009
Location: Beijing, China
Posts: 689
Blog Entries: 9
Rep Power: 21 |
Dear all,
As discussed in this thread, there is a need to refine the wall layer mesh based on the yPlus or yStar information on the patch fields. So I modified the original refineWallLayer utility and make a "smart"-refine-wall-layer-mesh utility. Here it is: refineWallLayerSmart.tar.gz Most of the options are similar to the original refineWallLayer utility, only "esgeWeight" is replaced by "stretchingRatio", which I think will make more sense. It should be larger than 1, best to be around 1~1.5, in order not to have too big stretching ratios. The key feature here is to refine the mesh not just once, but many times based on the current yPlus file or yStar file information, so to reach a desired estimated yPlus value. The default yPlus target value is to reach y+=1; Of cause you can set any other y+ target; To use this utility, please turn on the "basedOnYPlus" option. If "basedOnYPlus" option is off, the utility behaves like original refineWallLayer utily. I do not see a need to use "cellSet" mechanism, so by default, when the "basedOnYPlus" option is turned on, the whole wall layer is refined. Of cause however, this method is just a rough estimation, the real flow field and the yPlus values need to you to rerun the simulation! Code:
$ refineWallLayerSmart -help Usage: refineWallLayerSmart [OPTIONS] <patchName> <stretchingRatio> options: -basedOnYPlus Based on y+/y* field, run these utilities first. Target yPlus is unity -case <dir> specify alternate case directory, default is the cwd -noFunctionObjects do not execute functionObjects -overwrite overwrite existing mesh/results files -refineLevel <value> Manually set the refineLevel, e.g. 3 -targetYPlus <value> Manually set the target yPlus, e.g. 5 or 30 -useSet <name> (obsoleted) restrict cells to refine based on specified cellSet name -srcDoc display source code in browser -doc display application documentation in browser -help print the usage A smart way to refine wall layer cells based on the y+/y* value. Please turn on the option "basedOnYPlus"to see its effect Code:
refineWallLayerSmart -basedOnYPlus cyl 1.15 Code:
refineWallLayerSmart -basedOnYPlus -targetYPlus 30 cyl 1.15 If "-targetYPlus 50" is larger than the mean yPlus value on that patch, error will show. That is no need to refine. Code:
refineWallLayerSmart -basedOnYPlus -targetYPlus 30 -refineLevel 3 cyl 1.15 The following is a sample output: Code:
$ refineWallLayerSmart -basedOnYPlus -targetYPlus 2 cyl 1.12 /*---------------------------------------------------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.1.0 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ Build : 2.1.0-5141eb679a6c Exec : refineWallLayerSmart -basedOnYPlus -targetYPlus 2 cyl 1.12 Date : Nov 28 2012 Time : 18:29:59 Host : "ubuntuWorkStation" PID : 13010 Case : .../run/test/rectangular nProcs : 1 sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE). fileModificationChecking : Monitoring run-time modified files using timeStampMaster allowSystemOperations : Disallowing user-supplied system call operations // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Create time Create mesh for time = 0.01 Note: this utility default is using yPlus, if you have yStar file also in the folder, please double check which one you want to use, and delete the other. Thanks! Using refineWallLayer utility in a smart way! Mean yPlus is 19.8019, targetYPlusValue is 2, refineLevel is 4 Originally, patch 0 named cyl d : min: 0.00069375 max: 0.0008625 average: 0.000735 Selected 284 cells connected to patch cyl Cutting: cells:284 edges:568 Morphing ... Selected 284 cells connected to patch cyl Cutting: cells:284 edges:568 Morphing ... Selected 284 cells connected to patch cyl Cutting: cells:284 edges:568 Morphing ... Selected 284 cells connected to patch cyl Cutting: cells:284 edges:568 Morphing ... Writing refined morphMesh to time 0.01001 After refining, Patch 0 named cyl d : min: 5.405e-05 max: 6.7e-05 average: 5.72429e-05 End Comments and suggestions are very welcome! Cheers,
__________________
~ Daniel WEI ------------- Boeing Research & Technology - China Beijing, China |
|
November 29, 2012, 04:11 |
|
#2 |
Senior Member
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 22 |
Wow, you received your kudos quite fast
It is a nice, simple tool, especially with the loop on the refinement-levels makes life easy hopefully. I still have some doubts on the stretchingRatio, as it will result in a thicker cell in the first layer than in the second layer, which is probably unwanted. I will see if I can think of anything slightly nicer here (except for using a value of 1 here). I used the cellSet route, because high have patches with very high and low y+ values, but I think I will agree with you that I don't need it this way, as an additional layer will in general not add to many cells anyhow. Maybe this utility is worth starting a Wiki-entry? |
|
November 29, 2012, 05:03 |
|
#3 |
Senior Member
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 22 |
I added a flad -adjacent to the utility which interprets the stretchRatio as the stretchRatio between consecutive cells. I think it is more intuitive, and it nicely scales all the cells in the wall-layer.
|
|
December 3, 2012, 03:19 |
|
#4 |
Senior Member
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 22 |
Just some more thoughts. It would be really awesome if the utility was also able to move some of the nodes of second/third/fourth cell, to reduce the stretch-ratio between the first largest cell inside the layer and the smallest one outside. Does anyone have an idea or suggestion?
|
|
December 3, 2012, 11:40 |
|
#5 |
Senior Member
Daniel WEI (老魏)
Join Date: Mar 2009
Location: Beijing, China
Posts: 689
Blog Entries: 9
Rep Power: 21 |
If I were you, I would go with some smoothing schemes, but for now, I won't integrate it into this utility. Just some thoughts.
__________________
~ Daniel WEI ------------- Boeing Research & Technology - China Beijing, China |
|
December 10, 2012, 04:57 |
|
#6 |
Member
Vishal Achasrya
Join Date: Nov 2011
Posts: 38
Rep Power: 15 |
Hi,
When you use this utility, can it be done before any computations? I have a case where i plan to generate a steady state RAS solution and then use that as an initial state to do a transient LES. Can I do this utility before i do my steady state solution? When a solution exists, how does it work? Obviously it uses the solution to get a more accurate yPlus and then refines wall layers and then writes a new mesh (and new solution interpolated?) to a new directory? In the basedOnYplus option, which version does it use? yPlusRAS or yPlusLES? Btw, much appreciation for writing this utility. I am yet to use the in-built refineWallLayer but when i came across your utility, I would like to directly give that a try. Mine is a axisymmetric swirl combustor with a cylindrical dump region preceded by a cylindrical annuls in which 8 swirler guide vanes are present. Thanks ! |
|
December 10, 2012, 05:00 |
|
#7 |
Member
Vishal Achasrya
Join Date: Nov 2011
Posts: 38
Rep Power: 15 |
Bernhard:
The new C file and the reason for it makes sense. If for example, the first cell is say about y+ = 1.5 and we target y+ =1, then a first step would be make a y+ =1 but the next cell then becomes smaller than this new wall cell, am i right? And i guess this is your concern? In this case, is it not better to just move the y+ = 1.5 point to y+ =1 rather than add a new one? A check can then be made to see the cell expansion ratio near wall. I hope im not missing something in what you mentioned or implemented, when i say the above? Thanks |
|
December 10, 2012, 06:55 |
|
#8 |
Senior Member
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 22 |
The utility will first try to read either yPlus or yStar from the time-file. If it is not present, it will fall back to the normal refineWallLayer. I changed the code I posted in above slightly, such that I can also use refineLevel without yPlus present.
It depends on the utility that you use how -basedOnYPlus works. If you use yPlusRAS, you will not get yPlus, but yStar (see thread linked in first post). You can also use the utility in this other thread, it does not really matter for this utility. If you use low-Re RANS models, I think the wall layer refinement is not a bad strategy, of course you can also move some nodes, but than your second cell becomes larger than the third one (probably). A combination of both approaches would be ideal (see above post), but for now I don't know how to implement this This utility will by the way operate based on patch-average y+ values, which in most cases will not bring all y+ down to <1 if the average is. But as long as you keep sure that y+<3 for all cells, I don't think you will get into trouble. |
|
December 12, 2012, 16:24 |
|
#9 |
Member
Vishal Achasrya
Join Date: Nov 2011
Posts: 38
Rep Power: 15 |
That makes sense.
A general question - If I have a simulation yet to run, but i want to decide if my yPlusLES is good, then can i just set the internalField for U in 0/U to be the inlet velocity everywhere? and then it calculates the yPlus based on that? How does yPlus calculation work for the intial condition? |
|
December 12, 2012, 16:30 |
|
#10 |
Senior Member
Daniel WEI (老魏)
Join Date: Mar 2009
Location: Beijing, China
Posts: 689
Blog Entries: 9
Rep Power: 21 |
Not sure what you are trying to do. But y+ is simply calculated from velocity gradient, where there is velocity field, there is the y+ field. However, note that some turb models have convergence problem with a ill posed initial field.
__________________
~ Daniel WEI ------------- Boeing Research & Technology - China Beijing, China |
|
December 12, 2012, 16:44 |
|
#11 |
Member
Vishal Achasrya
Join Date: Nov 2011
Posts: 38
Rep Power: 15 |
My thoughts exactly daniel. Imposing a uniform field like that would not be right, and i dont do it. But how do you get yPlus before you do a simulation when there is no velocity field?
|
|
December 12, 2012, 16:56 |
|
#13 |
Member
Vishal Achasrya
Join Date: Nov 2011
Posts: 38
Rep Power: 15 |
When i have a mesh and i have just the 0/ folder, its stagnant field inside... not really vacuum
Before i run my LES, if i want to check my mesh to see if it has a good yPLus, then how do i do it is my question? How do i use yPlusLES before i begin my LES? so that i can refine my wall or not depending on the values? |
|
December 12, 2012, 17:03 |
|
#14 |
Senior Member
Daniel WEI (老魏)
Join Date: Mar 2009
Location: Beijing, China
Posts: 689
Blog Entries: 9
Rep Power: 21 |
First, I will not use this utility for doing this.
There are numerous ways to estimate first cell height needed when building initial mesh, to list a few: 1. http://www.cfd-online.com/Tools/yplus.php 2. Run on a reduced-dimensional case 3. Experience from similar flow
__________________
~ Daniel WEI ------------- Boeing Research & Technology - China Beijing, China |
|
June 6, 2013, 13:29 |
|
#15 |
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27 |
Hi daniel
how can set all yPlus values below a specified value(like 1) mean the maximum value be 1 not the average. I have a shock tube like case that the flow has not reached all the channel and because the tool assumes average values it doesn't decrease yPlus due to including stationary cells that the flow has not reached them,but the maximum yPlus is 16 and I want it be smaller than 1. thanks. ------------------- and also it gives an error on double numbers: Code:
Create time Create mesh for time = 1.8e-05 Note: this utility default is using yPlus, if you have yStar file also in the folder, please double check which one you want to use, and delete the other. Thanks! --> FOAM FATAL IO ERROR: wrong token type - expected int, found on line 0 the doubleScalar 0.2 file: IStringStream.sourceFile at line 0. From function operator>>(Istream&, int&) in file primitives/ints/int/intIO.C at line 68. FOAM exiting
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King. To Be or Not To Be,Thats the Question! The Only Stupid Question Is the One that Goes Unasked. |
|
June 9, 2013, 07:36 |
|
#16 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128 |
Greetings to all!
Attached is a modification as requested by Ehsan. It's based on Daniel's original modifications and I changed the following:
Bruno
__________________
|
|
June 9, 2013, 12:43 |
|
#17 |
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27 |
thanks Bruno
but why y+ doesn't display in terminal? Code:
Hiii ... refineLevelValue = 6 Using refineWallLayer utility in a smart way! Maximum yPlus is 36.32381771, targetYPlusValue is 1, refineLevel is 6 Originally, patch 2 named walls d : min: 3.1116565e-06 max: 3.111656539e-06 average: 3.11165652e-06 Selected 1400 cells connected to patch walls Cutting: cells:1400 edges:2804 Morphing ... Selected 1400 cells connected to patch walls Cutting: cells:1400 edges:2804 Morphing ... Selected 1400 cells connected to patch walls Cutting: cells:1400 edges:2804 Morphing ... Selected 1400 cells connected to patch walls Cutting: cells:1400 edges:2804 Morphing ... Selected 1400 cells connected to patch walls Cutting: cells:1400 edges:2804 Morphing ... Selected 1400 cells connected to patch walls Cutting: cells:1400 edges:2804 Morphing ... Writing refined morphMesh to time 1.60063e-05 After refining, Patch 2 named walls d : min: 7.286986025e-08 max: 7.287e-08 average: 7.286993012e-08 End
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King. To Be or Not To Be,Thats the Question! The Only Stupid Question Is the One that Goes Unasked. |
|
June 9, 2013, 12:52 |
|
#18 | |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128 |
Hi Ehsan,
It shows the maximum "yPlus" value, the target yPlus and the refine level needed for reaching said target: Quote:
Code:
refineWallLayerSmart -basedOnYPlus -targetYPlus 0.5 defaultFaces 1.5 I used it on the tutorial case "incompressible/pimpleFoam/TJunction" and used yPlusRAS to calculate the field "yPlus". I have no idea if these are good values, it was just for testing if the worked. If you want to confirm the resulting "yPlus", I guess it's just a matter of running the "yPlus" application again... in my case, yPlusRAS. Best regards, Bruno
__________________
|
||
June 9, 2013, 13:42 |
|
#19 |
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27 |
thanks dear Bruno.
it seems it concentrate the mesh on near the wall not like ordinary blockMesh.its fine because avoids of increasing mesh numbers a lot. but I can't grasp well how it works.for example when we set 1.15 its the ratio between nearest cell to wall and what?and what does -refineLevel exactly? and it seems it keeps original mesh numbers(except of some more cells near wall)
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King. To Be or Not To Be,Thats the Question! The Only Stupid Question Is the One that Goes Unasked. |
|
June 9, 2013, 14:48 |
|
#20 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128 |
Hi Ehsan,
The "-refineLevel" sets the level manually, instead of allowing the utility to calculate the refine level for itself. This will mean that by imposing the level other than the automatically calculated, you will probably reach a y+ higher or lower than you had planned. As for the "stretchingRatio", it is used for calculating the "weight": Code:
const scalar weight = args.argRead<scalar>(2) /(args.argRead<scalar>(2)+1); Attached is the example I'm looking at, which uses a stretch ratio of 1.5, which leads to "1.5/(1+1.5) = 0.6". Since the edge length is 0.004, then the first division will be at "0.6*0.004 = 0.0024". Then the second division will refer to the new closest cell to the wall, therefore using "0.6*0.0024" and so on. Best regards, Bruno
__________________
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
decomposePar problem: Cell 0contains face labels out of range | vaina74 | OpenFOAM Pre-Processing | 37 | July 20, 2020 06:38 |
[snappyHexMesh] Creating multiple multiple cell zones with snappyHexMesh - a newbie in deep water! | divergence | OpenFOAM Meshing & Mesh Conversion | 0 | January 23, 2019 05:17 |
[mesh manipulation] Wall mesh refinement based on y+ | Hrushi | OpenFOAM Meshing & Mesh Conversion | 1 | July 9, 2017 07:06 |
[snappyHexMesh] snappyHexMesh - geometry does not appear in Mesh | czhongrong | OpenFOAM Meshing & Mesh Conversion | 1 | January 20, 2016 06:26 |
Water subcooled boiling | Attesz | CFX | 7 | January 5, 2013 04:32 |