Mathematical modeling of diffusion during multiphase layer growth