Thursday, July 30, 2009

dump2vtk: tips & tricks

dump2vtk is a very useful additional tool in ESyS-Particle.
It can be found in the folder ESyS-Particle root folder>/Tools/dump2vtk (for ESyS-Particle version 2.0 and not compiled with a custom folder for binaries, otherwise it'll be in the directory of all the binaries).

It can be used for creating VTK data files out of the files produced by CheckPointer.
What it does is essentially the following.
  • Take as input the different files produced by the CheckPointer (one file for each recording time step); these files are usually called
<CheckPointer fileNamePrefix> _t=????_ID.txt

where ID = 0 for the format file and = 1,2,3, .... for the different processes the simulations is
divided into, ???? stands for the number of the recording time step (in a series).
  • For each recording time step, a corresponding VTK unstructured grid (.vtu) file is created. In case of parallel simulations, dump2vtk takes care of putting together the different CheckPointer files and respective datasets stored by the different processes.
The basic syntax for dump2vtk is the following:

dump2vtk -i -o _ -t tini numsnap deltat [-list] [-bkrlist] [-t0] [-sz] [-rxb] [-single_tag] [-rot] [-unwrap]

Options and their arguments:

-i : setup the CheckPointer fileNamePrefix, which should be equal to the fileNamePrefix defined in the CheckPointPrms class.

-o: setup the VTK output fileNamePrefix

-t: define the initial recording time step (tini), the total number of snapshots that you want to produce (numsnap) and the gap between two recording time steps, i.e., the interval (in time steps) between two CheckPointer files (deltat), such that dump2vtk knows which CheckPointer file to convert next.

-list: instead of constructing the list of input files starting from the CheckPointer fileNamePrefix and from the arguments of the option -t, it takes as input a list of files

-brklist: not yet analyzed

-t0: not yet analyzed

-sz: take only a slice Z = constant

-rxb: not yet analyzed

-single_tag: not yet analyzed

-rot: flag for indicating that the particles are rotational

-unwrap: not yet analyzed

N.B. #1: the VTK output files produced by dump2vtk are numbered according to an increasing sequence. This sequence does not have any relation to the sequence of time steps the different CheckPointer files refer to. Example: suppose that, during an ESyS-Particle simulation, you recorded CheckPointer files every deltat = 100 time steps. You want to convert into VTK snapshots the CheckPointer files from time tini = 1000 to tfin = 5000. That means that you want to convert a total number of numsnap = 51 CheckPointer datasets into corresponding VTK snapshots. You can do that running the command

dump2vtk -i <CheckPointer filename prefix> -o <VTK unstructure grid filename prefix>_ -t 1000 51 100 [...]

The correspondingly generated VTK file names will be indexed from 0 to 50, being their index not related to the actual simulation time step the snapshot refers to.

N.B. #2: there could be a problem when your ESyS-Particle script is not writing CheckPointer
output files in the same directory where it's located. In order to get that, you have to define the CheckPointer fileNamePrefix with the full path, as in the following example:

ckptr_for_ParaView = CheckPointPrms(
fileNamePrefix = "/pool2/grm118/ShearFaultGouge2DEx3_31/2Dfg_test3_31_ckpt",
beginTimeStep = 0,
endTimeStep = nt,
timeStepIncr = 100
)

In such a case, the format file for each CheckPointer (the one whose name terminates with index 0) will point to the CheckPointer sub-domains files via their full paths. Example: for a simulation domain divided in 2 subdomains and for the CheckPointer at time t = 0, the file /pool2/grm118/ShearFaultGouge2DEx3_31/2Dfg_test3_31_ckpt_t=0_0.txt will point to the files /pool2/grm118/ShearFaultGouge2DEx3_31/2Dfg_test3_31_ckpt_t=0_1.txt and /pool2/grm118/ShearFaultGouge2DEx3_31/2Dfg_test3_31_ckpt_t=0_2.txt.

If you move the the CheckPointer files into a different directory where they were created or onto a different machine and then try to run dump2vtk, it won't find the sub-domain Checkpointer files, unless the same path is recreated, in the new machine case.
Suggestion: if you are using full path CheckPointer fileNamePrefix in your ESyS-Particle script, leave the CheckPointer files in the same directory and machine before running dump2vtk. If you need to move the CheckPointer files on a different machine, write the CheckPointer files in the same directory the ESyS-Particle script runs in.
-------------------------------------------------------------------------------------------------
Disclaimer

This post is based on the author's personal experience in using the ESyS-Particle Discrete Element Method code.
This post should not be considered as an official document about the code itself.
This post does not come with any warranty about the correctness of its content.
If you find any error in the content, please write to the author.
-------------------------------------------------------------------------------------------------