CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   For loops in OpenFoam (

balkrishna September 6, 2010 07:54

For loops in OpenFoam
I am generalising the twoPhase Euler Foam to handle n Phases . In the file pEqn.H I want to sum up the phase fraction of all the dispersed phases to get the dispersed phase . To do so I programmed the following :

    //just an initialization                                                                                                                 
    surfaceScalarField af ;                                                                                                                 
    surfaceScalarField betaf = scalar(1) - af;                                                                                               
        af= af + alphaf[aPh];                                                                                                               
    betaf = scalar(1) - af ;

On compilation I got the following error :

error: no matching function for call to ‘Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh>::GeometricField()’
/home/ifmg/OpenFOAM/OpenFOAM-1.7.0/src/OpenFOAM/lnInclude/GeometricField.C:652: note: candidates are: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Foam::GeometricField<Type, PatchField, GeoMesh>&, const Foam::wordList&) [with Type = double, PatchField = Foam::fvsPatchField, GeoMesh = Foam::surfaceMesh]

alberto September 7, 2010 02:48


af must be initialized on declaration. You can define it with IObject, but specifying NO_READ, NO_WRITE as options, and setting it to zero (see how this is done for ppMagf in twoPhaseEulerFoam for example).


balkrishna September 7, 2010 02:52

Ok ... Thanks ...

All times are GMT -4. The time now is 03:53.