Hi Paige,
I believe this could be because of multiple reasons. It is hard to predict the exact cause without having a look at the file. It could be because of the mesh resolution, the boundary conditions, source injection error etc. Would you be able to share a screenshot of the overall simulation geometry? We have an example on Mie scattering that you might find useful with regard to the setup, please find the link: Mie scattering - FDTD. We always recommend users to perform convergence testing to confirm the accuracy of the simulation.
Another issue that they ran into is when using the getelectric and getmagnetic script commands the results are in terms of "index 1", "index 2", etc., and they are unclear about what units those are referring to.
You are correct, if you obtain the intensity using these commands and then visualize it (using the visualize script command) directly then you would see the indices as the attributes as opposed to the actual spatial data. What I will instead recommend is to try something like this (you can also find this information on the corresponding article for getelectric):
E2=getelectric("x_normal_profile"); #x_normal_profile is the monitor name, the monitor is in the y-z plane
y=getdata("x_normal_profile","y");
z=getdata("x_normal_profile","z");
image(y,z,E2(:,:,:,1)); #Here 1 refers to the first frequency point, can be changed to the desired value to look at the field intensity at different wavelengths
Â
If you are running a multi-frequency simulation, E2 will be of the size (No. of points in x x No. of points in y x No.of points in z x No. of frequency points). So, if you collect the intensity and the y and z values (in my example, monitor is 2D x-normal so there is only one point in x), you should be able to use the image script command to plot the spatial intensity for different frequency points by changing the index of the last dimension, as I have plotted for the first frequency point.
Â
For the getresult, getdata script commands you would find example scripts from the corresponding webpages. I understand that it can be a bit confusing at the beginning, but it becomes much simpler with a little bit of use. Once you get the data using any of the commands, you can look at the number of points in space and number of frequency/wavelength points in the monitor setting. This will give you an idea of which dimension of the intensity/field data corresponds to which parameter. Please feel free to let me know if you have any further questions on this.Â
Â
I can provide more specific information on the first question if you could share a screenshot. Thank you!
Â
Regards,
Amrita
Â
Â