-
Notifications
You must be signed in to change notification settings - Fork 57
Processing X ray diffraction data: grain centroids and volumes
Methods such as far-field 3DXRD or Laue diffraction provides incomplete information on a grain structure, such as the grains centroids (centers of mass) and volumes. Neper can generate the optimal tessellation (made of convex cells) that corresponds to such a data set. The tessellation can be described as a raster tessellation (for FFT simulations) or can be meshed (for FEM simulations). This is described step by step in the following.
The input data are no more than what the user should know about the data set:
- the number of grains
- the grain centroids
- the grain sizes (volumes in 3D, surface areas in 2D, or equivalent diameters)
- the shape and position of the domain, i.e. of the actual specimen
- optionally, the crystal orientations of the grains
📣 Neper "rescales" the grain sizes so that they sum out to the actual domain size. This works for all inputs (volumes in 3D, surface areas in 2D, or equivalent diameters).
📣 Providing crystal orientations is optional in the sense that they do not influence tessellation generation. However, when provided, they are copied to the tessellation (and then pushed to the mesh).
A tessellation can be generated using neper -T. The input listed above must be specified using the following options:
-
-nspecifies the number of grains -
-dimspecifies the dimension -
-morphospecifies the morphology (here, both the grain centroids and the grain surface areas / volumes) -
-domainspecifies the domain -
-orispecifies the crystal orientations
Additional options may be useful:
-
-regularization(or-reg, for short) regularizes the tessellation (useful only if the tessellation will be meshed)
-dim defaults to 3 and is therefore needed only if the actual dimension is 2.
Grain centroids and sizes can be specified using -morpho "centroidsize:file(file_name)". file_name is typically formatted by providing the grain centroids (2 entries in 2D, 3 entries in 3D) and volumes of the grains on successive lines. An example for 10 grains in 3D is
0.100 0.119 0.557 0.013
0.259 0.142 0.201 0.060
0.139 0.375 0.321 0.040
0.386 0.411 0.587 0.009
0.133 0.369 0.777 0.030
0.379 0.259 0.860 0.035
0.130 0.109 0.850 0.018
0.385 0.407 0.125 0.012
0.418 0.382 0.375 0.008
0.363 0.146 0.576 0.025
📣 The data can be space or tab delimited.
-n and -dim must be consistent with the value of -morpho. Some bash magic can be used to define them automatically (e.g. wc -l file_name | awk '{print $1}' for -n).
The domain must be convex and can be most commonly defined as either a cuboid (using cube(...)), a cylinder or any other prism (using cylinder(...)) (use square or circle in 2D). More complex domains can be defined through a series of "cutting planes" (using planes(...)).
:translate(...). (It can also be rotated by appending :rotate(...) or scaled by appending :scale(...).)
-dim must be consistent with the value of -domain.
📣 This is entirely optional and only intended to validation.
Before the tessellation is generated, it can be safe to visualize the data set. This can be done as follows:
- Generate a 1-grain tessellation that defines the domain using, for example,
$ neper -T -n 1 -domain "cube(0.5,0.5,1)" -o domain
- Visualize both the domain (defined in
domain.tess) and the grain centroids (written in filecoo_file) using, for example
$ neper -V domain.tess,coo_file -datacelltrs 0.5 -datapointrad 0.1 -print img

This example case looks properly formatted as the grain centroids lie in the domain.
- Visualize both the domain (defined in
domain.tess) and the grain centroids (written in filecoo_file) and radii (written in filerad_file) using, for example
$ neper -V domain.tess,coo_file -datacelltrs 0.5 -datapointrad file (`rad_file`) -print img

Again, this example case looks properly formatted as the grains (visualized as spheres) fit the domain.
The tessellation can be generated by neper -T, using all necessary options. An example is
$ neper -T -n 10 -domain "cube(0.5,0.5,1)" -morpho "centroidsize:file(file_name)" -o px
The terminal output is
======================== N e p e r =======================
Info : A software package for polycrystal generation and meshing.
Info : Version 4.0.1
Info : Built with: gsl|muparser|opengjk|openmp|nlopt|libscotch (full)
Info : Running on 8 threads.
Info : <http://neper.info>
Info : Copyright (C) 2003-2020, and GNU GPL'd, by Romain Quey.
Info : Ignoring initialization file.
Info : ---------------------------------------------------------------
Info : MODULE -T loaded with arguments:
Info : [ini file] (none)
Info : [com line] -n 10 -domain cube(0.5,0.5,1) -morpho
centroidsize:file(file_name) -o px
Info : ---------------------------------------------------------------
Info : Reading input data...
Info : Creating domain...
Info : Creating tessellation...
Info : [i] Parsing file `file_name'...
Info : [i] Parsed file `file_name'.
Info : - Setting seeds... 100%
Info : - Generating crystal orientations...
Info : - Running tessellation...
Info : > Initial solution: f =0.030354647
Info : > Iteration 23733: fmin=0.001822992 f=0.001822992
Info : > Reached `eps' criterion.
Info : Writing results...
Info : [o] Writing file `px.tess'...
Info : [o] Wrote file `px.tess'.
Info : Elapsed time: 9.758 secs.
========================================================================
For large numbers of grains, the optimization can be quite CPU-intensive (the centroids/sizes is actually the type of inputs that is the slowest to converge). You can, however, use -morphooptistop to shorten the tessellation using a more liberal termination criterion. An example is
$ neper -T -n 10 -domain "cube(0.5,0.5,1)" -morpho "centroidsize:file(file_name)" -morphooptistop "eps=1e-4" -o px
The terminal output is
======================== N e p e r =======================
Info : A software package for polycrystal generation and meshing.
Info : Version 4.0.1
Info : Built with: gsl|muparser|opengjk|openmp|nlopt|libscotch (full)
Info : Running on 8 threads.
Info : <http://neper.info>
Info : Copyright (C) 2003-2020, and GNU GPL'd, by Romain Quey.
Info : Ignoring initialization file.
Info : ---------------------------------------------------------------
Info : MODULE -T loaded with arguments:
Info : [ini file] (none)
Info : [com line] -n 10 -domain cube(0.5,0.5,1) -morpho
centroidsize:file(file_name) -morphooptistop eps=1e-4 -o px
Info : ---------------------------------------------------------------
Info : Reading input data...
Info : Creating domain...
Info : Creating tessellation...
Info : [i] Parsing file `file_name'...
Info : [i] Parsed file `file_name'.
Info : - Setting seeds... 100%
Info : - Generating crystal orientations...
Info : - Running tessellation...
Info : > Initial solution: f =0.030354647
Info : > Iteration 1675: fmin=0.007056908 f=0.007059917
Info : > Reached `eps' criterion.
Info : Writing results...
Info : [o] Writing file `px.tess'...
Info : [o] Wrote file `px.tess'.
Info : Elapsed time: 0.619 secs.
========================================================================
The doubtful user can output the actual grain centroids and volumes using
$ neper -T -loadtess px.tess -statcell x,y,z,size
which generates a file px.stcell with the data, to be compared to the input.
The tessellation can be visualized using
$ neper -V px.tess -datacelltrs 0.5 -datacellcol id -print img

As pointed out before, the tessellation can actually be described as a raster or a scalar tessellation. For a raster tessellation, use -format tesr:
$ neper -T -n 10 -domain "cube(0.5,0.5,1)" -morpho "centroidsize:file(file_name)" -format tesr -o px
For a scalar tessellation (to be meshed), it is useful to apply regularization:
$ neper -T -n 10 -domain "cube(0.5,0.5,1)" -morpho "centroidsize:file(file_name)" -reg 1 -o px
A tessellation can be meshed into finite elements using neper -M. The meshing parameters are typically the following:
-
-rcl(orcl) specifies the relative (or absolute) element characteristic length -
-orderspecifies the order of the elements
📣 Many other options are available.
An example is
$ neper -M px.tess -rcl 0.5 -order 2
The mesh can be visualized using
$ neper -V px.tess,px.msh -dataelsetcol id -dataelt1drad 0.002 -dataelt3dedgerad 0.001 -print img
