In [ ]:
#location of data
#path='/apod2/NuGrid'
path='/tmp/orcinusB/NuGrid/'
import time as t_module
In [ ]:
from NuGridPy import mesa as ms
ms.__file__
In [ ]:
ms.set_nugrid_path(path)
In [ ]:
metallicities = [0.02,0.01,0.006,0.001,0.0001]
masses = [1.,1.65,2.,3.,4.,5.,6.,7.,12.,15.,20.,25.]
In [ ]:
t1 = t_module.time()
error_cases_def=[]
error_cases_last=[]
for k in range(len(metallicities)):
print 'start testing metallicity ',metallicities[k]
for h in range(len(masses)):
print '### Test star Z=',metallicities[k],' M=',masses[h]
s=ms.history_data(mass=masses[h],Z=metallicities[k])
#get last model available in profiles file
f1=open(s.sldir+'/profiles.index')
line=f1.readlines()[-1]
f1.close()
lastmodel= int(line.split()[0])
print 'try default profile model ',lastmodel
try:
ms.mesa_profile(mass=masses[h],Z=metallicities[k])
except:
error_cases_def.append([metallicities[k],masses[h]])
pass
try:
ms.mesa_profile(mass=masses[h],Z=metallicities[k],num=lastmodel)
except:
print "Error in model: "+str(lastmodel)
error_cases_last.append([metallicities[k],masses[h]])
pass
t2= t_module.time()
print 'Total time: ',str(round(t2-t1,2)),'s'
In [ ]:
# if these arrays are empty than no errors in profile data:
error_cases_last
In [ ]:
error_cases_def
In [ ]:
from NuGridPy import nugridse as mp
#reload(mp)
In [ ]:
mp.set_nugrid_path(path)
In [ ]:
t1 = t_module.time()
for k in range(len(metallicities)):
print 'start testing metallicity ',metallicities[k]
for h in range(len(masses)):
print '### Test star Z=',metallicities[k],' M=',masses[h]
print 'test ppd_wind OUT'
sefiles=mp.se(mass=masses[h],Z=metallicities[k],code_source='MES',type='ppd_wind',output='out',verbose=True)
print 'test ppd_wind SURF'
sefiles=mp.se(mass=masses[h],Z=metallicities[k],code_source='MES',type='ppd_wind',output='surf',verbose=True)
print 'test ppd_wind RESTART'
sefiles=mp.se(mass=masses[h],Z=metallicities[k],code_source='MES',type='ppd_wind',output='restart',verbose=True)
if masses[h]>8.: #massive stars only
print 'test ppd_exp delay OUT'
sefiles=mp.se(mass=masses[h],Z=metallicities[k],code_source='MES',type='ppd_exp',output='out',exp_type='delay',verbose=True)
print 'test ppd_exp delay SURF'
sefiles=mp.se(mass=masses[h],Z=metallicities[k],code_source='MES',type='ppd_exp',output='surf',exp_type='delay',verbose=True)
print 'test ppd_exp delay RESTART'
sefiles=mp.se(mass=masses[h],Z=metallicities[k],code_source='MES',type='ppd_exp',output='restart',exp_type='delay',verbose=True)
if not (metallicities[k] == 0.02 and masses[h] == 25.): #25Msun rapid Z=0.02 BH
print 'test ppd_exp rapid OUT'
sefiles=mp.se(mass=masses[h],Z=metallicities[k],code_source='MES',type='ppd_exp',output='out',exp_type='rapid',verbose=True)
print 'test ppd_exp rapid SURF'
sefiles=mp.se(mass=masses[h],Z=metallicities[k],code_source='MES',type='ppd_exp',output='surf',exp_type='rapid',verbose=True)
print 'test ppd_exp rapid RESTART'
sefiles=mp.se(mass=masses[h],Z=metallicities[k],code_source='MES',type='ppd_exp',output='restart',exp_type='rapid',verbose=True)
t2= t_module.time()
print 'Total time: ',str(round(t2-t1,2)),'s'