Generation of dislocation arrays at grain boundari