  Understanding the spontaneous emergence of dislocation patterns during
plastic deformation is a long standing challenge in dislocation theory. During
the past decades several phenomenological continuum models of dislocation
patterning were proposed, but few of them (if any) are derived from microscopic
considerations through systematic and controlled averaging procedures. In this
paper we present a 2D continuum theory that is obtained by systematic averaging
of the equations of motion of discrete dislocations. It is shown that in the
evolution equations of the dislocation densities diffusion like terms neglected
in earlier considerations play a crucial role in the length scale selection of
the dislocation density fluctuations. It is also shown that the formulated
continuum theory can be derived from an averaged energy functional using the
framework of phase field theories. However, in order to account for the flow
stress one has in that case to introduce a nontrivial dislocation mobility
function, which proves to be crucial for the instability leading to patterning.
