CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Programming & Development (
-   -   create an output file only at the endTime (

Cyp March 3, 2011 06:53

create an output file only at the endTime

I would like to create an output file at my last time step. I wondered if an command similar to

    if (runTime.outputTime())
          logFile << balbalbalblalba << endl;

exist for the last time step ?

Any help would be appreciated.

Best regards,

marupio March 3, 2011 12:18

I believe you're looking for:


if (runTime.end())

Cyp March 3, 2011 12:29

Hi Marupio!

Thank you for your answer. I tried your suggestion but nothing is written inside my output file...

akidess March 4, 2011 05:15

You could also put your write command behind the time loop:


while (
logfile << STUFF;

Of course you will only be able to output variables that were defined outside the time loop brackets, e.g. in createFields.H.

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