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 :
Code:
PtrList<surfaceScalarField>alphaf(nPhases); Code:
error: no matching function for call to ‘Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh>::GeometricField()’ |
The problem isn't the for loop, it's your PtrList .set command:
Code:
alphaf.set(aPh,fvc::interpolate(phases[aPh].alpha())); Code:
alphaf.set |
The error wasnt for the alphaf.set line . It was for the "surfaceScalarField alphaf ; " line
|
|
there is no default constructor for the surfaceScalarField.
it needs to know about its size, take any available surfaceScalarField available and use that. For instance phi and surfaceScalarField alphaf(phi.size()); |
Thanks evry1 .... my problem was solved ... i initialized af in createFields.H and that solved the problem as suggested by alberto here ...
|
All times are GMT -4. The time now is 23:35. |