Getelectric and visualizer electric field

fdtd

#1

Two simulations have same plot(|E|^2 vs wavelength).
(I use command ‘getelectric’ and ‘integrate2’.)
And visualizers of E have also similar.

first,
According to the visualizer, summation of |E|^2 is different in the same size.
So, total summation of |E|^2will be different.
But, I calculate total |E|^2 using codes ‘getelectric’ and ‘ integrate2’.
Of course I know that they have to be same and result is same.
I just wonder that how they calculate and show the image of |E|^2.

second,
There are lots of different value between the value in visualizer and the value in calculation.
Why do they have a difference? What is the unit?


#2

Dear @jaesunglee

It is good that the results of the coarse and fine meshes agree. This means that value of |E|^2 is consistent between the two simulations. If they didn’t match, you would need to perform convergence testing.

integrate2 numerically sums up all the values of |E|^2 over the area of interest. In your calculation, you need to multiply |E|^2 by the area, which is 4 times the finer mesh for properly summing up the values. To be more clear, lets say that the size of each square in small mesh is 1nm^2 (which will be 4 nm^2 for big square)

Large mesh: 0.6 *4 = 2.4
small mesh: 0.6*1 + 0.6*1 + 0.6*1 + 0.6*1 =2.4 

For more information regarding integration please take a look at this page:

For image plot, we calculate the |E|^2 at every mesh cell (see meshgrid command for example) and then assign the value.

Can you please elaborate more on this? What results are different? Maybe you can share your data and simulation file with us for comparison.

Thanks