Development and validation of finite difference techniques for linear and non-linear optical devices