Simulating photonic devices with noisy optical elements