Background information is one of the important aspects in the generation of unstructured grids by advancing-front method. Background information is generally obtained through creating background grids. To avoid the waste of time and memories in creating background grids, the article proposes an adaptive function to control the size of grids. It was proved that the method was useful and high effective. Based on the unstructured grids generated with the above function, and in combination with finite volume method, hypersonic nonequilibrium flows with chemical reactions were successfully calculated.