CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   What does the 'makeChemistryModel.H' file do? (http://www.cfd-online.com/Forums/openfoam-programming-development/93944-what-does-makechemistrymodel-h-file-do.html)

adhiraj October 31, 2011 14:50

What does the 'makeChemistryModel.H' file do?
 
Hi all,
I am talking about the file
Quote:

~/OpenFOAM/OpenFOAM-1.7.1/src/thermophysicalModels/chemistryModel/chemistryModel/basicChemistryModel/makeChemistryModel.H
Thanks in advance.

Manuel CFD November 14, 2013 13:02

ODE Solvers for Chemistry Models
 
I have the same question; ODEChemistryModel class appears as argument of makeChemistryModel, but looking at the source files it doesn't seem connected to any derived class among basicChemistryModel, psiChemistryModel and rhoChemistryModel.
Thanks

marupio November 14, 2013 14:45

In 1.6 it makes sense, I'm not sure if it was removed from 1.7 and left the macro definition file by accident... but this file defines a macro that other files invoke to create their instantiations.

Look for derived chemistry models ending in "s.C", such as psiChemistryModels.C.

Manuel CFD November 15, 2013 06:25

Thank you a lot for your answer.

Only to be more precise: this means that virtual functions defined in .H files (such as solve() and calculate() virtual methods inserted in psiChemistryModel.H) can be explicited in other .H files (ODEChemistryModel.H), not directly connected to the previous ones (psiChemistryModel.H doesnt include any link to ODEChemistryModel.H)??

If I understood well the psiChemistryModels.C establishes this kind of connection between ODEChemistryModel class and psiChemistryModel one??

Furthermore let consider the following lines appearing in psiChemistryModels.H (OpenFoam version 2.1.1):

namespace Foam
{
makeChemistryModel
(
ODEChemistryModel,
psiChemistryModel,
gasThermoPhysics
);
}

When the compiler reads these lines, what does it do? Is it correct to say that it creates a common space where the three arguments share their functions/methods???
I thank you a lot in advance.

Manuel

marupio November 15, 2013 17:40

ODEChemistryModel is entirely different from the other derived classes in the folder. It doesn't inherit basicChemistryModel. If you expand the makeChemistryModel define, you will see. Take psiChemistry, for instance:

Code:

    makeChemistryModel
    (
        ODEChemistryModel,
        psiChemistryModel,
        gasThermoPhysics
    );

expands into:
Code:

typedef ODEChemistryModel<psiChemistryModel, gasThermoPhysics>
    ODEChemistryModelpsiChemistryModelgasThermoPhysics;

defineTemplateTypeNameAndDebugWithName
(
    ODEChemistryModelpsiChemistryModelgasThermoPhysics,
    "ODEChemistryModel<psiChemistryModel,gasThermoPhysics>",
    0
);

addToRunTimeSelectionTable
(
    psiChemistryModel,
    ODEChemistryModelpsiChemistryModelgasThermoPhysics,
    fvMesh
);

Two of those are also macros that expand. defineTemplateTypeName... adds static data members for OpenFOAM's built-in class name and debug tracking system. The addToRunTimeSelection.. is for OpenFOAM's runTime selection mechanism, which adds virtual constructors for this chemistry model... basically when the user puts this chemistry model into the input file, OpenFOAM knows which piece of code to load, even if it is a brand new piece of code that didn't exist when OpenFOAM was compiled on your machine.

I'm sure I'm being confusing. Also running out of time before I have to jet!

-Dave

Manuel CFD November 18, 2013 06:06

Hi marupio,

Thanks a lot for your explanation. This feature is now clear to me.
Anyway I have still a doubt: what is the product of the following lines

makeChemistryModel
(
ODEChemistryModel,
psiChemistryModel,
gasThermoPhysics
);

?? Are the 3 classes gathered in a single class??

Because if it does not happen, I can't understand how a function/method of psiChemistryModel class could be specified in ODEChemistryModel class, since ODEChemistryModel does not inherit psiChemistryModel.

Thank you.

Manuel


All times are GMT -4. The time now is 23:11.