I am working with openfoam and I want to create csv datasets for each iteration I save, for each U and p. For instance, my case converges at 320 iterations and I write to a file every 10 iterations. So, I want to save 30 files (10.csv, 20.csv, 30.csv .... 320.csv); for each variable, U and p, with the csv containing all the values of each cell at that iteration. I do not know how to start. I tried some scripts with python's paraview, but they are not giving me what I expect. This is my current code:
import paraview
import paraview.simple as pv
a = pv.GetActiveSource()
a.UpdatePipeline()
rawData = pv.servermanager.Fetch(a)
data_cell = rawData.CELL_DATA_FIELD
data_cell = rawData.GetCellData()
print data_cell
writer = pv.CreateWriter('10.csv')
writer.UpdatePipeline()
Before working out how to do this iteratively for each file, I just first want to get one file in the csv format I want. I am wondering how to approach this.