Design of Optical Devices through the Finite Element Method