-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathparfile_organizer_wind.py
More file actions
134 lines (94 loc) · 3.72 KB
/
parfile_organizer_wind.py
File metadata and controls
134 lines (94 loc) · 3.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#!/usr/bin/env python
import os
from sys import argv
from string import Template
script,basename,EE,mixing,Ni_mass = argv
M_ZAMS = ["9.0","9.5","10.0","10.5","11.0","11.5","12.0","12.5","13.0","13.5","14.0","14.5","15.0","15.5","16.0","16.5","17.0","17.5","18.0","18.5","19.0","19.5","20.0","20.5","21.0","21.5","22.0","22.5","23.0","23.5","24.0","24.5","25.0"]
#neutron star exisision mass - uses M_ZAMS to index into it
M_ex = [1.4,1.4,1.423,1.483,1.404,1.551,1.478,1.568,1.614,1.615,1.652,1.688,1.886,1.916,1.504,1.518,1.530,1.911,1.905,1.810,1.646,1.773,1.804,1.536,1.480,1.569,1.817,2.061,2.121,2.134,2.093,2.019,1.930]
#M_ex = [1.4,1.4,1.423,1.483,1.404,1.551,1.478,1.568,1.614,1.615,1.652,1.688,1.886,1.916,1.504,1.518,1.530,1.911,1.905,1.810,1.646,1.773,1.804,1.536,1.480,1.569,2.3,2.4,2.4,2.4,2.4,2.4,2.4]
PARFILE = Template("""\
#____________LAUNCH_____________
outdir = "Data"
#___________PROFILE_____________
profile_name = $profile_short
comp_profile_name = $profile_iso_dat
#__________EXPLOSION_____________
initial_data = "Thermal_Bomb"
#Options:
#"Piston_Explosion"
#"Thermal_Bomb"
piston_vel = 5.0d9
piston_tstart = 0.0d0
piston_tend = 1.0d-2
final_energy = $fin_energy
bomb_tstart = 0.0d0
bomb_tend = $bomb_time
bomb_mass_spread = $bomb_mass_size #(in solar mass)
bomb_start_point = 1
#_____________GRID_______________
imax = $resolution
gridding = "from_file_by_mass"
#Options:
#"uniform_by_mass"
#"from_file_by_mass"
mass_excision = 1
mass_excised = $excised_mass #in solar mass, provided mass_excision = 1
#___________EVOLUTION_____________
radiation = 1
eoskey = $eos
#Options:
#1 - ideal eos
#2 - Paczynski
#helm_table_name = "src/helmholtz_eos/helm_table.dat"
Ni_switch = $Ni_switch_par
Ni_mass = $Ni_total_mass #(in solar mass)
Ni_boundary_mass = $Ni_mixing #(in solar mass, here carefull with the excised mass)
#(attention - smoothing is going to change it, if applied)
Ni_period = 1.0d4
saha_ncomps = 3
boxcar_smoothing = $boxcar
opacity_floor_envelope = 0.01d0
opacity_floor_core = 0.24d0
#___________TIMING_______________
ntmax = 10000000000000
tend = $endtime
dtout = 1.7d5
dtout_scalar = 1.7d4
dtout_check = 1.7d5
ntout = -1
ntout_scalar = -1
ntout_check = -1
ntinfo = 1000
dtmin = 1.0d-10
dtmax = 3.0d2
#____________TEST_________________
sedov = 0
""")
#ntmax = max number of steps
#tend = end time
#nout-- not used
#ntout - frequency of output being recorded in the xg files
#ntout_scaler - frequency of output being recorded in dat files
#ntout_check - not used
#ntinfo = how often output to screen
#dtmin, dtmax - min and max timestep - the code determines this as it needs, so shouldn't matter much
shortfile = [f for f in os.listdir(basename + "/profiles") if (f.startswith("s") and f.endswith(".short"))][0]
isofile = [f for f in os.listdir(basename + "/profiles") if (f.startswith("s") and f.endswith(".iso.dat"))][0]
best_M_ZAMS = float(shortfile.partition('s')[-1].rpartition('_')[0])
open(basename + "/parameters", "w").write(
PARFILE.substitute(
profile_short = "\""+"profiles/"+shortfile+"\"",
profile_iso_dat = "\""+"profiles/"+isofile+"\"",
fin_energy = str(EE)+'d51',
bomb_time = '1.0d0',
bomb_mass_size = '0.02d0',
resolution = '1000',
excised_mass = str(M_ex[M_ZAMS==best_M_ZAMS]),
Ni_switch_par = '1',
Ni_total_mass = str(Ni_mass),
Ni_mixing = str(mixing),
boxcar = '1',
eos = '2',
endtime = '2.592d7')
)