Commit f00d05d3 authored by Max Wiebicke's avatar Max Wiebicke
Browse files

continuing the contact orientations tutorial

parent cf351c7b
Pipeline #50566 passed with stages
in 23 minutes and 40 seconds
......@@ -117,14 +117,94 @@ Mean Coordination DEM (reference): **3.32**
Measuring Orientations
=======================
Coming soon!!
Once we are happy with the identified contacts, we can start calculating their orientations.
Currently, there are two different approaches implemented in spam.
The first determines the orientation based on the labelled image and is therefore called `watershed="ITK"`.
The second technique segments each pair of contacting grains additionally using the random walker, which allows a far more accurate determination of the contact orientation.
It is called with `watershed="RW"`.
We strongly recommend the random walker segmentation, although it is more time consuming.
You can assign `NumberOfThreads` to distribute the calculation to multiple nodes.
The orientations can be calculated by::
contactOrientations = spam.label.contactOrientationsAssembly(lab, Box, contactingLabelsRefined, watershed="RW", NumberOfThreads=2)
Note that the orientations are saved in (z,y,x) order as given in the Module Index.
The orientations can then be plotted, using for example the orientation plotter implemented in spam.::
import spam.plotting
spam.plotting.plotOrientations(contactOrientations[0:,2:5], plot="both", numberOfRings=6)
Which results in a plot of the individual orientations as points and a binned version which is usefull when thousands of orientations are to be plotted.
.. figure:: images/tutorial/08-contacts/SpamTut_OriRW.png
:align: center
:width: 70%
As done for the coordination number, we can also compare the orientations to the reference.
Remind that the reference is the DEM simulation, that was used to create this assembly of spheres.
It can be loaded from the examples::
_, referenceOrientations = spam.datasets.loadDEMtouchingGrainsAndBranchVector()
Here, we compare the orientations that are calculated from the images using either the ITK watershed or the random walker with the reference orientations from the DEM simulation.
.. image:: images/tutorial/08-contacts/SpamTut_OriDEM_points.png
:width: 32%
.. image:: images/tutorial/08-contacts/SpamTut_OriRW_points.png
:width: 32%
.. image:: images/tutorial/08-contacts/SpamTut_OriITK_points.png
:width: 32%
From these images, one can already guess that the random walker approach produces more accurate results.
A more thorough metrological analysis is presented in [Wiebicke2019]_.
**Note** that the determination of orientation gets substantially more complex and error-prone for irregularly shaped grains.
If the calculation runs into problems, it will output a zero vector for the contact pair.
These vectors have to be deleted (or neglected) from the orientations in order to work on the data set.
As the orientations are calculated by performing a principal component analysis the number of data points corresponds to the quality of the fit.
This number is given as the last entry (column) of the `contactOrientationsAssembly()`.
It is recommended to exclude orientations with very few (I usually exclude at about less than 10 for Hostun Sand at 15 micro meter) and very many of these data points (oversegmentation).
These values depend on the spatial resolution of the tomographies.
Capturing fabric
=======================
In order to capture the fabric, we need to treat all the individual orientations statistically.
The most common way to do so, is to employ a second order fabric tensor.
We follow the definitions from [Kanatani1984]_.
The fabric tensor, it's deviatoric part and a scalar anisotropy factor can be computed by::
N, F, a = ltk.fabricTensor(contactOrientations[:,2:5])
The fabric tensor in this example would then read::
[[ 0.318 0.007 0.006]
[ 0.007 0.319 -0.009]
[ 0.006 -0.009 0.363]]
In order to visualise the fabric, we can use the distribution density function of the deviatoric part of the fabric tensor as described in [Kanatani1984]_::
spam.plotting.orientationPlotter.distributionDensity(F)
This surface is additionally colored by its radius in order to simplify observing preferential orientations.
In our case, the preferential orientation of the tensor is colored with red.
.. figure:: images/tutorial/08-contacts/SpamTut_FabricRW.png
:align: center
:width: 70%
References
===========
.. [Wiebicke2019] Wiebicke, M., Andò, E., Šmilauer, V., Herle, I., & Viggiani, G. (2019). A benchmark strategy for the experimental measurement of contact fabric. *Granular Matter*, 21(3), 54.
https://doi.org/10.1007/s10035-019-0902-x
.. [Wiebicke2017] Wiebicke, M., Andò, E., Herle, I. & Viggiani, G. (2017). On the metrology of interparticle contacts in sand from x-ray tomography images. *Measurement Science and Technology*, 28 124007.
https://doi.org/10.1088/1361-6501/aa8dbf
.. [Woo] Šmilauer, V. (2016). *Woo documentation*.
https://www.woodem.org/index.html
.. [Kanatani1984] Kanatani, K.-I. (1984) Distribution of directional data and fabric tensors. *International Journal of Engineering Science*, 22(2):149 – 164.
https://doi.org/10.1016/0020-7225(84)90090-9
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment