Residual stress development and evolution in two-phase crystalline material: a discrete dislocation study