CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM (
-   -   change value of k in the solver dieselFoam (

yejungong July 21, 2009 07:20

change value of k in the solver dieselFoam

I want to change the value of k and epsilon in the solver, dieselFoam. But k and epsilon is initialized in turbulenceModel, and I only know how to read them. I tried to define a pointer pointing to k, and then change the value of k. The following is my code,
const tmp<volScalarField>& k=turbulence->k();
k +=
turbulenceDepletionSource() is defined in dieselSpray class as the source term for the k-equation, similar to momentum source term

But it didn't work. The error message is attached in the bottom. I tried to update it cell by cell, but failed either.

Any suggestions will be highly appreciated.
thanks a lot


The following the error message,

dieselFoam.C: In function 'int main(int, char**)':
dieselFoam.C:89: error: passing 'const Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >' as 'this' argument of 'void Foam::tmp<T>::operator=(const Foam::tmp<T>&) [with T = Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>]' discards qualifiers

All times are GMT -4. The time now is 13:47.