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

PatchI VS patchi

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By wyldckat

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 10, 2014, 15:06
Default PatchI VS patchi
  #1
Senior Member
 
ArathoN
Join Date: Jul 2011
Posts: 137
Rep Power: 16
ArathoN is on a distinguished road
Hello,

I was reading the implementation of the wall function on Incompressible RAS models and i noticed that some of them call the faceI and others facei. What is the difference? I couldn't fing the file where they are defined.

EDIT: btw what does this mean wfpsf.?
ArathoN is offline   Reply With Quote

Old   October 11, 2014, 11:23
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
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 ArathoN,

Quote:
Originally Posted by ArathoN View Post
I was reading the implementation of the wall function on Incompressible RAS models and i noticed that some of them call the faceI and others facei. What is the difference? I couldn't fing the file where they are defined.
In essence, it depends on who is programming, but all of those variables aim to do the exact same thing: have the index for the patch or face to be analysed inside the current loop or method/function.
Some somewhat clear examples are presented here: http://www.cfd-online.com/Forums/ope...tml#post375296 - start reading from post #4 till the end of the thread.

Quote:
Originally Posted by ArathoN View Post
EDIT: btw what does this mean wfpsf.?
Without any context, it could mean anything.

With a quick search using Github's search function: https://github.com/OpenFOAM/OpenFOAM...search?q=wfpsf - I found this when I clicked in the first entry:
Quote:
Code:
mutWallFunctionFvPatchScalarField::mutWallFunctionFvPatchScalarField
(
const mutWallFunctionFvPatchScalarField& wfpsf
)
Which makes it perfectly clear that "mutWallFunctionFvPatchScalarField" and "wfpsf" are related:
  • Wall
  • Function
  • Patch
  • Scalar
  • Field
Best regards,
Bruno
ArathoN likes this.
__________________
wyldckat is offline   Reply With Quote

Old   October 16, 2014, 04:15
Default
  #3
Senior Member
 
ArathoN
Join Date: Jul 2011
Posts: 137
Rep Power: 16
ArathoN is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
In essence, it depends on who is programming, but all of those variables aim to do the exact same thing: have the index for the patch or face to be analysed inside the current loop or method/function.
Some somewhat clear examples are presented here: http://www.cfd-online.com/Forums/ope...tml#post375296 - start reading from post #4 till the end of the thread.

Thank you very much, I thought that they could be the same thing seeing that they were defined similarly but i wanted to be sure. I think the hardest part in reading the code is understanding and finding out the meaning of the variables (some are really obscure) even though it's really an interesting reading, very illuminating especially after 5 year of theoretical studying with almost no practical involvement (dunno if this happens only in the unis in Italy or if it's the same worldwide, here our studies are heavily focused in the theories and almost nothing is done about programming only a bit of fortran and c)

Quote:
Originally Posted by wyldckat View Post
With a quick search using Github's search function: https://github.com/OpenFOAM/OpenFOAM...search?q=wfpsf - I found this when I clicked in the first entry:
Which makes it perfectly clear that "mutWallFunctionFvPatchScalarField" and "wfpsf" are related:
  • Wall
  • Function
  • Patch
  • Scalar
  • Field
ok, i wouldn't ever thought about that. but yeah i found that variable while i was reading the wall function declarations.

I hope you can clear some other doubts that I had while reading the code, if possible obviously i don't want to abuse your kindness:
- First I'm having a problem understanding all the code related to the meshes do you have in mind some useful textbook that would help me here, i've read somewhere that "Handbook of Grid Generation - Joe F. Thompson" might be useful but if can confirm it. I don't want to read an entire book for nothing.

-reading a lot of thread in this forum i found different opinion about the utility yPusRAS then i decided to read the code about how it is calculated and i found out that it isn't true that il always calculate the yStar (as stated in almost all the thread i read) but it depends with what wall Function it was used on "/0/nut", because i noticed the utility does nothing but call the function "yPlus" from "nutWallFunctionFvPatchScalarField". Now reading the other WFs I noticed that they all are linking by this one "nutWallFunctionFvPatchScalarField"in fact the latter doesn't calculate directly the yPlus or nut but if depends on the real WF defined in the nut file. So am i right or not? and what does happen if i define nut in wall as "nutWallFunction"?

-Lastly do you have any report or textbook about the yStar variable, i know how it is derived and the assumption but i didn't find any textbook about this variable and especially it's relation to ystar. I understood that they have a comparable behavior in the log layer knowing that the assumption for the ystar formulation is based on the log layer but nothing else.

I really hope that you or somelse could shed some light about these doubts a searched into this forum and the web with scarce info.
ArathoN is offline   Reply With Quote

Old   October 18, 2014, 17:52
Default
  #4
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
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 ArathoN View Post
I think the hardest part in reading the code is understanding and finding out the meaning of the variables (some are really obscure) even though it's really an interesting reading, very illuminating especially after 5 year of theoretical studying with almost no practical involvement (dunno if this happens only in the unis in Italy or if it's the same worldwide, here our studies are heavily focused in the theories and almost nothing is done about programming only a bit of fortran and c)
From personal experience, when I was taught FORTRAN in the university back in 1998-99, it was pretty much the same thing. What I learned in the next few months from then was by self taught experience; it's ironic that I wanted to learn how to program before that, but never went to the trouble of studying on my own. But once I was taught FORTRAN, I was set to go and learned a lot on my own from there on!

There is that Chinese proverb:
Quote:
Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime.
What it doesn't say is that the man will only get good at fishing if he practices it on his own!


Quote:
Originally Posted by ArathoN View Post
First I'm having a problem understanding all the code related to the meshes do you have in mind some useful textbook [...]
Wait, wait... what exactly do you want to understand? Be specific, because it's very possible that you might not even have to learn much about it, except for how to generate meshes

Quote:
Originally Posted by ArathoN View Post
reading a lot of thread in this forum i found different opinion about the utility yPusRAS then i decided to read the code about how it is calculated and i found out that it isn't true that il always calculate the yStar (as stated in almost all the thread i read) but it depends with what wall Function it was used on "/0/nut", because i noticed the utility does nothing but call the function "yPlus" from "nutWallFunctionFvPatchScalarField". Now reading the other WFs I noticed that they all are linking by this one "nutWallFunctionFvPatchScalarField"in fact the latter doesn't calculate directly the yPlus or nut but if depends on the real WF defined in the nut file. So am i right or not? and what does happen if i define nut in wall as "nutWallFunction"?
Uhm... mmm... let me think/remember...
The y* vs y+ issue is a bit confusing, because it can depend on the software being used. If I remember correctly, y+ used in OpenFOAM... better yet, read this post: http://www.cfd-online.com/Forums/ope...tml#post471818 - post #27
In essence, if I remember correctly, the current yPlus implemented in OpenFOAM is in accordance with the description on the wiki page mentioned on that post. I can't remember when and if it was ever changed in OpenFOAM
As for LES vs RAS: in OpenFOAM is essentially structured the same way.
As for "mu" vs "nu"... it's addressed in this bug report, related to the post I mentioned above: http://www.openfoam.org/mantisbt/view.php?id=1141

Quote:
Originally Posted by ArathoN View Post
Lastly do you have any report or textbook about the yStar variable, i know how it is derived and the assumption but i didn't find any textbook about this variable and especially it's relation to ystar. I understood that they have a comparable behavior in the log layer knowing that the assumption for the ystar formulation is based on the log layer but nothing else.
Search online for:
Code:
ystar fluent
er... weird, I didn't find much either. Best to search for:
Code:
Fluent users guide
In one of the guides available online you should find some more information about this. Inside the user guide, search for "wall distance", it should (indirectly) lead you to the chapter where it explains the difference between them.

Looking a bit more into this...
  1. The very first post on the following thread seems to pretty much sum up the primary equations for y+ and y*: http://www.cfd-online.com/Forums/ope...lus-ystar.html
  2. This post has a bit more details from the Fluent Manual: http://www.cfd-online.com/Forums/ope...tml#post328499 post #22
  3. From what I can figure out, OpenFOAM uses one "y" for RAS and another one for LES:
  4. Better yet, if you look for "calcYPlus" in the source code, all of this confusion should become very clear. OpenFOAM uses the "y+" convention most practical for each case, namely RAS vs LES.
    • In RAS it apparently makes more sense to use the "y+" that the turbulence model will also use. This one is the one usually identified as "y*".
    • In LES, "y+" isn't used by the model itself, at least not directly, therefore it's best to use the conventional y+ calculation.
    You know, it's like apples vs oranges: both are considered healthy fruit, but apple pie is made with apples and orange cake is done with oranges
  5. And I know I saw something on one of the threads that is also mentioned in the Fluent User's Guide... bah, can't find it, but this thread seems to cover all of the topics pretty well: http://www.cfd-online.com/Forums/ope...-testcase.html
Best regards,
Bruno
wyldckat is offline   Reply With Quote

Old   October 20, 2014, 09:19
Default
  #5
Senior Member
 
ArathoN
Join Date: Jul 2011
Posts: 137
Rep Power: 16
ArathoN is on a distinguished road
First thank you for continuing to answer me, i really like such discussions i always improve greatly my knowledge.


Quote:
Originally Posted by wyldckat View Post
From personal experience, when I was taught FORTRAN in the university back in 1998-99, it was pretty much the same thing. What I learned in the next few months from then was by self taught experience; it's ironic that I wanted to learn how to program before that, but never went to the trouble of studying on my own. But once I was taught FORTRAN, I was set to go and learned a lot on my own from there on!
I agree, unfortunately in my case we had some professors (turbulent flow and CFD for propulsive systems) that were not up their task. They have a good recognition in their works but they were really bad teachers so we had to learn by ourselves moreover we learned only the basics of fortran77 which is pretty useless in my opinion. Something that i noticed at least with my courses is the lack of insight on the use of the different turbulence models (limited only to the boussinesq hypothesis, i had to read the wilcox book and some other references to grasp concretely the limits of each model and still i have a lot to learn), the mesh (this is really problematic, i had to document a lot to have an understanding on what mesh is good and what is bad) and the code implementation of solvers and models (for this OF illuminated me). e.g. I studied SIMPLE and PISO solvers without knowing it, when i was reading the code i was amazed that we already studied it but my professor decided "wisely" to not inform us what that method is called.

Quote:
Originally Posted by wyldckat View Post
Wait, wait... what exactly do you want to understand? Be specific, because it's very possible that you might not even have to learn much about it, except for how to generate meshes
I wanted to know the process with which OF creates mesh and interact with them, it's mostly my curiosity. I know that for programming maybe there is no need for this but only to know how to initialize the meshes and its label, which is really a hard job, I tried reading the meshes files but i had a headache right afterward. I don't know why they didn't index all the variable on the source documentation sometimes there are variable with no trace in the source documentation generated by doxygen and i have to search it manually in the OF directory, hoping to stumble upon the right file (i know that there a search function with OF but dunno how to use it if i don't even know the class of the variable).

Quote:
Originally Posted by wyldckat View Post
The y* vs y+ issue is a bit confusing, because it can depend on the software being used. If I remember correctly, y+ used in OpenFOAM... better yet, read this post: http://www.cfd-online.com/Forums/ope...tml#post471818 - post #27
In essence, if I remember correctly, the current yPlus implemented in OpenFOAM is in accordance with the description on the wiki page mentioned on that post. I can't remember when and if it was ever changed in OpenFOAM
................
I didn't read yet the yPlusLES, I'm studying principally the RAS models for now.
Thanks for the links finally i understood the relation between yStar and yPlus, I've found their definition but not their link that was the definition of uTau in an "Equilibrium turbulent boundary layer".

From what i understood the yPlusRAS will only call the function yPLus of the specified wallFunction (they are all linked to nutWallFunctionFvPatchScalarField)
Code:
const wallFunctionPatchField& mutPw = dynamic_cast<const wallFunctionPatchField&>(mutPatches[patchi]);
yPlus.boundaryField()[patchi] = mutPw.yPlus();
const scalarField& Yp = yPlus.boundaryField()[patchi];
then the calculation is up to the wall function used for nut. Some of them derive yPlus from the usual relation others use YStar:

nutkWallFunction with yStar
Code:
 return pow025(Cmu_)*y*sqrt(kwc)/nuw;
nutLowReWallFunction with yPlus (based on Tau and not directly to UTAu)
Code:
return y*sqrt(nuw*mag(Uw.snGrad()))/nuw;

nutUSpaldingWallFunction with YPLus
Code:
return y*calcUTau(mag(Uw.snGrad()))/nuw;
finally there is the nutkWallFunction but it uses the log law where it interpolates the wall shear stress and use the newton method to define yPlus. So in this case i don't know if the final solution is the same or not.

IMO this is really messy and i don't know why they complicated it so much, maybe i'm missing something crucial.


PS I started reading the LES models and i'm having difficulties with the delta definitions. In the books I've read there was almost nothing about the choice of delta (except van driest damping). do you use some papers/textbook or is it an iterative process to see which delta and its coefficients are the best to suit the simulation? I understood a bit the types of delta but dunno how to choose the coefficient.
ArathoN is offline   Reply With Quote

Old   January 25, 2015, 15:01
Default
  #6
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
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 ArathoN,

I've finally managed to look into this again. I see that you've continued your investigations into this, for example on this thread: http://www.cfd-online.com/Forums/ope...-re-model.html

As for the questions regarding the various ways of calculating y+ in OpenFOAM: it's precisely because each model needs a different way of calculation. Some use estimations based on the turbulence model (k and epsilon, for example), while others rely on the laminar approach; all because it depends on the zone of operations for which each model was designed to work in.

As for the reason OpenFOAM uses "nutWallFunctions": as far as I can understand, it's for a few major reasons:
  1. numerical stability
  2. easier modular operation
  3. the momentum equation mostly relies on "nut" and not directly on the turbulence models themselves... which could be considered as making it easier to understand or simply simpler to solve.
But it is indeed a pain to diagnose, for a new user that is trying to understand how the code works .
I've only recently had to look a bit more deep into this and I haven't managed to figure out all of the tiny details that OpenFOAM relies on. All I can figure out is that it does make sense, but it's difference from many other CFD implementations.

Best regards,
Bruno
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
[openSmoke] libOpenSMOKE Tobi OpenFOAM Community Contributions 562 January 25, 2023 10:21
label patchi and method facecells() maybee OpenFOAM Programming & Development 0 December 8, 2013 08:14
solidWallHeatTransfer - calculation of Cp(Tw, patchi) in basic Solid klio OpenFOAM Programming & Development 0 May 29, 2012 06:08


All times are GMT -4. The time now is 05:55.