In this paper, we present the Gauss’s law-preserving spectral methods and
their efficient solution algorithms for curl-curl source and eigenvalue problems arising
from Maxwell’s equations. Arbitrary order $\boldsymbol{H}(curl)$-conforming spectral basis functions in two and three dimensions are firstly proposed using compact combination of
Legendre polynomials. A mixed formulation involving a Lagrange multiplier is then
adopted to preserve the Gauss’s law in the weak sense. To overcome the bottleneck of
computational efficiency caused by the saddle-point nature of the mixed scheme, we
present highly efficient algorithms based on reordering and decoupling of the linear
system and numerical eigen-decomposition of 1D mass matrix. The proposed solution
algorithms are direct methods requiring only several matrix-matrix or matrix-tensor
products of $N$-by-$N$ matrices, where $N$ is the highest polynomial order in each direction. Compared with other direct methods, the computational complexities are reduced from $\mathcal{O}(N^6)$ and $\mathcal{O}(N^9)$ to $\mathcal{O}(N^{log_2 7})$ and $O(N^{1+log^2 7})$ with small and constant
pre-factors for 2D and 3D cases, respectively. Moreover, these algorithms strictly obey
the Helmholtz-Hodge decomposition, thus totally eliminate the spurious eigen-modes
of non-physical zero eigenvalues for convex domains. Ample numerical examples for
solving Maxwell’s source and eigenvalue problems are presented to demonstrate the
accuracy and efficiency of the proposed methods.