  Series expansions of unknown fields $\Phi=\sum\varphi_n Z_n$ in elongated
waveguides are commonly used in acoustics, optics, geophysics, water waves and
other applications, in the context of coupled-mode theories (CMTs). The
transverse functions $Z_n$ are determined by solving local Sturm-Liouville
problems (reference waveguides). In most cases, the boundary conditions
assigned to $Z_n$ cannot be compatible with the physical boundary conditions of
$\Phi$, leading to slowly convergent series, and rendering CMTs mild-slope
approximations. In the present paper, the heuristic approach introduced in
(Athanassoulis & Belibassakis 1999, J. Fluid Mech. 389, 275-301) is generalized
and justified. It is proved that an appropriately enhanced series expansion
becomes an exact, rapidly-convergent representation of the field $\Phi$, valid
for any smooth, nonplanar boundaries and any smooth enough $\Phi$. This series
expansion can be differentiated termwise everywhere in the domain, including
the boundaries, implementing an exact semi-separation of variables for
non-separable domains. The efficiency of the method is illustrated by solving a
boundary value problem for the Laplace equation, and computing the
corresponding Dirichlet-to-Neumann operator, involved in Hamiltonian equations
for nonlinear water waves. The present method provides accurate results with
only a few modes for quite general domains. Extensions to general waveguides
are also discussed.
