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

Virtual Methods in combustionModel

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 23, 2023, 17:53
Default Virtual Methods in combustionModel
  #1
New Member
 
Peter Bevington
Join Date: May 2023
Posts: 10
Rep Power: 2
pbevington is on a distinguished road
Hi all, I'm relatively new to OpenFoam and was trying to understand reactingFoam when I came across this point of confusion about the pure virtual methods correct() and Qdot():

In reactingFoam (YEqn.h), we use the pointer reaction to call virtual methods belonging to the combustion model class:
Code:
reaction->correct();
Qdot = reaction->Qdot();
For reference, the pointer is defined in createFields.H:
Code:
autoPtr<CombustionModel<psiReactionThermo>> reaction
(
    CombustionModel<psiReactionThermo>::New(thermo, turbulence())
);
CombustionModel inherits these virtual methods from combustionModel.h:
Code:
        //- Correct combustion rate
        virtual void correct() = 0;

        //- Fuel consumption rate matrix, i.e. source term for fuel equation
        virtual tmp<fvScalarMatrix> R(volScalarField& Y) const = 0;

        //- Heat release rate [kg/m/s3]
        virtual tmp<volScalarField> Qdot() const = 0;
My question is: where are these pure virtual methods being implemented in the code? They aren't defined in CombustionModel.c, and digging around I couldn't find any evidence of their implementation that would affect reactingFoam, which leads me to be confused about how they would work at all...
pbevington is offline   Reply With Quote

Old   May 23, 2023, 20:30
Default
  #2
New Member
 
Peter Bevington
Join Date: May 2023
Posts: 10
Rep Power: 2
pbevington is on a distinguished road
I think I figured this out- CombustionModel.c doesn't implement the virtual methods because it is only creating a pointer to a specific combustion model type (EDM, laminar, infinitelyFastChemistry, etc) defined by the user at runtime. Instead, the virtual methods are implemented in these individual models, as they differ between them.
pbevington 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
Could you please help me about the VTKFoam liugx212 OpenFOAM Pre-Processing 5 February 13, 2008 11:31
OpenFoam 14 installation problem gfcoppola OpenFOAM Installation 20 November 2, 2007 13:38
[OpenFOAM] Could you please help me liugx212 ParaView 4 December 22, 2005 16:55
[OpenFOAM] LibvtkFoamso fred ParaView 2 November 18, 2005 19:01
Please help about the VTKFoam liugx212 OpenFOAM Running, Solving & CFD 0 November 18, 2005 18:27


All times are GMT -4. The time now is 20:28.