fracextract & grainextract

Asked by Robert Sarracino on 2014-02-28

What is the syntax for generating vtk files using grainextract and fracextract?

I tried

grainextract -i snapshot -o vtk_grain_ -rot -t 0 251 1000

but I got an "unknown option -o" message.

Question information

English Edit question
ESyS-Particle Edit question
No assignee Edit question
Solved by:
Dion Weatherley
Last query:
Last reply:
Best Dion Weatherley (d-weatherley) said : #1

Hi Robert,

fracextract uses similar syntax to dump2vtk. A typical fracextract commandline is:

fracextract -i snapshot -o fractures.vtu -vtk -rot -t 0 251 1000

Sometimes it is useful to get a full listing of the fracture times, locations etc. This is obtained by removing the '-vtk' argument above e.g.

fracextract -i snapshot -o fractures.txt -rot -t 0 251 1000

grainextract is quite different from the other two tools (fracextract and dump2vtk). It works on individual snapshots rather than a range of snapshots. It also has a wide range of output options. Two of the most common usages are the following:

1) add grain mass and grain ID to snapshot VTK files:
A) generate a grains list (identifying which particles belong to each grain/fragment) at timestep number 10000:
grainextract -i snapshot_t=10000_0.txt -list grains.list

B) generate VTK files using dump2vtk, providing the grains list as an argument:
dump2vtk -i snapshot -o snaps_ -rot -t 0 251 1000 -list grains.list

2) generate a list of grain masses (useful for constructing fragment size-distributions) at timestep number 10000:
grainextract -i snapshot_t=10000_0.txt -om grainMass_t=10K.txt

A full listing of the various grainextract options is provided in Tools/ExtractGrains/main.cpp of the source code. From that file:

   -i FILENAME : input file name
   -oc FILENAME : output nr. or particles per grain
   -list FILENAME : output list of particle id/ grain id pairs
   -om FILENAME : output mass of grains
   -dm FILENAME BASE CUMULATIVE(0/1) : output grain mass distribution
   -dd FILENAME BASE CUMULATIVE(0/1) : output grain diameter distribution
   -ds FILENAME BASE SMIN: "sieve" distribution
   -p PERC: get sieve size (diameter) for x-th mass percentile
   -vtk FILENAME MINMASS : write out grains above a minimal mass as vtk-xml files
   -tag MINTAG : ignore particles with tag<MINTAG
   -tagrange MINTAG MAXTAG : include only particles with MINTAG <= tag <= MAXTAG
   -diff FILENAME_1 FILENAME_2 : difference between to snapshots (req. -rmass or -fvtk)
   -rmass FILENAME : in combination with -diff, write relative size of largest fragment
   -rmf FILENAME COUNT : in combination with -diff, write the sizes of all fragments, return nr. of fragments written
   -minmass MINMASS : with -rmf, writes only fragments of grains with m>MINMASS
   -fvtk FILENAME EXP :
   -fv : write new grain id as fake vector field
   -profile FILENAME YMIN YMAX NBIN write y-profile of equiv. diameter
   -mprofile FILENAME YMIN YMAX NBIN SIZE_LIMIT write y-profile of matrix fraction
   -crossxy POS FILENAME W H FS : cross section in x-y plane, FS: 1 to filter singles, 0 not to filter
   -crossxz POS FILENAME W H FS : cross section in x-z plane
   -crossyz POS FILENAME W H FS : cross section in x-z plane
   -ppm : if cross section, save as PPM
   -abrasion FILENAME : output splitting/abrasion generated area. FILENAME: original (time step 0) data
   -btag TAG : only consider bonds with tag TAG
   -ocp FILENAME : write list of grain id / grain center position

Note that some of these options require the input simulation to have a specific model setup or require grainextract to be executed multiple times with different output options. If you are interested to use some of these options, I suggest you post another question to this thread so the relevant expert can reply. I mostly just use the two use cases described above.



Thanks, Dion.

Dian (hedian18) said : #3

Hi Dion and Robert,

I just couldn't display the broken fractures by opening the "fractures.vtu" file in Paraview. I checked the file and found out the NumverOfCell="0", which is non-0 in other similar files generated by dump2vtk. Are you guys able to get the fractures displayed in your models?


Dion Weatherley (d-weatherley) said : #4

Hi Dian,

There are two possibilities here:

1) no bonds broke during your simulation, or

2) you are trying to convert snapshots from a non-rotational simulation. If this is the case, remove the -rot argument from the fracextract command line.



Dian (hedian18) said : #5

Hi Dion,

Both the possibilities are not my cases. That means I do have broken bonds and rotational simulation. Actually, the broken bonds were recorded during the fracextract process in Terminal.

In my fractures.vtu file, the first portion consists of only 3 columns, which I guess are the coordinations. Are these 3 columns what are supposed to be?


Dion Weatherley (d-weatherley) said : #6

Hi Dian,

Can you please email me (<email address hidden>) your fractures.vtu file?

If the snapshot files are not too large (<10MB) could you also please email me the snapshot files for t=0 and the last timestep recorded? If too large to email, perhaps you could upload them to Google Docs, dropbox or similar so I can download them.



Dion Weatherley (d-weatherley) said : #7

Hi Dian,

I've had a look at the files you sent. There is no problem with your fractures.vtu file. NumberOfCells=0 is normal for fracextract VTK files. These files only contain point-data and not cell-data. dump2vtk files contain cell-data as well such as information about bonds.

When visualising fracextract output in paraview it is necessary to use a glyph. I typically use cones and set the height of the cones to be a quite small number (e.g. 0.0001). I scale the size of the cones according to radius. This method then visualises broken bonds as disks oriented perpendicular to the line joining the two particles whose mutual bond was broken.