CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Visualization & Post-Processing Software > ParaView

[General] Using time in Python script

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 11, 2014, 01:57
Default Using time in Python script
  #1
Member
 
Lingdeer
Join Date: Jul 2011
Posts: 49
Rep Power: 14
lingdeer is on a distinguished road
Hi,

I have data in time that has time points like {0.02124,0.04248,0.06372,0.08496, etc.}

I wrote a python script to loop through these time points with time increment of 0.02124 and export as .csv.

----------------------------------------------

for x in range(1, 4):

currentT = x*deltaT
AnimationScene1 = GetAnimationScene()
RenderView1 = GetRenderView()
AnimationScene1.AnimationTime = currentT
RenderView1.ViewTime = currentT
RenderView1.CacheKey = currentT
RenderView1.UseCache = 1
RenderView1.UseCache = 0


SetActiveSource(data)
writer = CreateWriter("output.csv")
writer.FieldAssociation = "Points"
writer.UpdatePipeline()
del writer

Render()

------------------------------------------

When I played the macro, some time points were not correctly read. (e.g. the 4th time point spreadsheet saved data that belong to the 3rd time point.)

I used "start trace" to see how paraview handles time, and here is what I caught:

--------------------------------------------------------
try: paraview.simple
except: from paraview.simple import *
paraview.simple._DisableFirstRenderCameraReset()

AnimationScene1 = GetAnimationScene()
RenderView1 = GetRenderView()
AnimationScene1.AnimationTime = 0.021239999681711197

RenderView1.ViewTime = 0.021239999681711197
RenderView1.CacheKey = 0.021239999681711197
RenderView1.UseCache = 1

AnimationScene1.AnimationTime = 0.042479999363422394

RenderView1.ViewTime = 0.042479999363422394
RenderView1.CacheKey = 0.042479999363422394
RenderView1.UseCache = 1

AnimationScene1.AnimationTime = 0.06372000277042389

RenderView1.ViewTime = 0.06372000277042389
RenderView1.CacheKey = 0.06372000277042389
RenderView1.UseCache = 1

AnimationScene1.AnimationTime = 0.08495999872684479

RenderView1.ViewTime = 0.08495999872684479
RenderView1.CacheKey = 0.08495999872684479
RenderView1.UseCache = 1

RenderView1.UseCache = 0

Render()
--------------------------------------------------------
Then I realized, if I tried to read data at 0.08496, it will read data from the previous time point instead. If I explicitly specify in my script to read data at time 0.08495999872684479, then it will read the correct data.

Anyone has any insights?
Thanks in advance!!!
lingdeer is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
bash script for pseudo-parallel usage of reconstructPar kwardle OpenFOAM Post-Processing 41 August 23, 2023 02:48
pimpleDyMFoam computation randomly stops babapeti OpenFOAM Running, Solving & CFD 5 January 24, 2018 05:28
How to export time series of variables for one point? mary mor OpenFOAM Post-Processing 8 July 19, 2017 10:54
pressure in incompressible solvers e.g. simpleFoam chrizzl OpenFOAM Running, Solving & CFD 13 March 28, 2017 05:49
dynamic Mesh is faster than MRF???? sharonyue OpenFOAM Running, Solving & CFD 14 August 26, 2013 07:47


All times are GMT -4. The time now is 17:36.