Rotate mobility tensors

Anisotropic mobility tensors can be rotated to arbitrary directions buy multiplying it with a rotation matrix $R$. $$ M_{rot} = R \cdot M \cdot R^T $$


In [1]:
import numpy as np
from math import sin, cos, pi

In this example we construct a rotation matrix that rotates counter-clockwise around the z-axis by $45^o$.


In [2]:
a = 45.0*pi/180.0

In [3]:
Rz = [[cos(a),-sin(a),0],
      [sin(a),cos(a),0],
      [0,0,0]]

M = [[1, 0 ,0],
     [0,.01,0],
     [0, 0 ,0]]

Compute the rotated tensor $(R_z\cdot M)\cdot R_z^T$


In [4]:
Mrot = np.dot(np.dot(Rz,M),np.transpose(Rz))

The rotated tensor is then used as the tensor argument in the ConstantAnisotropicMobility material.


In [5]:
for l in [' '.join(map(str,a)) for a in Mrot]:
    print l


0.505 0.495 0.0
0.495 0.505 0.0
0.0 0.0 0.0