# Grid Attribute Tips

In this page, we will provide some tips for simulations using LC rotation, permittivity rotation, and matrix transform grid attribute objects. These tips don't apply to the np Density and Temperature grid attributes.

## Grid attribute introduction

The constitutive relation between the electric field E and the electric displacement D for an anisotropic material in a reference coordinate system (x,y,z) can be written as

$$D(x,y,z)=\varepsilon_0\varepsilon(x,y,z)E(x,y,z)$$

where \(\tilde\varepsilon\) is the permittivity tensor and is given by

$$\tilde\varepsilon(x,y,z)=\begin{bmatrix} \varepsilon_{xx}&\varepsilon_{xy}&\varepsilon_{xz} \\ \varepsilon_{yx}&\varepsilon_{yy}&\varepsilon_{yz} \\ \varepsilon_{zx}&\varepsilon_{zy}& \varepsilon_{zz}\end{bmatrix}$$

Using a unitary matrix transformation U, the the permittivity tensor \(\tilde\varepsilon\) can be diagonalized as below.

$$\tilde\varepsilon_D =U^\ast(\theta,\phi)\tilde\varepsilon U(\theta,\phi)\tilde\varepsilon_D= \begin{bmatrix} \varepsilon_0 &0& 0 \\ 0& \varepsilon_0 & 0 \\ 0 & 0 & \varepsilon_0 \end{bmatrix}=\begin{bmatrix} n_0^2 &0& 0 \\ 0& n_0^2 & 0 \\ 0 & 0 & n_e^2\end{bmatrix}$$

In FDTD, instead of using the elements of \(\tilde\varepsilon\) we use the diagonal elements of \(\tilde\varepsilon_D\) and the transformation matrix U as input parameters.

The basic steps to set up anisotropy in FDTD which performs a simulation in a reference coordinate system (x,y,z) are as follows.

- Set the transformation matrix U using an appropriate grid attribute object,
- In the material database, create a new material using the diagonalized permittivty elements and
- On the Material tab of a structure object which we want to set up an anisotropic material
- Select the grid attribute defined in 1)
- Select the material defined in 2).

In FDTD, three types of grid attribute named LC rotation, Permittivity rotation and Matrix transformation are provided to define the matrix U. In the following pages, we will explain how to use these grid attributes.

Note: Comparing Matrix transformation, Permittivity rotation, and Liquid crystal grid attributes Matrix transformation: the most general form of permittivity transformation. In principle, the matrix transformation object could be used in place of the Permittivity rotation or Liquid crystal grid attributes. Permittivity rotation: A simpler form of the transformation, appropriate for situations when the transformation matrix corresponds to a simple spatial rotation. In such cases, this object allows you to specify the transformation via the rotation angles theta, phi, psi. Liquid Crystal: An even simpler transformation, appropriate for liquid crystals that can be defined in terms of an ordinary and extraordinary permittivity, and having a uniaxial symmetry around the long axis of the crystal. Due to this symmetry, the transformation can be specified by only two angles theta, phi. |

Note: Grid attributes and nonlinear materials Grid attributes can be used with nonlinear materials. |

## Diagonalization conventions

Please note that convention used above for matrix diagonalization may be different from the convention used elsewhere, where the equation is in the form \(\varepsilon_D=U^\dagger\varepsilon U\).

## Rotating structures

When you rotate a geometric primitive, the permittivity tensor is not rotated. In order to do this, you must define a rotation grid attribute that has the same rotation as the object and associate the object with that grid attribute.

## Liquid crystal grid attribute transformation can be disabled by setting orientation unit vector to 0

As shown in the script in the LC rotation page, it is possible to specify a spatially varying liquid crystal orientation with the Liquid crystal grid attribute using a spatially varying matrix of orientation unit vectors. The magnitude of the orientation vector should be exactly 1 at each position, or the simulation can become unstable.

Alternatively, the magnitude of the orientation vector can be set to 0. In such cases, the grid attribute transformation is disabled at that location, and the simulation will use the unrotated diagonal permittivity values. For example, if we set |u(x,y,z)|=1 inside the spherical region and set |u(x,y,z)|=0 outside the region as show below, a spherical LC region can be set up.

## The positions of spatially varying liquid crystals are defined by a local coordinate system

The positions x, y and z in LC rotation grid attribute is a position of the purple cross of the object (see figure below). The liquid crystals positions defined as parameters in addgridattribute command is given by the local coordinate system whose origin is set to the x, y and z values.

## Index monitor currently record only diagonal index

Index monitors to not record any information about the permittivity transformations. Therefore, it is important to do some careful testing to ensure the setup is correct.

## Conformal meshing for structures associated with grid attributes

Grid attributes have a setting called "enable conformal meshing" which is set to "true" by default.

Conformal meshing can be disabled by setting the "enable conformal meshing" value to "false". This could be considered in cases where there is a high refractive index contrast between the structure with grid attribute applied and neighboring materials (such as when simulating plasmonic effects), where the behavior of the fields near the material interface is important. This is because if conformal meshing is applied, the spatial offset of field components within the Yee cell will not be considered by the grid attribute transform, causing there to be some error as discussed in the "Spatial offset of field components within FDTD Yee cell approximation" section below.

## The diagonal permittivity tensor can be dispersive

The diagonal permittivity tensor can be dispersive, but the transformation U is not dispersive.

## Spatial offset of field components within FDTD Yee cell approximation

In all FDTD simulations, each field component is calculated at a slightly different position within the Yee cell. At cells which contain material interfaces, grid attribute transformations are applied only to field components where there will be no mixing of field components in different materials.

This can introduce some additional error into the simulation, compared to a similar simulation without a grid attribute object. In some cases, this approximation can introduce asymmetries into otherwise symmetric systems. Reducing the mesh step size can help reduce these errors, but in some cases at interfaces between materials with high index contrast, it is challenging to make the mesh size sufficiently small.

## Interpolating spatially varying grid attributes

Linear interpolation is used to interpolate grid attribute data at each mesh point.

Singleton dimensions are extruded uniformly as shown below.

If the dimensions of a structure object are larger than the grid attribute data, the attribute will not be applied to the portion of the structure that is outside of the attribute data.

## Simulation speed

It is worth noting that using Grid attributes will increase the simulation memory and time requirements. Therefore, when they are not needed, it's best to ensure they are not used. For example, rather than setting the rotation angle to zero (the grid attribute will still be included in the simulation), it's best to disable the grid attribute entirely.