|
[Sponsors] |
December 10, 2015, 13:56 |
void correct() in basicChemistryModel
|
#1 |
Member
Ben Jankauskas
Join Date: Jun 2013
Location: Exeter
Posts: 34
Rep Power: 13 |
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(); Code:
{ reaction->correct(); dQ = reaction->dQ(); label inertIndex = -1; volScalarField Yt(0.0*Y[0]); Code:
autoPtr<psiChemistryModel> reaction ( psiChemistryModel::New(mesh) ); psiChemistryModel& chemistry = reaction(); psiReactionThermo& thermo = reaction->thermo(); thermo.validate(args.executable(), "h", "e"); basicMultiComponentMixture& composition = thermo.composition(); Code:
reaction->correct(); // chemistry.correct(); dQ = reaction->dQ(); label inertIndex = -1; volScalarField Yt(0.0*Y[0]); 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(); Last edited by rhythm; December 11, 2015 at 10:10. |
|
December 11, 2015, 06:56 |
|
#2 |
Member
Ben Jankauskas
Join Date: Jun 2013
Location: Exeter
Posts: 34
Rep Power: 13 |
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; 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 10:10. |
|
Tags |
chemistry model, combustion model, inheritance, reaction model |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Is my Dynamic mesh setup correct? | cfd seeker | FLUENT | 16 | October 30, 2020 07:16 |
this->refValue()[faceI] = ?? | peteryuan | OpenFOAM Programming & Development | 14 | August 29, 2018 15:11 |
[Other] dynamicTopoFVMesh and pointDisplacement | RandomUser | OpenFOAM Meshing & Mesh Conversion | 6 | April 26, 2018 08:30 |
Where are correct () and update() functions defined ? | sasanghomi | OpenFOAM | 5 | August 16, 2013 10:49 |
particle-tracking solvers and void fraction | Smed | OpenFOAM Running, Solving & CFD | 0 | March 25, 2013 17:57 |