Numerical calculation of wave refraction