Three-dimensional simulation of nanocrystal flash memories