Changes between Version 80 and Version 81 of VisIt


Ignore:
Timestamp:
11/10/11 10:33:28 (13 years ago)
Author:
Jonathan
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • VisIt

    v80 v81  
    269269}}}
    270270[[CollapsibleEnd]]
     271[[CollapsibleStart(Script for following collapse of uniform sphere)]]
     272This script adjusts the window bounds to zoom in on a region at the same rate the region collapses (assuming it follows the solution for a uniform density sphere undergoing free fall collapse)
     273{{{
     274r_0=60                 # Initial radius of view (usually 150% of clump radius is good)
     275r_min=8                # Radius to stop shrinking at (32*levels(MaxLevel)%dx)
     276singular_time=.66      #t_ff using clump density in computational units (or by eye)
     277center=(240,240)       #Clump location in computational units
     278starting_frame=0       #Frame to start from
     279final_frame=63         #Frame to stop at
     280my_dir = "/grassdata/johannjc/scrambler_111007/modules/Problem/Images/2D" #directory for movie output
     281movie_name = "ZoomingRhoTestwSinksA" #base name for movie
     282
     283
     284# ~~~~~~~~~~~~~~~~~  Output file attributes...  ~~~~~~~~~~~~~~~~~~~~~~~~~
     285OldSaveWindowAtts = SaveWindowAttributes()
     286SaveWindowAtts = SaveWindowAttributes()
     287SaveWindowAtts.outputToCurrentDirectory = 0
     288SaveWindowAtts.outputDirectory = my_dir
     289SaveWindowAtts.fileName = movie_name
     290SaveWindowAtts.family = 0
     291SaveWindowAtts.format = SaveWindowAtts.PNG  #BMP, CURVE, JPEG, OBJ, PNG, POSTSCRIPT, PPM, RGB, STL, TIFF, ULTRA, VTK
     292SaveWindowAtts.width = 1024
     293SaveWindowAtts.height = 1024
     294SaveWindowAtts.screenCapture = 1
     295SaveWindowAtts.saveTiled = 1
     296SaveWindowAtts.quality = 80
     297SaveWindowAtts.progressive = 0
     298SaveWindowAtts.binary = 0
     299SaveWindowAtts.stereo = 0
     300SaveWindowAtts.compression = SaveWindowAtts.PackBits
     301GlobalAtts = GetGlobalAttributes()
     302
     303
     304a=GetView2D()
     305from math import *
     306for state in range(starting_frame, final_frame):
     307  Query('Time')   #Get current database time
     308  tratio=min(GetQueryOutputValue()/singular_time*1.0,1.0) # Calculate t/t_ff
     309  rratio=.7178*sqrt(1-tratio**2)+.3068*(1-tratio**2)-.01842 # Approximate fit to free fall radius ratio
     310  r=max(r_min,r_0*rratio) # Scale current radius based on rratio keeping it > r_min
     311  a.windowCoords=(center[0]-r, center[0]+r, center[1]-r, center[1]+r) # Set window coords to encompass clump circle
     312  for wins in GlobalAtts.windows: #In case there are multiple windows
     313    SetActiveWindow(wins)
     314    SetTimeSliderState(state)
     315    SetView2D(a)
     316  SaveWindowAtts.fileName = movie_name + "%(frame)04d" % {'frame':state}
     317  SetSaveWindowAttributes(SaveWindowAtts)
     318  SaveWindow()
     319  ClearCache("localhost")
     320SetSaveWindowAttributes(OldSaveWindowAtts)
     321}}}
     322
    271323[[CollapsibleStart(More complicated movie tracking a particle)]]
    272324I first had to use some linux-fu to get the particle's xy location that I wanted to track into xloc.dat.  I then used {{{d=f.readline}}} to read each line and {{{c=d.split}}} to parse the line.  I then used {{{c[3]}}} and {{{c[5]}}} as the x and y position of the particle which I then used to set the window coords etc...  Here is an AVI version of the [attachment:sinkzoom2.AVI movie]