Simulation of primary recrystallization using a modified three-dimensional cellular automaton