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

void correct() in basicChemistryModel

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 10, 2015, 12:56
Default void correct() in basicChemistryModel
  #1
Member
 
Ben Jankauskas
Join Date: Jun 2013
Location: Exeter
Posts: 34
Rep Power: 12
rhythm is on a distinguished road
Hi folks,

I have been working on a reacting flow solver and I'm trying to get it compile by avoiding the use of 'combustionModel' (because I don't need it ). There is one thing that I am not entirely sure about.

basicChemistryModel class contains a protected member function 'void correct()'. In reactingFoam solver it is called before solution procedure of each species equation (code example below).

I tried replicating the solver but instead starting with combustionModels object I created psiChemistryModel instead and went from there. You can see an example below. When I try to compile the solver it says that void correct() is a protected member function of basicChemistryModel and cannot be accessed

What is not clear for me is how does creating a combustion model gives the solver access to this member function, even though it doesn't have any inheritance (not that inheritance should give access to protected variables), but psiChemistryModel does not get the access (again not that it should get access to protected variables)?

part from reactingFoam createFields.H
Code:
Info<< "Creating reaction model\n" << endl;

autoPtr<combustionModels::psiCombustionModel> reaction
(
    combustionModels::psiCombustionModel::New(mesh)
);

psiReactionThermo& thermo = reaction->thermo();
thermo.validate(args.executable(), "h", "e");

basicMultiComponentMixture& composition = thermo.composition();
PtrList<volScalarField>& Y = composition.Y();
part from reactingFoam YEqn.H
Code:
{
    reaction->correct();
    dQ = reaction->dQ();
    label inertIndex = -1;
    volScalarField Yt(0.0*Y[0]);
part from myReactingFoam createFields.H

Code:
autoPtr<psiChemistryModel> reaction
(
    psiChemistryModel::New(mesh)
);

psiChemistryModel& chemistry = reaction();

psiReactionThermo& thermo = reaction->thermo();

thermo.validate(args.executable(), "h", "e");

basicMultiComponentMixture& composition = thermo.composition();
part from myReactingFoam YEqn.H
Code:
    reaction->correct();
//    chemistry.correct();
    dQ = reaction->dQ();
    label inertIndex = -1;
    volScalarField Yt(0.0*Y[0]);
Error message:
Code:
/usr/local/OpenFOAM//OpenFOAM-2.3.1/src/thermophysicalModels/chemistryModel/lnInclude/basicChemistryModel.H:95:14: error: ‘void Foam::basicChemistryModel::correct()’ is protected
         void correct();
Ben

Last edited by rhythm; December 11, 2015 at 09:10.
rhythm is offline   Reply With Quote

Old   December 11, 2015, 05:56
Default
  #2
Member
 
Ben Jankauskas
Join Date: Jun 2013
Location: Exeter
Posts: 34
Rep Power: 12
rhythm is on a distinguished road
Hi,

OK so it is know obvious that it was a silly question.

void correct() method is different in combustionModel and in basicChemistryModel. So when reactingFoam foam is calling for this method it is actually referring to the one defined in combustionModel.H which is not protected, whereas if the solver is structured the way I am playing with it, then the code is trying to access void correct() method in basicChemistryModel which is protected and it also has different functionality than the one called by reactingFoam.

From combustionModel.H:
Code:
public:
    // Member Functions
        // Access
<...>
   // Evolution
        //- Correct combustion rate
        virtual void correct() = 0;
So, again my excuses for a silly question in the first place

On a side note: would anyone more experienced in here have an opinion whether the chemistry modelling would work when psiChemistryModel object is called directly like I have done, or whether it is necessary to have a combustionModels:siCombustionModel in order for chemistry solver to work?

Last edited by rhythm; December 11, 2015 at 09:10.
rhythm is offline   Reply With Quote

Reply

Tags
chemistry model, combustion model, inheritance, reaction model


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
Is my Dynamic mesh setup correct? cfd seeker FLUENT 16 October 30, 2020 06:16
this->refValue()[faceI] = ?? peteryuan OpenFOAM Programming & Development 14 August 29, 2018 14:11
[Other] dynamicTopoFVMesh and pointDisplacement RandomUser OpenFOAM Meshing & Mesh Conversion 6 April 26, 2018 07:30
Where are correct () and update() functions defined ? sasanghomi OpenFOAM 5 August 16, 2013 09:49
particle-tracking solvers and void fraction Smed OpenFOAM Running, Solving & CFD 0 March 25, 2013 16:57


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