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

turbulenceModelConstructorTable

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By alexeym

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 4, 2014, 03:05
Default turbulenceModelConstructorTable
  #1
New Member
 
xurenyi
Join Date: Apr 2014
Posts: 10
Rep Power: 12
xurenyi is on a distinguished road
I can find nothing about turbulenceModelConstructorTable inturbulenceModel.C in documentation. What is it and where did it be defined?
xurenyi is offline   Reply With Quote

Old   April 4, 2014, 03:25
Default
  #2
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

turbulenceModel.C:

Code:
defineRunTimeSelectionTable(turbulenceModel, turbulenceModel);
this macro is defined in src/OpenFOAM/db/runTimeSelection/construction/runTimeSelectionTables.H:

Code:
// define run-time selection table
#define defineRunTimeSelectionTable\
(baseType,argNames)                                                           \
                                                                              \
    defineRunTimeSelectionTablePtr(baseType,argNames);                        \
    defineRunTimeSelectionTableConstructor(baseType,argNames);                \
    defineRunTimeSelectionTableDestructor(baseType,argNames)
These macros (defineRunTimeSelectionTablePtr, defineRunTimeSelectionTableConstructor, defineRunTimeSelectionTableDestructor) are also defined in runTimeSelectionTables.H, they define turbulenceModelConstructorTable.
alexeym is offline   Reply With Quote

Old   April 10, 2014, 22:44
Default
  #3
New Member
 
xurenyi
Join Date: Apr 2014
Posts: 10
Rep Power: 12
xurenyi is on a distinguished road
thank you very much

I studied the file 'runTimeSelectionTables.H'

If the 'turbulenceProperties' file in the 'constant' folder is written as:
simulationType LESModel;

and the 'LESProperties' is written as:
LESModel oneEqEddy;

Then in the 'turbulenceModel.C', the modelType is valued as 'LESModel'.

Through
turbulenceModelConstructorTable::iterator cstrIter = turbulenceModelConstructorTablePtr_->find(modelType);
in 'turbulenceModel.C', the derived class LESModel is instantiated.

BUT, neither LESModel.C nor .H was included in turbulenceModel.C or .H, how to get the the derived class?

Usually, when the main file need to use turbulenceModel, then turbulenceModel file is included in the main file. Now, turbulenceModel need to use LESModel, should LESModel file be included in turbulenceModel file? Otherwise, how to instantiate the derived class LESModel in turbulenceModel?

BTW,
where and how is the class add##argNames##ConstructorToTable described in 'runTimeSelectionTables.H' used?

Last edited by xurenyi; April 11, 2014 at 03:30.
xurenyi is offline   Reply With Quote

Old   April 11, 2014, 07:22
Default
  #4
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Well, I guess it more-or-less like this:

1. LESModel.H include turbulenceModel.H (where class turbulenceModel is defined)

2. LESModel.C has the line

Code:
addToRunTimeSelectionTable(turbulenceModel, LESModel, turbulenceModel);
which will be preprocessed into (though my preprocessing capabilities maybe worse than of g++, you should take a look at the preprocessed code yourself to be sure):

Code:
turbulenceModel::addturbulenceModelConstructorToTable< LESModel >           addLESModelturbulenceModelConstructorToturbulenceModelTable_
i.e. it will modify turbulenceModel class, adding to it knowledge of LESModel. Almost the same lines are in the files which define concrete LES models, i.e. in Smagorinsky there is a line:

Code:
addToRunTimeSelectionTable(LESModel, Smagorinsky, dictionary);
then code look through the constructor table like this:

Code:
    dictionaryConstructorTable::iterator cstrIter =
        dictionaryConstructorTablePtr_->find(modelType);
and if constructor is found (actually a pointer to the constructor), it is used in this way:

Code:
    return autoPtr<LESModel>
    (
        cstrIter()(U, phi, transport, turbulenceModelName)
    );
Bahram likes this.
alexeym is offline   Reply With Quote

Old   April 11, 2014, 21:09
Default
  #5
New Member
 
xurenyi
Join Date: Apr 2014
Posts: 10
Rep Power: 12
xurenyi is on a distinguished road
But in first how to reach the code:

Code:
addToRunTimeSelectionTable(turbulenceModel, LESModel, turbulenceModel)
in LESModel.C from turbulenceModel.C which is included in main file of solvers.

Last edited by xurenyi; April 13, 2014 at 09:35.
xurenyi 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



All times are GMT -4. The time now is 12:50.