

comparison of single aperture from analytical equation and from FDTD

- it is important to use side boundaries
- bigger is better
- finer mesh is better
- bigger mesh in z does not affect anything when cpml is used, on the other hand the effect is massive with Liao BC.
- bigger nfff domain has tiny effect at side lobes shape


- why p4 and higher indices leads to lower results?
lower dt might help, but renormalisation is needed. so is it effect of the integration? We don't know yet, however
it certainly helps.

transition from single aperture to grating calculation is shown in methods_explanation.png, methods_explanation_detail.png

A summary:

To calculate single aperture it is important to add the side boundaries. It is also crucial to use CPML throughout all the
calculations, otherwise we get everything dependent on the computational volume.
If we manually setup the few apertures grating, result corresponds to the theory.
However, using periodic boundary conditions and virtual repetitions are valid only if we sum many virtual repetitions for far field calculation. 
Using this approach for only few apertures (e.g. 3) leads to wrong result (even if it looks fine at the diffraction order angle, by chance?).
On the other hand, summing virtual repetitions without periodic BCs does not lead to anything reasonable, we have to have them, to get the
correct fields.
When higher orders are evaluated, the values of the central maximum can drop and using a smaller time step helps to correct this effect. 
This might be related to the far field integration (linear interpolation works better when signal is not changing so rapidly), 
however it is still unclear if this is the only effect.


../gsvit2d aperture.par ; ../postprocess2dnfff xnff.txt -c -90 -d 90 -e 721 -z 9000 -Z 10000 -s 3 -t 1 -p 4 ; cp output.txt output_p4.txt

../gsvit2d 3aperture.par ; ../postprocess2dnfff xnff.txt -c -90 -d 90 -e 361 -z 8000 -Z 9000 -r 0 -R 160  -s 3 -t 1 -p 0 ; cp output.txt output_3s.txt



plot "xb_1" u 3:2 w l t "single aperture, analytical", "xb_3" u 3:2 w l t "3 apertures, analytical",  "xb_9" u 3:2 w l t "9 apertures, analytical", "output_p1.txt" u ($1/2-90):($2/42.58/9) w l t "3 apertures, periodic", "output_p4b.txt" u ($1/4-90):($2/21.55/91) w l t "9 apertures, periodic", "output_3s.txt" u ($1/2-90):($2/360) w l t "3 apertures, manual"


