Modeling and design of arrayed waveguide gratings