The permittivity rotation object allows you to specify the orientation of an anisotropic material in terms of the Euler angles. This type of grid attribute can be used for anisotropic materials that have a diagonal permittivity tensor in some principle coordinate frame X,Y,Z. but have some other orientation in the simulation. The Euler angles are used to define the orientation of the material in the simulation.

$$\tilde\varepsilon_D(X,Y,Z)=\begin{bmatrix} \varepsilon_{XX} &0& 0 \\ 0& \varepsilon_{YY}& 0 \\ 0 & 0 & \varepsilon_{ZZ}\end{bmatrix}$$

The default Euler rotation used by the permittivity rotation attribute is Z-Y'-Z''. With this convention, the first angle (Phi) specifies a rotation around the Z axis (Z). The second angle (Theta) specifies a rotation around the new Y axis (ie. after the first rotation has been applied). The third angle (Psi) specifies the final rotation around the new Z axis (i.e. after the first two rotations have been applied). The rotation attribute is drawn as 3 colored arrows, where the colors correspond to the principle coordinate frame Blue=X, Green=Y, Red=Z. The orientation of the arrows as drawn in the CAD viewports can be used to confirm you have correctly entered the Euler angles.

## Properties tab

- NAME: Object name
- ENABLED: Determines if the object will be included in the simulation
- USE RELATIVE COORDINATES: If this is enabled then the source will use the center or the CHARGE solver as its origin (reference). If disabled then it will use the absolute center (0,0,0) as its origin.
- RESAMPLE FOR VIEWING: If this is enabled, NX, NY, NZ are used to resample the drawing of object in the layout editor. NX, NY, NZ are the maximum allowed resolution shown in the CAD view. These numbers are for graphical rendering and should have no effect to the simulation results. These options are only available when spatially-varying data is imported
- X, Y, Z: The center position of the object
- X SPAN, Y SPAN, Z SPAN: The size of the object. This is greyed out and not editable in the GUI. The numbers are updated when data with spatial distribution are imported.
- RESCALE AXES INDEPENDENTLY: If this is enabled, then X SCALE, Y SCALE, Z SCALE can be set differently to rescale the object. If disabled, then X SCALE, Y SCALE, Z SCALE can only be set equally. These options are only available when spatially-varying data is imported
- ENABLE CONFORMAL MESHING: See grid attribute tips for details.
- ANGLE CONVENTION: Euler rotation definition.
- PHI, THETA, PSI: Rotation angles.
- IMPORT DATA: Import the permittivity rotation matrix saved in a .mat file
- CLEAR DATA: Clear the imported data

## Uniform Rotation

If we want to simulate an anisotropic material whose diagonal tensor is given by

$$\tilde\varepsilon_D(X,Y,Z)=\begin{bmatrix} (1.5+0.2j)^2&0& 0 \\ 0&(1.4+0.1j)^2& 0 \\ 0 & 0 & 1.2^2\end{bmatrix}$$

and it's orientation in the simulation is given by the Euler angles \(\phi=10^\circ, \theta=20^\circ, \psi=30^\circ\) we first add permittivity rotation grid attribute to layout editor and open the edit window and set the Euler angles as shown above. After setting the angles, go to the material database and create a new material. Finally, in the Materials tab of the structure object, set the material and grid attribute properties as shown below.

## Spatially-varying permittivity rotation

Spatially-varying theta, phi, and psi rotation angles can be specified over a rectangular grid. The following code shows an example which generates the spatially-varying data and adds the data to a dataset.

# Specify x, y, z positions (in this case a over a 1D line in the z-direction)

x = 0;

y = 0;

z = linspace(0e-6,1e-6,100);

# Specify rotations

phi = linspace(0,pi/2,length(z));

theta = 0*phi;

psi = 0*theta;

# Generate dataset

PR=rectilineardataset("PR",x,y,z);

PR.addattribute("phi",phi);

PR.addattribute("theta",theta);

PR.addattribute("psi",psi);

Note : Rotation angle units Although in the graphical user interface, angles are specified in units of degrees, when specifying angles in the script, the rotation angle units are in radians. |

To add the grid attribute and import the data from the PR dataset defined above, the following code can be used:

# add grid attribute and import data from PR dataset

addgridattribute("permittivity rotation",PR);

or

addgridattribute("permittivity rotation"); # add grid attribute

importdataset(PR); # import data from PR dataset

This example generates a grid attribute where the rotation around the z-axis changes from 0 to 90 degrees along the z-direction between z=0 to z=1 um, as illustrated below:

It is also possible to first save the dataset to a .mat file which can be imported from the grid attribute's edit window with the "Import data..." button, or from the script using the importdataset script command":

matlabsave("rotation_data.mat",PR); # save the PR dataset to a .mat file

addgridattribute("permittivity rotation"); # add grid attribute

importdataset("rotation_data.mat"); # import data from .mat file

Once the grid attribute has been set up with spatially-varying rotation data, a new anisotropic material with diagonal anisotropy can be added and the grid attribute can be applied to the object, like illustrated in the uniform rotation section above.