Modeling of Compositional Grading in Nonisothermal Reservoirs