The formation of the D region of the ionosphere