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

Turbulence models and run time selection tables

Register Blogs Community New Posts Updated Threads Search

Like Tree26Likes
  • 15 Post By wyldckat
  • 5 Post By tomislav_maric
  • 2 Post By santiagomarquezd
  • 1 Post By tomislav_maric
  • 1 Post By tomislav_maric
  • 2 Post By alexeym

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   September 13, 2014, 15:47
Default Turbulence models and run time selection tables
  #1
Senior Member
 
santiagomarquezd's Avatar
 
Santiago Marquez Damian
Join Date: Aug 2009
Location: Santa Fe, Santa Fe, Argentina
Posts: 452
Rep Power: 23
santiagomarquezd will become famous soon enough
Hi all, I spent some hours overnight to understand how turbulence models are selected by the run time selection mechanism, the best commentary I've read was by marupio:

"4.3.5 When does this all happen?

The "virtual constructor" table is fully built and loaded into memory when the include list is fully read, and before the first line of code is executed. This is achieved using the static keyword. All static members of a class exist prior to any instance of that class."

OpenFOAM guide/runTimeSelection mechanism

For example en turbulenceModel.C

Code:
   75 
   76 autoPtr<turbulenceModel> turbulenceModel::New
   77 (
   78     const volVectorField& U,
   79     const surfaceScalarField& phi,
   80     transportModel& transport,
   81     const word& turbulenceModelName
   82 )
   83 {
   84     // get model name, but do not register the dictionary
   85     // otherwise it is registered in the database twice
   86     const word modelType
   87     (
   88         IOdictionary
   89         (
   90             IOobject
   91             (
   92                 "turbulenceProperties",
   93                 U.time().constant(),
   94                 U.db(),
   95                 IOobject::MUST_READ_IF_MODIFIED,
   96                 IOobject::NO_WRITE,
   97                 false
   98             )
   99         ).lookup("simulationType")
  100     );
  101 
  102     Info<< "Selecting turbulence model type " << modelType << endl;
  103 
  104     turbulenceModelConstructorTable::iterator cstrIter =
  105         turbulenceModelConstructorTablePtr_->find(modelType);
  106 
  107     if (cstrIter == turbulenceModelConstructorTablePtr_->end())
  108     {
  109         FatalErrorIn
  110         (
  111             "turbulenceModel::New(const volVectorField&, "
  112             "const surfaceScalarField&, transportModel&, const word&)"
  113         )   << "Unknown turbulenceModel type "
  114             << modelType << nl << nl
  115             << "Valid turbulenceModel types:" << endl
  116             << turbulenceModelConstructorTablePtr_->sortedToc()
  117             << exit(FatalError);
  118     }
  119 
  120     return autoPtr<turbulenceModel>
  121     (
  122         cstrIter()(U, phi, transport, turbulenceModelName)
  123     );
The general turbulence model indicated in constant/turbulenceProperties, for example "RASModel", is searched in the turbulenceModelConstructorTable (lines 104-105). Next if it is found the proper constructor is called, if not, an error is presented in stdout. I've walked through the code using gdb until these lines and checked the Hash Table. I wasn't be able to see the contents of the table entries, but they are three, I guess they're RASModel, LESModel and laminar. Clearly this table was created and filled before any turbulence model is instantiated. I found the macros which define the method to create the table and add the entries but I couldn't find the very moment when they're are called such as marupio wrote. They are static so they are available before the objects are instantiated, but they need to be invoked in some code line. This was also a question of Jaswinder,

http://www.cfd-online.com/Forums/ope...nderstand.html

I've read other material about this topic, such as:

Run-time type selection in OpenFOAM – the type name system

but the point of when these tables are created and how isn't completely clear for me yet.

All commentaries are appreciated!

Santiago.
__________________
Santiago MÁRQUEZ DAMIÁN, Ph.D.
Research Scientist
Research Center for Computational Methods (CIMEC) - CONICET/UNL
Tel: 54-342-4511594 Int. 7032
Colectora Ruta Nac. 168 / Paraje El Pozo
(3000) Santa Fe - Argentina.
http://www.cimec.org.ar
santiagomarquezd is offline   Reply With Quote

 


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
Wind turbine simulation Saturn CFX 58 July 3, 2020 01:13
An error has occurred in cfx5solve: volo87 CFX 5 June 14, 2013 17:44
Low-Re turbulence models grtabor OpenFOAM Running, Solving & CFD 4 February 15, 2010 10:25
RPM in Wind Turbine Pankaj CFX 9 November 23, 2009 04:05
air bubble is disappear increasing time using vof xujjun CFX 9 June 9, 2009 07:59


All times are GMT -4. The time now is 08:00.