CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   change value of k in the solver dieselFoam (http://www.cfd-online.com/Forums/openfoam/66658-change-value-k-solver-dieselfoam.html)

yejungong July 21, 2009 07:20

change value of k in the solver dieselFoam
 
Hi,

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 +=
dieselSpray.turbulenceDepletionSource()*runTime.deltaT()/rho;
-----------------------
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

Yejun



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 01:59.