Plotting Near-field absorption image

solarcell
fdtd
plasmonics

#1

I am attempting to generate the near-field absorption image (E^2) of a plasmonic nanosphere placed over a Si wafer. Here is the fsp: solar_plasmonic_normal.fsp (237.9 KB)

I wrote the following code to serve my purpose:

f = getdata(“E”,“f”);
E2 = getelectric(“E”);
x = getdata(“E”,“x”);
z = getdata(“E”,“z”);
w = 621e-9;
d = c/w;
image(x1e9,z1e9,pinch(E2,4,d),“x (nm)”,“y (nm)”,"|E|^2 at " + num2str(c/f(d)*1e9 + " nm");

However, when I execute the code, the solver shows a syntax error at line 1 (f = getdata(“E”,“f”);). I just can’t seem to find what the error is.

Help!


#2

if you change your monitor name will correct.
for example:E-monitor


#3

The “syntax error” is actually coming from line 7 and not from line 1. In line 7, the first thing that is missing is an end bracket after num2str(c/f(d)*1e9. Also, the variable “d” should be the index of the frequency you are plotting for, not the value of the frequency. The value of “d” should be an integer between 1 and 101. if you fix these two things, the script works. The final format of line 7 will be,

image(x1e9,z1e9,pinch(E2,4,51),“x (nm)”,“y (nm)”,"|E|^2 at " + num2str(c/f(51)*1e9) + " nm");

Where I have replaced “d” with 51 to plot at the center frequency.


#4

I also wanted to share a few comments on your simulation setup.

  1. Since you are using PML boundaries, you cannot use a plane wave source. You will need to use a TFSF source instead. See: Plane waves - Edge effects.

  2. You can use the symmetry of the structure to simulate 1/4th of the total volume. See: Symmetric and anti-symmetric BCs.

  3. If your structure contains a single particle then using PML boundary is appropriate. However, if you have an array of nanoparticles then you will need to use periodic boundaries.

  4. You can use the “power absorbed” analysis groups to easily calculate absorbed power in the near field. See: Absorption per unit volume.

  5. Your filename (and frequency range of source) indicates that you are planning to simulate solar absorption. If that is the case then the most appropriate analysis group to use would be the solar generation analysis group. See: .Solar generation analysis group.


#5

It still shows syntax error at line 1:


#6

Hi. The name of your script file is the same as the variable E2 used in the script. This is causing the problem. Just change the name of the script to something else and it will work. Also, make sure that you delete the E2.lsf script file from the folder otherwise you will still have this issue.

The script environment of Lumerical’s solvers allow users to call scripts as sub-functions. So when you save the script file as E2.lsf and then use the same name for a variable; as the solver sees E2 on line 2, it tries to call the E2.lsf file and this causes the syntax error because then the rest of line 2 makes no sense.


#7

A post was split to a new topic: Calculating near field distribution of a FESEM image of nanoparticles in FDTD