Residual stress in composite materials