Periodic boundary conditions in FDTD and MODE