We can obtain the Cartesian field components from frequency domain power or profile monitors Ex, Ey and Ez, and Hx, Hy, Hz. But if we want to plot the radially-polarized or azimuthally-polarized field distributions (cylindrical coordinates), we need to first convert the data (eg. from Ex, Ey, Ez to E_radial, E_theta).
An example of a case where you may want to plot E_radial and E_theta is the whispering gallery mode profile from a disk resonator on the following page:
This script takes the electric field data from the profile monitor named “418nm_profile”, and uses it to calculate the radial and azimuthal field components, then plots the results:
# collect E field and position data from monitor E_dataset = getresult("418nm_profile","E"); Ex = pinch(E_dataset.Ex); # pinch is used here to remove extra singleton dimensions Ey = pinch(E_dataset.Ey); x = E_dataset.x; y = E_dataset.y; # define a matrix of theta values over x and y positions X = meshgridx(x,y); Y = meshgridy(x,y); theta = atan2(Y,X); # calculate E_radial and E_theta E_radial = Ex*cos(theta) + Ey*sin(theta); E_theta = -Ex*sin(theta) + Ey*cos(theta); # create plots image(x*1e6,y*1e6,E_radial,"x (microns)","y (microns)","E_radial"); image(x*1e6,y*1e6,E_theta,"x (microns)","y (microns)","E_theta");
The original Ex and Ey field profiles:
The field profiles for E_radial and E_theta: