CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Programming & Development (
-   -   Adding a new member function to SingleStepCombustion (

tatu February 15, 2013 04:37

Adding a new member function to SingleStepCombustion

I'm trying to add a new method to singleStepCombustion. The goal is to output reaction rate matrix for a specie transport equation, where the solved field is rho*Yi, instead of bare Yi (mass fraction of specie i). This is done for a modified rhoCentralFoam to handle specie transport. I thought this could be done by simply implementing the member function in singleStepCombustion.C as follows:

template<class CombThermoType, class ThermoType>
singleStepCombustion<CombThermoType, ThermoType>::Rrho
    const volScalarField& Y,
    const volScalarField& rhoY
) const
    const label specieI = this->thermo_->composition().species()[];

    const volScalarField wSpecie

    return wSpecie + fvm::Sp(0.0*wSpecie, rhoY);

Then I would add the function definition to singleStepCombustion.H:

virtual tmp<fvScalarMatrix> Rrho(const volScalarField& Y, const volScalarField& rhoY) const;
And finally add the definition to combustionModel.H:

virtual tmp<fvScalarMatrix> Rrho(const volScalarField& Y, const volScalarField& rhoY) const = 0;
I understand that this is all I have to do: I can't find other dependencies where the member function should be defined. Then I compile the combustionModel folder (wmake libso), and no errors or warnings are produced. If I then try to call the new member function with combustion->Rrho(Yi,rhoYi) inside the solver (analogically to working call combustion->R(Yi) ), and compile (wmake), I get the following error:

YEqn.H: In function ‘int main(int, char**)’:
YEqn.H:73:30: error: ‘class Foam::combustionModels::psiCombustionModel’ has no member named ‘Rrho’

I don't understand why the new member function isn't recognized. Did I forgot to add the member function definition somewhere? I've tried to look through everywhere I think it might be missing. I'm using OF 2.1.1, but the files from 2.1.x I added should be pretty much identical.


Thamali January 9, 2014 00:54

Hi tatu,
Did you solve your problem,although it is a long time to keep a problem?
If so I have a question for you.

All times are GMT -4. The time now is 18:31.