fdtd with plane wave source matlab
I have not run or looked at the attached MATLAB code, but I may be able to answer some of the questions posed in this discussion. I apologize if any of my answers don't apply to the attached code.
1. No reflections in 1D FDTD?
For the special case of 1D FDTD there exists an exact boundary condition from which you should not get any reflections. This is possible because energy can only be traveling in one direction and all frequencies will have the same velocity. Roughly speaking, this boundary simply works by storing the outermost field values for two time steps and using them as the boundary field field values at the current time step.
2. Oblique incidence in FDTD?
This is a tricky question. If you are using periodic boundary conditions and wish to use an impulse source at oblique incidence, there is no good way to do this. There is a technique called the "angled update method" but this is limited in the angles it can implement. Otherwise you are stuck with just normal incidence. If you can make your problem space cover more than one period in its cross section, there will be other discrete angles available to you. You can calculate what angles using the grating equation.
If you do not have periodic boundaries (PML for example) or you are using a sinusoidal source, you can easily incorporate oblique incidence. I would suggest using the total-field/scattered-field technique for this, but other approaches exist such as the scattered-field only method. Using TF/SF, you would set all your PML regions to be the scattered-field. You may also include a few more grid cells in the scattered-field if you want to more easily calculate the reflected energy from whatever you are modeling.
Alternative Methods
================
You may also wan to consider the finite-difference frequency-domain (FDFD) method. This is excellent for 2D problems or modeling devices that are highly resonant where FDTD is less efficient. It is the easiest method I know of to implement. I teach a short course on the method and have made my course notes and example codes available for free from
www.kraetonics.com. It is all MATLAB code and it can model TE and TM modes at any angle of incidence you wish.
The example codes model a polarizer, a photonic crystal, and a guided-mode resonance filter. The idea was to setup simple examples so that you could easily modify them to model whatever you wish.
Hope this helps!
-Tip