Save phi in file