The primary source of ionization in the D region is provided by photoionization of nitric oxide by Lyman alpha radiation. The observation of enhanced electron densities in winter at middle and high latitudes therefore has often been attributed to enhanced nitric oxide densities in this region. This phenomenon is often called winter anomaly or winter anomalous absorption. The problem has been studied by combining an ion chemical model with a two-dimensional time-dependent model of the neutral atmosphere. The model extends from the ground to the base of the lower thermosphere and includes nitric oxide transport from the thermosphere as well as auroral production. The calculated nitric oxide distribution exhibits substantial seasonal and latitudinal variations, which strongly influence the ion chemical composition and simulate the winter anomaly very well. Other aspects of coupling between neutral and ion chemistry are also explored.