 ## Photonics

• Guanhui Wang
Ansys Employee

The spatial data available from a DEVICE simulation such as charge, electric field, or temperature profile are all saved on a finite element grid. These data can be easily visualized from the visualizer but not easy to manipulate, i.e., adding/subtracting different data or getting partial data on a plane or along a line. It is therefore often desirable to interpolate these finite element data onto a rectilinear grid for post processing. The interpolated data can also be exported to other software such as Matlab for further processing.

The two script commands that can be used to perform this interpolation is interptri 59 (2D) and interptet 21 (3D). The KB page for interptri 59 has a detailed example on how to interpolate 2D finite element data onto a rectilinear grid. Similar approach can be used to interpolate 3D finite element data using the interptet command.

The following is an example of a combination of script commands that can be used to interpolate 3D charge data onto a rectilinear grid and then plot the data along a line.

[code]# get charge data

charge = getresult(‘CHARGE’,‘charge’);

n = pinch(charge.n);

p = pinch(charge.p);

get information about the finite elemetn data

x = charge.x; # x coordinates

y = charge.y; # y coordinates

z = charge.z; # z coordinates

vtx = [x,y,z];

elements = charge.elements; # connectivity matrix

kern = size(n);

Ne = kern(1); # Number of elements

Nv = kern(2); # Number of bias points

Define rectilinear grid

delta = 1e-9;

x_rect = linspace(min(x),max(x),5);

y_rect = linspace(min(y),max(y),5);

z_rect = linspace(min(z),max(z),101);

pick one bias point (last one)

n = n(1:Ne,Nv);

p = p(1:Ne,Nv);

Interpolate

n_rect = interptet(elements,vtx,n,x_rect,y_rect,z_rect); # interpolating n

p_rect = interptet(elements,vtx,p,x_rect,y_rect,z_rect); # interpolating p

plot n and p along Z

plot(z_rect(11:91)*1e6,n_rect(3,3,11:91),p_rect(3,3,11:91),‘z (um)’,‘carrier density (/cm^3)’,’’,‘log10y’);

legend(‘n’,‘p’);[/code]

The script generates the following plot: 