Cactus Code Thorn idl5_utils Authors : Paul Walker, Joan Masso, Gerd Lanferman Managed by : PW,JM,GL Version : 1.0 -------------------------------------------------------------------------- This thorn provides IDL5 tools for looking at cactus data. It is chock full of handy tidbits. To use it, do the following: 1. Add +CCTK/arrangements/external/IDL5utils/lib to your IDL_PATH. For example, you can add the following to your .cshrc (and source ~/.cshrc afterwards to activate it): setenv IDL_PATH "+~/CCTK/arrangements/external/IDL5utils/lib" or (if you use bash/ksh) in your .profile/.bashrc export IDL_PATH="+~/CCTK/arrangements/external/IDL5utils/lib" 2. You are set! Start idl version 5 (aliased to idl_5 in the AEI), pick a tool from the list below (e.g., cactus_s3d) and enjoy. ******************* Tool documentation ******************* A general comment about ieeeio files with IDL --------------------------------------------- (note: this section was valid for cactus 3.0, in cactus 4.0 look for the FlexIO library) IDL cannot read ieeeio files which are generated when the code crashes, since these files do not have a valid header. To generate a valid header you need to run "ioinfo" on the file, eg, "ioinfo xxx_3d.raw". "ioinfo" can be build from cactus/lib/IEEEIO by the command "gmake ioinfo" in that directory (or something like that). IDL cannot do byte swapping. This means that if you write on a machine with a different byte ordering than you read on, you will have to convert to the native byte ordering before you visualize. This is required on, for instance, T3E or Origin writing followed by DEC or Linux reading. To do this make "convert2native" on your local machine by cd cactus/lib/IEEEIO gmake convert2native (Move convert2native into your path) convert2native infile outfile At some point in the future, a native IDL reader which does not require this step will be available; If you are interested in developing this, please contact Paul who will give you details. DATA READERS ------------ xg subroutine: -------------- This is a subroutine to read cactus xgraph data into an IDL array. Usage is xg,alp,x,t,file='alp.xl' surface,alp,x,t This can be used effectively with the "xgps" viewer, below xgdata object: -------------- This object allows you to read xgraph data as an object. Typical usage is: xgd = OBJ_NEW('xgdata', file='alp.xl') print,xgd->nsets() xgd->dataset,4,x,y,t plot,x,y,title="Alp at "+strtrim(string(t),2) Read the source to find all the member functions ieeedata object: ---------------- This is a simpler OO routine to John Shalfs ieeeread.pro. Typical usage is gxx = OBJ_NEW('ieeedata',file='gxx_3d.raw') print,gxx->ndatasets() gxx->select,3 gxx->read,data gxx->readattr,0,name,dat print,name,dat gxx->readnameattr,"max_ext",dat cactusdata object: ------------------ This object extends the ieeedata object to add a few member functions with cactus-specific functionality to get coordiantes and time. Typical usage is alp = OBJ_NEW('cactusdata', file='alp_3d.raw') alp->select,3 alp->read,data t = alp->time() alp->getcoords,x,y,z surface,data(1,*,*),y,z, title='Lapse at t='+strtrim(string(t),2) cac2ddata object: ------------------ This object extends the ieeedata object to add a few member functions with 2D cactus-specific functionality to get coordiantes and time. Typical usage is alp = OBJ_NEW('cac2ddata', file='alp_2d_xy.raw') alp->select,3 alp->read,data t = alp->time() alp->getcoords,x,y surface,data,x,y, title='Lapse in xy plane at t='+strtrim(string(t),2) ---------------- DATA VISUALIZERS ---------------- cactus_s3d ----------- The easiest volume slicer and isosurfacer. Just do: cactus_s3d then select a .raw file, pick a time and slice at your pleasure. Alternately, use cactus_s3d, file='filename' volslicer --------- volslicer is the actual slicer called by cactus_s3d, and can be used on any 3d data you want. Usage is volslicer, data_array where data_array is a 3D data array. Cactus_s3d wraps this with an ieeeio writer, so people will probably not use volslicer directly very often. xgps ---- This is a general tool for viewing two xgraph data sets on the command line. It is similar to the object multixg object, but does not use IDL object ideas. Typical usage would be xg,hh,xh,t,file='ham.xl' xg,hm,xm,t,file='med_ham.xl' xgps,hh,xh,plotalso=0.25*hm,xplotalso=xm,alsothick=2,/animate to do a quick convergence measure. Options are xgps, y-data, x-data, /animate, ; Do an animaton animspeed = #, ; 1 is quick, 10 is slow plotalso = y2, ; Also plot field y2 of x xplotalso = x2, ; Alternate x coordinate for y2 alsothick = #, ; Thickness for second line /overplot, ; DO not start a fresh plot, but use old axes title = " ", ytitle = " ", xtitle = " ", psym = " ", symsize = " ", xrange = " ", yrange = " ", /ylog ; What you'd think anim_twod --------- anim_twod uses xinteranimate to make time animatinos of cactus 2d data files. It can also generate animated gifs. Basic usage is: anim_twod,2dfilepointer for instance IDL> device, pseudo=8 IDL> q=OBJ_NEW('ieeedata',file='field_2d_xy.raw') IDL> anim_twod,q Options are /surface: Make wireframe surface plot for anim /shade_surf: Make shaded surface plot for anim az =, ax = : Control surface rotation gifbase = " ": Dump to gifbaseXXX.gif for each set firstset, lastset, stepset: Controls of which sets to view. animate in 2D, start 40th set and stop at 20th set before end, skip every 5 inbetween: IDL> anim_twod,q,firstset=40,lastset=20,stepset=5 You can choose a shaded surface IDL>anim_twod,q,firstset=40,lastset=20,stepset=5,/shade_surf You write every animated picture to a numbered file, this file can be converted to a animated gif or mpeg. IDL>anim_twod,q,firstset=40,lastset=20,stepset=5,/shade_surf,gifbase='yahoo' ax (ay,az) let you change the angle of the axes IDL>anim_twod,q,firstset=40,lastset=20,stepset=5,/shade_surf,gifbase='yahoo,ax=20 xgraph ------ This is a total rip off of xgraph written in IDL, which is handy to do xgraph visualization when the number of data sets are > 120. Usage couldn't be easier. Type "xgraph" and then pick "open" or use "xgraph, file='myfile.dat'" ccmap2d ------- ccmap2d is a 2d data viewer, like "surface" and "contour" which displays the data as a color map with a contour and colormap scale all on one plot. It is the default animation mode for anim_twod, but can be called alone. Examples would be x = findgen(50) z = exp(-x/10)#cos(x/3) !P.title = "A Demonstration" ccmap2d,z Options are ccmap2d,dat,x,y,zrange=zrange Set titles using !P.title and so on, as shown in the example. xgplot object: -------------- This object inherits member functions from xgdata and adds plotting routines. Most people will probably perfer to use xgps. Typical usage is pp = OBJ_NEW('xgplot', file='alp.xl') pp->plot pp->plot,/anim pp->plot,title="Alpha and gxx",lines=2 pp->read,'gxx.xl' pp->plot,/overplot pp->surface pp->surface,az=20,/shade,title='A Surface Plot!' multixg object: --------------- This object provides basic operations on collections of xgraph data sets. Most people will probably want to use xgps. Typical session is pp = OBJ_NEW('multixg') pp->read, 'gxx.xl' pp->read, 'alp.xl' pp->plotone, 0, title='gxx' pp->surfaceone,1, ztitle=alp pp->coanimate