1: \begin{abstract}
2: The Navier-Stokes equations in a finite cylinder are written in terms of poloidal and toroidal
3: potentials in order to impose incompressibility.
4: Regularity of the solutions is ensured in several ways:
5: First, the potentials are represented using a spectral basis
6: which is analytic at the cylindrical axis.
7: Second, the non-physical
8: discontinuous boundary conditions at the cylindrical corners are smoothed
9: using a polynomial approximation to a steep exponential profile.
10: Third, the nonlinear term is evaluated in such a way as to eliminate singularities.
11: The resulting pseudo-spectral code is tested using exact polynomial solutions and the spectral convergence
12: of the coefficients is demonstrated.
13: Our solutions are shown to agree with exact polynomial solutions and with previous axisymmetric calculations of vortex breakdown and of nonaxisymmetric calculations of onset of helical spirals.
14: Parallelization by azimuthal wavenumber is shown to be highly effective.
15: \end{abstract}
16: