You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this demo I attempt to sample an ensemble of euler angles from a set of second order structure tensors. Work related to the spherical harmonics expansion is based on the work by Rathmann and Lilien 2021-2026.
requirements
the following python packages are required:
numpy, scipy, matplotlib, cartopy
statistics
The second order structure tensor with respect to any orientation distribution function (ODF) $n(\theta,\phi)$ of normal axes $\boldsymbol{n}$ is defined as
To obtain the second order structure tensors of the set of axes (100, 010, 001) from Euler angles, one can convert the euler angles to an active rotation matrix and multiply the axes by the rotation matrix. This gives 3 sets of axes each the length of the number of grains.
spectral expansion of an ODF
The odf on $S^2$ can be expanded in terms of spherical harmonics with the expansion coefficients $n^m_l$,
here $L$ is a maximum truncation. For infinite L one approcahes an exact description, but also has to consider more and more expansion coefficients. The least information is given by the expansion coefficients up to order $L=2$.
One can also derive a relation between the entries of the structure tensor of order $L$ and the expansion coefficients of that order or lower. In this example I will use the odf one can derive from the second order structure tensor such that we will need the expansion coefficients ${n^0_0, n^{-2}_2, n^{-1}_2, n^0_2, n^1_2, n^2_2}$ for each axis to evaluate the odf at any given point. To derive $n^m_l(\boldsymbol{a}^{(2)})$ one can first find $\boldsymbol{a}^{(2)}(n^m_l)$ (see Rathmann 2024 equ. 8) and invert it analyticall.
sampling a uniform distribution
The ZXZ convention for euler angles is used. The uniform distribution of Euler angles representing SO(3) is given by, (e.g. Bunge 1982, p.32)
Splitting it up into 3 separate distributions for each angle and using inverse transform sampling one can sample a homogeneusly distributed set of Euler angles from uniformly distributed random numbers $(u_1,u_2,u_3)$ over $[0,1)$ with,
with $\sigma_\Delta$ being the allowed standart deviation of $\Delta$, which in turn means the allowed standart error of $\boldsymbol{a}^{(2)}{\rm modeled, i}$ with respect to $\boldsymbol{a}^{(2)}{\rm obs, i}$. The standart error on $\boldsymbol{a}^{(2)}{\rm obs}$ is an error on the mean and scales with the number of samples (or in this case grains) as $\sigma{a^{(2)}} = \sigma_{\boldsymbol{n}_i\otimes \boldsymbol{n}i}/\sqrt{N_g}$. The error on each component of the structure tensor is assumed to be the same and can be prescribed with a tolerance value. If the fluctuations in each component of $\Delta$ are on the order of $\Delta \sim \sigma{\Delta}$ the misfit is one the order of one.
All of this is a little handwavy the most important part is that $\sigma_\Delta \propto 1/\sqrt{N_g}$ to get a consistent result from the sampling irrespective of the required size of samples.
The algorith to sample is based on the maximum likelyhood principe such that the likelyhood of an ensemble of euler angles is given by,
$$L = \exp(-S(\phi_1, \theta,\phi_2)) \text{ .}$$
The likelyhood is maximal at one when the misfit is zero. In markov chain monte carlo simulations one usually perturbs the ensemble and then evaluates if the perturbed ditribution is accepted based on the likelihood ratio. The acceptance probability in this case is given by, (This is from a lecture on inverse problems, but I need some sources for this.)
The min is just teher to avoid over flow problems.
When the misfit of the new distribution is smaller than the old one, $p_{acc}=1$ and the change is always accepted, whereas when $S_{old} < S_{new}$ the $p_{acc}$ is smaller than one. A monte carlo algorithm to sample a set of euler angles (EA) then looks as follows:
draw $N_g$ number of EA $(\phi_1, \theta, \phi_2)$ from a homogeneous distribution and assign a misfit $S_{old}$
draw one new trio of EA from a homogeneous distribution on SO(3)
draw a random grain index
replace the EA at that index with the new trio
compute a new misfit $S_{new}$(EA')
compute the acceptance probability from $S_{new}$(EA') and $S_{old}$(EA)
draw a random number p in [0,1)
accept the change if $p<p_{acc}$ else undo changes
repeat from 1. until tolerance reached or $S\sim \mathcal{O}(1)$
This method works quite well, but has problems with strongly peaked fabrics.
accept reject method
Every set of angles has a probability assigned to them according to the 3 ODFs one can reconstruct from the structure tensor of each axis.
algorithm:
pick random set of 3 axes (or one trio of EA)
calculate probabilites for each axis
draw 3 random numbers $p_1, p_2, p_3$
accept the ones where all 3 probabilities are larger than the random number
repeat until number of sampled reached
The tricky part here is that the probability density one gets from the spectral expansion integrates to one, but also yields negative values. I am not yet sure how to deal with that. There seems to be limits to $n(\theta,\phi)\in\frac{1}{4\pi}[-1.5,6]$ such that the random numbers $p_1, p_2, p_3$ were all drawn from the interval $\frac{1}{4\pi}[-1.5,6]$. This still leads to okay results but does not reflect the actual fabric strength.
benchmark
This is still a work in progress but the idea i had by now would be:
evolve the fabric for some time
extract second order structure tensors for each axis
resample from structure tensors
continuiue fabric development
compare "interrupted" cpo evolution vs. not interrupted
About
Sampling an ensemble of Euler angles from the second order structure tensors of 3 orthogonal axes.