A model for the numerical computation of microsegregation in alloys