  In this paper we present a methodology for increasing the accuracy and
accelerating the convergence of numerical methods for solution of Maxwell's
equations in the frequency domain by taking into account the be-havior of the
electromagnetic field near the geometric edges of wedge-shaped structures.
Several algorithms for incorporating treatment of singularities into methods
for solving Maxwell's equations in two-dimensional structures by the examples
of the analytical modal method and the spectral element method are discussed.
In test calculations, for which we use diffraction gratings, the significant
accuracy improvement and convergence ac-celeration were demonstrated. In the
considered cases of spectral methods an enhancement of convergence from
algebraic to exponential or close to exponential is observed. Diffraction
efficiencies of the gratings, for which the conventional methods fail to
converge due to the special values of permittivities, were calculated.
