|
[Sponsors] |
Open a file at first time step to write data in it(and restart) |
![]() |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
![]() |
![]() |
#1 |
Senior Member
Farzad Faraji
Join Date: Nov 2019
Posts: 206
Rep Power: 7 ![]() |
Hello everyone
How can I open a file only at first time step and write my data there? The problem is that, I need to restart the code, and when I restart the code, it opens a new file and write from "restartTime" there and I loose the transient data until "restartTime". I want to use "if"; Code:
label curTimeIndex = mesh.time().timeIndex(); if(curTimeIndex == 1) { ofstream myfile1; myfile1.open ("kineticEnergyFFD.txt"); } Code:
postprocessingFFD.H:731:3: error: ‘myfile1’ was not declared in this scope myfile1 << runTime.timeName() << " " << avekineticEnergy0 << " " << minkineticEnergyNew << " " << maxkineticEnergyNew << Farzad |
|
![]() |
![]() |
![]() |
Tags |
data file, first time step, openfoam, restart |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
[swak4Foam] funkyDoCalc with OF2.3 massflow | NiFl | OpenFOAM Community Contributions | 14 | November 25, 2020 03:30 |
SparceImage v1.7.x Issue on MAC OS X | rcarmi | OpenFOAM Installation | 4 | August 14, 2014 06:42 |
Problem compiling a custom Lagrangian library | brbbhatti | OpenFOAM Programming & Development | 2 | July 7, 2014 11:32 |
[swak4Foam] build problem swak4Foam OF 2.2.0 | mcathela | OpenFOAM Community Contributions | 14 | April 23, 2013 13:59 |
ParaView Compilation | jakaranda | OpenFOAM Installation | 3 | October 27, 2008 11:46 |