Waveguide simulation of photonic devices