  Ambipolar diffusion is a process occurring in partially ionised astrophysical
systems that imparts a complicated mathematical and physical nature to Ohm's
law. The numerical codes that solve the magnetohydrodynamic (MHD) equations
have to be able to deal with the singularities that are naturally created in
the system by the ambipolar diffusion term. The global aim is to calculate a
set of theoretical self-similar solutions to the nonlinear diffusion equation
with cylindrical symmetry that can be used as tests for MHD codes which include
the ambipolar diffusion term. First, following the general methods developed in
the applied mathematics literature, we obtained the theoretical solutions as
eigenfunctions of a nonlinear ordinary differential equation. Phase-plane
techniques were used to integrate through the singularities at the locations of
the nulls, which correspond to infinitely sharp current sheets. In the second
half of the paper, we consider the use of these solutions as tests for MHD
codes. To that end, we used the Bifrost code, thereby testing the capabilities
of these solutions as tests as well as (inversely) the accuracy of Bifrost's
recently developed ambipolar diffusion module. The obtained solutions are shown
to constitute a demanding, but nonetheless viable, test for MHD codes that
incorporate ambipolar diffusion. The Bifrost code is able to reproduce the
theoretical solutions with sufficient accuracy up to very advanced diffusive
times. Using the code, we also explored the asymptotic properties of our
theoretical solutions in time when initially perturbed with either small or
finite perturbations. The functions obtained in this paper are relevant as
physical solutions and also as tests for general MHD codes. They provide a more
stringent and general test than the simple
Zeldovich-Kompaneets-Barenblatt-Pattle solution.
