Coupled-mode formalism and linear theory of diffraction for a simplified analysis of second harmonic generation at grating couplers