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

What's the reason of two turbulencemodels folder?

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

Like Tree4Likes
  • 1 Post By wyldckat
  • 2 Post By wyldckat
  • 1 Post By wyldckat

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 21, 2014, 14:28
Default What's the reason of two turbulencemodels folder?
  #1
Senior Member
 
lakeat's Avatar
 
Daniel WEI (老魏)
Join Date: Mar 2009
Location: Beijing, China
Posts: 689
Blog Entries: 9
Rep Power: 21
lakeat is on a distinguished road
Send a message via Skype™ to lakeat
What's the reason of two turbulenceModels folder? What's the philosophy behind this new folder restructuring?
__________________
~
Daniel WEI
-------------
Boeing Research & Technology - China
Beijing, China
Email
lakeat is offline   Reply With Quote

Old   March 21, 2014, 15:06
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
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 Daniel,

I'd like you to meet the Release Notes for OpenFOAM 2.3.0: http://www.openfoam.org/version2.3.0/

Now, when you get to the "Multiphase" page: http://www.openfoam.org/version2.3.0/multiphase.php - you'll find the section "Multiphase Turbulence" after a bit of reading. There everything is mostly explained.

Beyond that, what I can say is this (actually, mostly just rant about how great it is ): OpenFOAM is chock-full with C++ templates, so much that at this point in time, the flag "template-depth" is set to 100! https://github.com/OpenFOAM/OpenFOAM...c48/c%2B%2B#L9

The advantage of this is that it allows us to easily (i.e., after we understand how templates in OpenFOAM work):
  • Add new derived boundary conditions. Example: 1 single template class can be used to work with any fields that are of type scalar, vector and mostly any kind of tensor! Instead of having to manually code 5 or 8 classes per boundary condition, or instead of having to use hacks with "#define".
  • Extend thermodynamic modelling, which allows us to easily add a new specie model, a new chemistry model... and I forgot what else. Basically, remember when the thermodynamic models were defined like this: http://www.openfoam.org/version2.2.0/thermophysical.php
    Code:
    thermoType hPsiThermo<pureMixture<constTransport<specieThermo<hConstThermo<perfectGas>>>>>;
    There was actually the full template structure for the thermodynamic model in question. That combo of template classes was actually compiled as a single monolithic class, done by the compiler, and fully optimized by the same compiler. And in OpenFOAM, it's sometimes fully embed into any and all files that include the header file for a template class. Result: to get the utmost performance out of your solvers.
  • And now: Turbulence! It's probably now somewhat easy to add a hyper-sonic-combustion-with-200-different-species or more and with any turbulence model using RANS or LES OK, I am exaggerating on purpose
Any questions?

Best regards,
Bruno
lakeat likes this.
__________________
wyldckat is offline   Reply With Quote

Old   March 21, 2014, 15:24
Default
  #3
Senior Member
 
lakeat's Avatar
 
Daniel WEI (老魏)
Join Date: Mar 2009
Location: Beijing, China
Posts: 689
Blog Entries: 9
Rep Power: 21
lakeat is on a distinguished road
Send a message via Skype™ to lakeat
Thanks! But with all due respect, I still feel putting two identical names (except letter "T") under the same src/ folder is not a good idea.
__________________
~
Daniel WEI
-------------
Boeing Research & Technology - China
Beijing, China
Email
lakeat is offline   Reply With Quote

Old   March 21, 2014, 16:18
Default
  #4
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
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 lakeat View Post
Thanks! But with all due respect, I still feel putting two identical names (except letter "T") under the same src/ folder is not a good idea.
It's how OpenFOAM is coded. In other words, it's as old as its own origins in FOAM.

If you have a look into the folder "src/OpenFOAM/lnInclude", you'll see several files that only differ in the case of the first letter. The simplest is "Vector.H" vs "vector.H".
It's due to nomenclature used in OpenFOAM:
  • When the first letter is upper case, it's a C++ Template class.
  • When the first letter lower case, then it's a normal C++ class.
Ever wonder why the file extensions don't end in "h" and "cpp", but instead "H" and "C"? I think it's due to a particular standard, but essentially it means that "C" is for C++ and "c" is for plain C language.

My belief is that is this way, in order to make it perfectly clear to those who look at OpenFOAM: every single detail, no matter how small, is more important than one is willing to believe.


Of course that once we start delving into OpenFOAM's inner workings, we start finding class files that are not abiding to this nomenclature, because they belong to the "fvc" namespace. Or because the model is the name of the author(s) of said model. Details, details, details... it's all about the details

But let's face it:
  • "cvector.cxx" or "cvector.cpp" is ugly.
  • "vector.C" is pretty


Ah, then there's another issue you might find out sooner or later: did you know that there are files in OpenFOAM's source code that have the same identical name, but don't even belong in different namespaces, even though they are meant for different features? Here's some examples I can remember+find:
lakeat and pmdelgado2 like this.
wyldckat is offline   Reply With Quote

Old   March 21, 2014, 16:23
Default
  #5
Senior Member
 
lakeat's Avatar
 
Daniel WEI (老魏)
Join Date: Mar 2009
Location: Beijing, China
Posts: 689
Blog Entries: 9
Rep Power: 21
lakeat is on a distinguished road
Send a message via Skype™ to lakeat
I am 100% okay with files (you explained it very well), but as top-level source folders under src/, hmm, sorry, I just can't get it, I don't think it's a good practice.
__________________
~
Daniel WEI
-------------
Boeing Research & Technology - China
Beijing, China
Email
lakeat is offline   Reply With Quote

Old   March 21, 2014, 16:31
Default
  #6
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
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
Mmmm... Then you're OK with this?
Code:
ls -A1 $FOAM_SRC/thermophysicalModels/specie/reaction/

reactionRate
reactions
Reactions
wyldckat is offline   Reply With Quote

Old   March 21, 2014, 16:38
Default
  #7
Senior Member
 
lakeat's Avatar
 
Daniel WEI (老魏)
Join Date: Mar 2009
Location: Beijing, China
Posts: 689
Blog Entries: 9
Rep Power: 21
lakeat is on a distinguished road
Send a message via Skype™ to lakeat
4th level, let them. But as a top level folder, it does not look very "organized". Sorry, maybe it's just my personal opinion,
__________________
~
Daniel WEI
-------------
Boeing Research & Technology - China
Beijing, China
Email
lakeat is offline   Reply With Quote

Old   May 25, 2014, 19:05
Default
  #8
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
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 Daniel,

Just a mild update on this topic: if I interpreted correctly a comment on the bug tracker sometime ago, it seems that the old "turbulenceModels" folder may be deprecated in future releases, as soon as they are able to port everything to the new template mechanism. If my memory doesn't fail me, the comment in question is the last one here: http://www.openfoam.org/mantisbt/view.php?id=1259

Best regards,
Bruno
lakeat likes this.
__________________
wyldckat is offline   Reply With Quote

Reply

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
Writing IOdictionary to user-defined folder Arnoldinho OpenFOAM Programming & Development 3 June 16, 2021 04:04
icoFsiFoam folder structure OF 2.2.1 philipp1 OpenFOAM Running, Solving & CFD 1 January 25, 2014 17:08
I want to arrange all source file into Single Folder :Debate Urgent Help hhh OpenFOAM 3 July 27, 2013 05:15
[snappyHexMesh] Folder structure from snappyHexMesh elisenda OpenFOAM Meshing & Mesh Conversion 3 January 6, 2010 03:52
Discussion: Reason of Turbulence!! Wen Long Main CFD Forum 3 May 15, 2009 09:52


All times are GMT -4. The time now is 13:48.