examplecase_class.py
Go to the documentation of this file.
1 import os
2 import shutil
3 import sys
4 import numpy as np
5 
6 class bcolors:
7  """
8  Class to deal with colors in the terminal
9  """
10  HEADER = '\033[95m'
11  OKBLUE = '\033[94m'
12  OKCYAN = '\033[96m'
13  OKGREEN = '\033[92m'
14  WARNING = '\033[93m'
15  FAIL = '\033[91m'
16  ENDC = '\033[0m'
17  BOLD = '\033[1m'
18  UNDERLINE = '\033[4m'
19 
20 
21 
22 class examplecase(object):
23  def __init__(self):
24  """
25  Initialize the examplecase class. This class prepares example runs,
26  e.g., creates trajectories from other scripts and copies plotting routines
27  to the example run folder.
28  """
29  # Define the data path of the example cases
30  self.__ex_script_dir = os.path.dirname(os.path.abspath(__file__))
31  self.__path_examples = os.path.join(self.__ex_script_dir,"../data/Example_data")
32  self.__script_folder = "scripts/"
33 
34  self.__example_pars = ['Example_BigBang.par',\
35  'Example_BigBang_many.par',\
36  'Example_NSM_dyn_ejecta_rosswog.par',\
37  'Example_NSM_dyn_ejecta_fission_rosswog.par',\
38  'Example_NSM_wind_martin.par',\
39  'Example_NSM_wind_bins_martin.par',\
40  'Example_NSM_dyn_ejecta_ns10ns10_rosswog.par',\
41  "Example_NSM_dyn_ejecta_bovard.par",\
42  "Example_NSM_disk_wu.par",\
43  "Example_NSBH_rosswog.par",\
44  'Example_MRSN_r_process_beta_winteler.par',\
45  'Example_MRSN_r_process_winteler.par',\
46  'Example_MRSN_r_process_obergaulinger.par',\
47  'Example_MRSN_weakr_obergaulinger.par',\
48  'Example_MRSN_nup_process_obergaulinger.par',\
49  "Example_MRSN_r_process_reichert.par",\
50  "Example_CCSN_wind_bliss.par",\
51  "Example_CCSN_explosive_burning_parametrized.par",\
52  "Example_i_process_dardelet.par",\
53  "Example_hydrostatic_hydrogen_burning.par",\
54  "Example_xrayburst_schatz.par",\
55  "Example_CO_burning.par",\
56  "Example_type_Ia_meakin.par",\
57  "Example_classical_novae_jose.par",\
58  "Example_AGB_cescutti.par",\
59  "Example_AGB_nishimura.par"
60  ]
61 
62 
63  def prepare_examples(self,parname):
64  """
65  Prepare the simulation before any runfolder exists.
66  """
67  # Check if the run is an example case
68  if (not (parname in self.__example_pars)):
69  return
70  # Get the current working directory
71  current_dir = os.getcwd()
72  # Define the data path of the example case
73  example_dir = os.path.join(self.__path_examples,parname.replace('.par',''))
74  # Special operations for the individual examples
75  # Create the trajectory by executing a script
76  if (parname == 'Example_BigBang.par'):
77  os.chdir(example_dir)
78  os.system('python create_trajectory.py')
79  # Create the trajectories by executing a script
80  if (parname == 'Example_BigBang_many.par'):
81  os.chdir(example_dir)
82  os.system('python create_trajectories.py')
83  # Neutron star merger example, download from webpage
84  if (parname == 'Example_NSM_dyn_ejecta_ns10ns10_rosswog.par'):
85  os.chdir(example_dir)
86  if not os.path.isfile("trajectory_00001.dat"):
87  try:
88  # Download the model
89  url = 'https://compact-merger.astro.su.se/data/trajectories_chk30_ns10_ns10.zip'
90  os.system("wget -q "+url)
91  zipname = os.path.basename(url)
92  except:
93  print("Failed to download the example from "+url+" . Exiting.")
94  sys.exit(1)
95  try:
96  # Unzip the model
97  os.system("unzip -qq "+zipname)
98  os.system("mv "+zipname.replace(".zip","")+"/* .")
99  os.system("rm -r "+zipname.replace(".zip",""))
100  os.system("rm "+zipname)
101  if not os.path.isfile("trajectory_00001.dat"):
102  raise Exception
103  except:
104  print("Failed to unzip the trajectories. Exiting.")
105  sys.exit(1)
106  # Ensure that they have a "#" infront for reading
107  all_trajs = os.listdir(example_dir)
108  for tr in all_trajs:
109  if not "trajectory_" in tr:
110  continue
111  command ="sed -i 's%t%# t%g' "+str(tr)
112  os.system(command)
113  # Neutron star blackhole merger example, download from webpage
114  if (parname == 'Example_NSBH_rosswog.par'):
115  os.chdir(example_dir)
116  if not os.path.isfile("trajectory_ns14_BH10_irrot_1_checked.dat"):
117  try:
118  # Download the model
119  url = 'https://compact-merger.astro.su.se/data/trajecs_BH10_checked.zip'
120  os.system("wget -q "+url)
121  zipname = os.path.basename(url)
122  except:
123  print("Failed to download the example from "+url+" . Exiting.")
124  sys.exit(1)
125  try:
126  # Unzip the model
127  os.system("unzip -qq "+zipname)
128  os.system("mv "+zipname.replace(".zip","")+"/* .")
129  os.system("rm -r "+zipname.replace(".zip",""))
130  os.system("rm "+zipname)
131  if not os.path.isfile("trajectory_ns14_BH10_irrot_1_checked.dat"):
132  raise Exception
133  except:
134  print("Failed to unzip the trajectories. Exiting.")
135  sys.exit(1)
136  # Ensure that they have a "#" infront for reading
137  all_trajs = os.listdir(example_dir)
138  for tr in all_trajs:
139  if not "trajectory_" in tr:
140  continue
141  command ="sed -i 's%t%# t%g' "+str(tr)
142  os.system(command)
143 
144  # Modify reaclib
145  if (parname == 'Example_i_process_dardelet.par'):
146  os.chdir(example_dir)
147 
148  if not os.path.isfile("modified_reaclib"):
149  reaclib_path = os.path.join(example_dir,"../../Reaclib_18_9_20")
150 
151  with open(reaclib_path,"r") as f:
152  lines = f.readlines()
153  mask = np.ones(len(lines),dtype=bool)
154  for ind,line in enumerate(lines):
155  # Remove all occurences n13(p,gamma)o14
156  if "p n13 o14" in line:
157  mask[ind:ind+3] = False
158  # Skip behind chapter 5
159  if "5"+50*" " in line:
160  break
161  lines_without_rate = np.array(lines)[mask]
162 
163  with open("modified_reaclib","w") as f:
164  f.write(''.join(lines_without_rate))
165 
166  if (parname == 'Example_xrayburst_schatz.par'):
167  os.chdir(example_dir)
168 
169  if not os.path.isfile("sunet"):
170  try:
171  # Unzip the model
172  os.system("unzip -qq example_data.zip")
173  # os.system("mv "+zipname.replace(".zip","")+"/* .")
174  # os.system("rm -r "+zipname.replace(".zip",""))
175  # os.system("rm "+zipname)
176  if not os.path.isfile("sunet"):
177  raise Exception
178  except:
179  print("Failed to unzip the example data. Exiting.")
180  sys.exit(1)
181 
182  os.chdir(current_dir)
183 
184 
185  def copy_scripts(self,parname,rundir):
186  """
187  Copy plotting routines to the run folders.
188  """
189  # Check if the run is an example case
190  if (not (parname in self.__example_pars)):
191  return
192 
193  # Get the current working directory
194  current_dir = os.getcwd()
195  # Define the data path of the example case
196  example_dir = os.path.join(self.__path_examples,parname.replace('.par',''))
197 
198  # Path that contains all scripts
199  s_dir = os.path.join(example_dir,self.__script_folder)
200  all_scripts = os.listdir(s_dir)
201 
202  try:
203  # Copy all scripts
204  for f in all_scripts:
205  path = os.path.join(s_dir,f)
206  shutil.copy(path, rundir)
207  except:
208  pass
209 
210  def __link_lit(self,string,link):
211  """
212  Create a colored hyperlink in the terminal
213  """
214  out = "\e]8;;"+link+"\a"+bcolors.OKGREEN+string+bcolors.ENDC+"\e]8;;\a"
215  return out
216 
217  def __repr__(self):
218  """
219  Representative text for the examples
220  """
221  # Header
222  s = "\n"
223  s+= "WinNet contains example cases from hydrodynamical simulations in different astrophysical environments. "\
224  "The parameter files that act as an interface between the user and the code for these cases are contained in the "\
225  +bcolors.WARNING+"par/"+bcolors.ENDC+" directory. The trajectories (containing temperature, density, ...) are contained "\
226  "in "+bcolors.WARNING+"data/Example_data/"+bcolors.ENDC+". Each example will contain a file called "\
227  +bcolors.WARNING+"Plot_me.py "+bcolors.ENDC+"in the "+bcolors.WARNING+"runs/"+bcolors.ENDC+" folder, "\
228  "which plots different outputs of the nucleosynthesis calculation. "\
229  "In case you want to use trajectories for a publication, "\
230  "please cite the corresponding papers that are marked in green below. In contrast to the original works, "\
231  "the example cases use different reaction rates from a recent compilation of JINA (Cyburt et al. 2010) and possibly different input parameters. "\
232  "Furthermore, all example cases are only representative trajectories out of a much larger set used in the publications. "\
233  "The results can therefore differ quantitatively with respect to the original publication.\n\n"
234  # s = bcolors.HEADER+"Example cases:\n"+bcolors.ENDC
235  # s+= bcolors.HEADER+"--------------\n"+bcolors.ENDC
236  s+= "\n"
237 
238  #BigBang
239  s+= bcolors.UNDERLINE+"Big Bang:\n"+bcolors.ENDC
240  s+= '\n'
241 
242  s+= "Big Bang nucleosynthesis. The corresponding trajectory is calculated as described in "+"Winteler 2014. "+\
243  "The example calculates the element production "\
244  "with a"+bcolors.OKCYAN+" photon to baryon ratio of 6.11e-10.\n"+bcolors.ENDC
245  s+= bcolors.BOLD +"Run it with:\n"+bcolors.ENDC
246  s+= bcolors.OKBLUE+"python makerun.py -p Example_BigBang.par -r Example_BigBang\n"+bcolors.ENDC
247  s+= "To calculate many runs with"+bcolors.OKCYAN+" different photon to baryon ratios"+bcolors.ENDC+" you can run:\n"
248  s+= bcolors.OKBLUE+"python makerun.py --many --prepare -p Example_BigBang_many.par -r Example_BigBang_many\n"+bcolors.ENDC
249  s+= bcolors.BOLD +"Literature:\n"+bcolors.ENDC
250  s+= "-\n"
251  s+= '\n\n\n'
252 
253  # NSM
254  s+= bcolors.UNDERLINE+"Neutron star merger:\n"+bcolors.ENDC
255  s+= '\n'
256 
257 
258  # Rosswog/Korobkin/Piran et al.
259  s+= "Run a model with 30 trajectories. The simulation was performed using two neutron stars with 1 solar mass each. "\
260  "The trajectories only included the "+bcolors.OKCYAN+"dynamic ejecta"+bcolors.ENDC+". "\
261  "When running the example, the trajectories are downloaded from "\
262  "https://compact-merger.astro.su.se/downloads_fluid_trajectories.html.\n"
263  s+= "If you want to run only one trajectory, you can run the following example case:\n"
264  s+= bcolors.BOLD +"Run it with:\n"+bcolors.ENDC
265  s+= bcolors.OKBLUE+"python makerun.py -p Example_NSM_dyn_ejecta_rosswog.par -r Example_NSM_dyn_ejecta_rosswog\n"+bcolors.ENDC
266  s+= "Or in case you want to run this trajectory with three different fission fragment distributions:\n"
267  s+= bcolors.OKBLUE+"python makerun.py -p Example_NSM_dyn_ejecta_fission_rosswog.par -r Example_NSM_dyn_ejecta_fission_rosswog --many --val 1,2,3\n"+bcolors.ENDC
268  s+= "In case you want to run all available trajectories (30), run the following command. Be aware that this will most likely take more than one hour:\n"
269  s+= bcolors.OKBLUE+"python makerun.py --many --prepare -p Example_NSM_dyn_ejecta_ns10ns10_rosswog.par -r Example_NSM_dyn_ejecta_ns10ns10_rosswog"+bcolors.ENDC+"\n"
270  s+= bcolors.BOLD +"Literature:\n"+bcolors.ENDC
271  s+= self.__link_lit("- Korobkin et al. 2012","https://ui.adsabs.harvard.edu/abs/2012MNRAS.426.1940K/abstract")+"\n"
272  s+= self.__link_lit("- Rosswog et al. 2013","https://ui.adsabs.harvard.edu/abs/2013MNRAS.430.2585R/abstract")+"\n"
273  s+= self.__link_lit("- Piran et al. 2013","https://ui.adsabs.harvard.edu/abs/2013MNRAS.430.2121P/abstract")+"\n"
274  s+= '\n\n'
275 
276  # Bovard et al.
277  s+= "Run two trajectories of model LS220-M1.35. One trajectory has a low mass and one is representative for the whole model. "\
278  "The trajectories calculate the "+bcolors.OKCYAN+"dynamic ejecta"+bcolors.ENDC+" of a neutron star merger.\n"
279  s+= bcolors.BOLD +"Run it with:\n"+bcolors.ENDC
280  s+= bcolors.OKBLUE+"python makerun.py --many -p Example_NSM_dyn_ejecta_bovard.par -r Example_NSM_dyn_ejecta_bovard"+bcolors.ENDC
281  s+= '\n'
282  s+= bcolors.BOLD +"Literature:\n"+bcolors.ENDC
283  s+= self.__link_lit("- Bovard et al. 2017","https://ui.adsabs.harvard.edu/abs/2017PhRvD..96l4005B/abstract")+"\n"
284  s+= '\n\n'
285 
286  # Martin et al.
287  s+= "Representative trajectory (bin 4, 90ms) of the "+bcolors.OKCYAN+"neutrino driven wind"+bcolors.ENDC+" of a neutron star merger. \n"
288  s+= bcolors.BOLD +"Run it with:\n"+bcolors.ENDC
289  s+= bcolors.OKBLUE+"python makerun.py -p Example_NSM_wind_martin.par -r Example_NSM_wind_martin\n"+bcolors.ENDC
290  s+= "Or alternatively run all different directional bins (4 tracers). \n"
291  s+= bcolors.BOLD +"Run it with:\n"+bcolors.ENDC
292  s+= bcolors.OKBLUE+"python makerun.py --many --prepare -p Example_NSM_wind_bins_martin.par -r Example_NSM_wind_bins_martin\n"+bcolors.ENDC
293  s+= bcolors.BOLD +"Literature:\n"+bcolors.ENDC
294  s+= self.__link_lit("- Perego et al. 2014","https://ui.adsabs.harvard.edu/abs/2014MNRAS.443.3134P/abstract")+"\n"
295  s+= self.__link_lit("- Martin et al. 2015","https://ui.adsabs.harvard.edu/abs/2015ApJ...813....2M/abstract")+"\n"
296  s+= '\n\n'
297 
298  # Wu et al.
299  s+= "Representative trajectories (10) of the "+bcolors.OKCYAN+"viscous/disk ejecta"+bcolors.ENDC+" (model S-def) of a neutron star merger. "\
300  "The model has also been investigated in Lippuner et al. 2017.\n"
301  s+= bcolors.BOLD +"Run it with:\n"+bcolors.ENDC
302  s+= bcolors.OKBLUE+"python makerun.py --many --prepare -p Example_NSM_disk_wu.par -r Example_NSM_disk_wu\n"+bcolors.ENDC
303  s+= bcolors.BOLD +"Literature:\n"+bcolors.ENDC
304  s+= self.__link_lit("- Wu et al. 2016","https://ui.adsabs.harvard.edu/abs/2016MNRAS.463.2323W/abstract")+"\n"
305  s+= self.__link_lit("- Lippuner et al. 2017","https://ui.adsabs.harvard.edu/abs/2017MNRAS.472..904L/abstract")+"\n"
306  s+= '\n\n\n'
307 
308 
309  # NSBH
310  s+= bcolors.UNDERLINE+"Neutron star black hole merger:\n"+bcolors.ENDC
311  s+= '\n'
312  # Rosswog/Korobkin/Piran et al.
313  s+= "Run 20 trajectories of a neutron star black hole merger. "\
314  "The simulation was performed using one neutron star with 1.4 solar masses and a black-hole with 10 solar masses. "\
315  "The trajectories only included the "+bcolors.OKCYAN+"dynamic ejecta"+bcolors.ENDC+". "\
316  "When running the example, the trajectories are downloaded from "\
317  "https://compact-merger.astro.su.se/downloads_fluid_trajectories.html. "\
318  "Due to the amount of calculations, this example case may take a while.\n"
319  s+= bcolors.BOLD +"Run it with:\n"+bcolors.ENDC
320  s+= bcolors.OKBLUE+"python makerun.py --many --prepare -p Example_NSBH_rosswog.par -r Example_NSBH_rosswog"+bcolors.ENDC
321  s+= '\n'
322  s+= bcolors.BOLD +"Literature:\n"+bcolors.ENDC
323  s+= self.__link_lit("- Korobkin et al. 2012","https://ui.adsabs.harvard.edu/abs/2012MNRAS.426.1940K/abstract")+"\n"
324  s+= self.__link_lit("- Rosswog et al. 2013","https://ui.adsabs.harvard.edu/abs/2013MNRAS.430.2585R/abstract")+"\n"
325  s+= self.__link_lit("- Piran et al. 2013","https://ui.adsabs.harvard.edu/abs/2013MNRAS.430.2121P/abstract")+"\n"
326  s+= '\n\n\n'
327 
328 
329  # MR-supernova
330  s+= bcolors.UNDERLINE+"Magneto-rotational driven supernova:\n"+bcolors.ENDC
331  s+= '\n'
332 
333 
334  # Winteler et al.
335  s+="Neutron-rich trajectory of a magneto-rotational driven supernova. Within this tracer particle, "\
336  "heavy elements get synthesized via the "+bcolors.OKCYAN+"r-process"+bcolors.ENDC+".\n"
337  s+= bcolors.BOLD +"Run it with:\n"+bcolors.ENDC
338  s+= bcolors.OKBLUE+"python makerun.py -p Example_MRSN_r_process_winteler.par -r Example_MRSN_r_process_winteler\n"+bcolors.ENDC
339  s+= "Or in case you want to run this trajectory with three different beta-decay rates:\n"
340  s+= bcolors.OKBLUE+"python makerun.py -p Example_MRSN_r_process_beta_winteler.par -r Example_MRSN_r_process_beta_winteler --many --val beta_decay_marketin.dat,beta_decay_moeller.dat,beta_decay_reaclib.dat\n"+bcolors.ENDC
341  s+= bcolors.BOLD +"Literature:\n"+bcolors.ENDC
342  s+= self.__link_lit("- Winteler et al. 2012","https://ui.adsabs.harvard.edu/abs/2012ApJ...750L..22W/abstract")+"\n"
343  s+= '\n\n'
344 
345  # Obergaulinger/Reichert et al.
346  s+="Neutron-rich trajectory of a magneto-rotational driven supernova (35OC-Rs). Within this tracer particle, "\
347  "heavy elements get synthesized via the "+bcolors.OKCYAN+"r-process"+bcolors.ENDC+".\n"
348  s+= bcolors.BOLD +"Run it with:\n"+bcolors.ENDC
349  s+= bcolors.OKBLUE+"python makerun.py -p Example_MRSN_r_process_obergaulinger.par -r Example_MRSN_r_process_obergaulinger\n"+bcolors.ENDC
350  s+="To run a less neutron rich trajectory that synthesizes elements by the"+bcolors.OKCYAN+" weak-r process "+bcolors.ENDC+\
351  "from the same model run:\n"
352  s+= bcolors.OKBLUE+"python makerun.py -p Example_MRSN_weakr_obergaulinger.par -r Example_MRSN_weakr_obergaulinger\n"+bcolors.ENDC
353  s+="A proton-rich trajectory that synthesizes elements via the"+bcolors.OKCYAN+" nu-p process "+bcolors.ENDC+\
354  "from model 35OC-RO can be run by:\n"
355  s+= bcolors.OKBLUE+"python makerun.py -p Example_MRSN_nup_process_obergaulinger.par -r Example_MRSN_nup_process_obergaulinger\n"+bcolors.ENDC
356  s+= bcolors.BOLD +"Literature:\n"+bcolors.ENDC
357  s+= self.__link_lit("- Obergaulinger & Aloy 2017","https://ui.adsabs.harvard.edu/abs/2017MNRAS.469L..43O/abstract")+"\n"
358  s+= self.__link_lit("- Reichert et al. 2021","https://ui.adsabs.harvard.edu/abs/2021MNRAS.501.5733R/abstract")+"\n"
359  s+= '\n\n'
360 
361  # Aloy, Obergaulinger, Reichert
362  s+="High entropy trajectory as well as two neutron-rich tracers of a magneto-rotational driven supernova. "\
363  "The high entropy tracer originates in model P, the neutron-rich tracers from model 35OC-Rs_N. "\
364  "In all cases heavy elements get synthesized via the "+bcolors.OKCYAN+"r-process"+bcolors.ENDC+".\n"
365  s+= bcolors.BOLD +"Run it with:\n"+bcolors.ENDC
366  s+= bcolors.OKBLUE+"python makerun.py --many -p Example_MRSN_r_process_reichert.par -r Example_MRSN_r_process_reichert\n"+bcolors.ENDC
367  s+= bcolors.BOLD +"Literature:\n"+bcolors.ENDC
368  s+= self.__link_lit("- Aloy & Obergaulinger 2021","https://ui.adsabs.harvard.edu/abs/2021MNRAS.500.4365A/abstract")+"\n"
369  s+= self.__link_lit("- Obergaulinger & Aloy 2021","https://ui.adsabs.harvard.edu/abs/2021MNRAS.503.4942O/abstract")+"\n"
370  s+= self.__link_lit("- Reichert et al. 2023","https://ui.adsabs.harvard.edu/abs/2023MNRAS.518.1557R/abstract")+"\n"
371  s+= '\n\n\n'
372 
373  s+= bcolors.UNDERLINE+"Classical Novae:\n"+bcolors.ENDC
374  s+= '\n'
375 
376  # Jose & Hernandez
377  s+="Trajectory of a classical novae (model ONe5)."\
378  "The trajectory can be downloaded at https://zenodo.org/record/6474694 (v 1.1.1). Also the following description is given there: "\
379  "The model follows 1 outburst from the initiation of the accretion stage and through the explosion, expansion and ejection. "\
380  "It relies on a 1.25 Msun, ONe WD hosting the explosion. For simplicity, it is assumed pre-enriched, accreted material with "\
381  "a composition corresponding to 50% solar (from Lodders 2009) and 50% outer layers of the WD substrate (from Ritossa et al. 1996). "\
382  "The initial luminosity of the WD is assumed to be 10^-2 Lsun, and the mass-accretion rate is 2x10^-10 Msun yr^-1.\n"
383  s+= bcolors.BOLD +"Run it with:\n"+bcolors.ENDC
384  s+= bcolors.OKBLUE+"python makerun.py -p Example_classical_novae_jose.par -r Example_classical_novae_jose\n"+bcolors.ENDC
385  s+= bcolors.BOLD +"Literature:\n"+bcolors.ENDC
386  s+= self.__link_lit("- Jose & Hernanz 1998","https://ui.adsabs.harvard.edu/abs/1998ApJ...494..680J/abstract")+"\n"
387  s+= self.__link_lit("- Jose 2022","https://doi.org/10.5281/zenodo.6474694")+"\n"
388  s+= '\n\n\n'
389 
390  s+= bcolors.UNDERLINE+"Accreting neutron stars:\n"+bcolors.ENDC
391  s+= '\n'
392 
393  # Schatz et al.
394  s+="Trajectory of a X-ray burst. The trajectory originates from a simulation of an accreting "\
395  "neutron star. The nucleosynthesis is dominated by the "+bcolors.OKCYAN+"rp-process"+bcolors.ENDC+".\n"
396  s+= bcolors.BOLD +"Run it with:\n"+bcolors.ENDC
397  s+= bcolors.OKBLUE+"python makerun.py -p Example_xrayburst_schatz.par -r Example_xrayburst_schatz\n"+bcolors.ENDC
398  s+= bcolors.BOLD +"Literature:\n"+bcolors.ENDC
399  s+= self.__link_lit("- Schatz et al. 2002","https://ui.adsabs.harvard.edu/abs/2001NuPhA.688..150S/abstract")+"\n"
400  s+= '\n\n\n'
401 
402  s+= bcolors.UNDERLINE+"Regular Core-collapse supernovae:\n"+bcolors.ENDC
403  s+= '\n'
404 
405  # Parametrized
406  s+="Simple parametric model to calculate "+bcolors.OKCYAN+"complete Si burning"+bcolors.ENDC+"."+"\n"\
407  "The trajectory starts out of NSE and no initial composition is required.\n"
408  s+= bcolors.BOLD +"Run it with:\n"+bcolors.ENDC
409  s+= bcolors.OKBLUE+"python makerun.py -p Example_CCSN_explosive_burning_parametrized.par -r Example_CCSN_explosive_burning_parametrized\n"+bcolors.ENDC
410  s+= bcolors.BOLD +"Literature:\n"+bcolors.ENDC
411  s+= "-\n"
412  s+= '\n\n'
413 
414  # Bliss et al.
415  s+="Trajectory assuming a steady state model of a "+bcolors.OKCYAN+"neutrino driven wind."+bcolors.ENDC+"\n"\
416  "The trajectory (CPR2) is publicly available at https://theorie.ikp.physik.tu-darmstadt.de/astro/resources.php.\n"
417  s+= bcolors.BOLD +"Run it with:\n"+bcolors.ENDC
418  s+= bcolors.OKBLUE+"python makerun.py -p Example_CCSN_wind_bliss.par -r Example_CCSN_wind_bliss\n"+bcolors.ENDC
419  s+= bcolors.BOLD +"Literature:\n"+bcolors.ENDC
420  s+= self.__link_lit("- Bliss et al. 2018","https://ui.adsabs.harvard.edu/abs/2018ApJ...855..135B/abstract")+"\n"
421  s+= '\n\n\n'
422 
423 
424 
425  s+= bcolors.UNDERLINE+"Type Ia Supernova:\n"+bcolors.ENDC
426  s+= '\n'
427  # Bliss et al.
428  s+="Parametrization of the detonation phase of a Type Ia Supernova."+" The trajectory undergoes"+bcolors.OKCYAN+" explosive burning"+\
429  bcolors.ENDC+".\n"
430  s+= bcolors.BOLD +"Run it with:\n"+bcolors.ENDC
431  s+= bcolors.OKBLUE+"python makerun.py -p Example_type_Ia_meakin.par -r Example_type_Ia_meakin\n"+bcolors.ENDC
432  s+= bcolors.BOLD +"Literature:\n"+bcolors.ENDC
433  s+= self.__link_lit("- Meakin et al. 2009","https://ui.adsabs.harvard.edu/abs/2009ApJ...693.1188M/abstract")+"\n"
434  s+= '\n\n\n'
435 
436 
437  s+= bcolors.UNDERLINE+"AGB stars:\n"+bcolors.ENDC
438  s+= '\n'
439 
440  s+="Carbon 13 and thermal pulse trajectories of a 3 Msun, Z = 0.014 (solar metallicity) star. "+\
441  "Elements get synthesized within a "+bcolors.OKCYAN+"strong s-process"+bcolors.ENDC+". "
442  s+="The two trajectories were calculated with the 1D stellar evolution code MESA. They were "+\
443  "accessed at https://zenodo.org/record/6474686 (v.1.2.1). \n"
444  s+= bcolors.BOLD +"Run it with:\n"+bcolors.ENDC
445  s+= bcolors.OKBLUE+"python makerun.py --many -p Example_AGB_cescutti.par -r Example_AGB_cescutti\n"+bcolors.ENDC
446  s+= bcolors.BOLD +"Literature:\n"+bcolors.ENDC
447  s+= self.__link_lit("- Cescutti et al. 2018","https://ui.adsabs.harvard.edu/abs/2018MNRAS.478.4101C/abstract")+"\n"
448  s+= self.__link_lit("- Cescutti 2022","https://doi.org/10.5281/zenodo.6474686")+"\n"
449  s+= '\n\n'
450 
451  s+="Representative trajectory of a "+bcolors.OKCYAN+"weak s-process"+bcolors.ENDC+". "+\
452  "The trajectory was extracted from a 25 Msun, Z = 0.014 (solar metallicity) stellar evolution model. "
453  s+="It was chosen because it roughly corresponds to the average weak s-process production in massive stars "+\
454  "weighted over the initial mass function. This information as well as the trajectory itself were "+\
455  "accessed at https://zenodo.org/record/6474728 (v 1.1.1). \n"
456  s+= bcolors.BOLD +"Run it with:\n"+bcolors.ENDC
457  s+= bcolors.OKBLUE+"python makerun.py -p Example_AGB_nishimura.par -r Example_AGB_nishimura\n"+bcolors.ENDC
458  s+= bcolors.BOLD +"Literature:\n"+bcolors.ENDC
459  s+= self.__link_lit("- Hirschi et al. 2004","https://ui.adsabs.harvard.edu/abs/2004A%26A...425..649H/abstract")+"\n"
460  s+= self.__link_lit("- Nishimura et al. 2017","https://ui.adsabs.harvard.edu/abs/2017MNRAS.469.1752N/abstract")+"\n"
461  s+= self.__link_lit("- Pignatari & Hirschi 2022","https://zenodo.org/record/6474728")+"\n"
462  s+= '\n\n\n'
463 
464 
465  s+= bcolors.UNDERLINE+"Hydrostatic burning:\n"+bcolors.ENDC
466  s+= '\n'
467 
468  # Hydrogen Burning
469  s+="Hydrostatic "+bcolors.OKCYAN+"hydrogen burning"+bcolors.ENDC+" for a constant density of 100 g/ccm and "
470  s+="different temperatures (between 1e7 K and 4e7 K). To be able to plot the output, the hdf5 output has to "
471  s+="be enabled and configured in the Makefile.\n"
472  s+= bcolors.BOLD +"Run it with:\n"+bcolors.ENDC
473  s+= bcolors.OKBLUE+"python makerun.py -p Example_hydrostatic_hydrogen_burning.par -r Example_hydrostatic_hydrogen_burning --many --prepare --val_min=1 --val_max=4 --val_it=0.1\n"+bcolors.ENDC
474  s+= bcolors.BOLD +"Literature:\n"+bcolors.ENDC
475  s+= "-\n"
476  s+= '\n\n'
477 
478  # Carbon-oxygen Burning
479  s+="Hydrostatic "+bcolors.OKCYAN+"carbon-oxygen burning"+bcolors.ENDC+" for a constant density of 1e9 g/ccm and "
480  s+="a temperature of 3 GK.\n"
481  s+= bcolors.BOLD +"Run it with:\n"+bcolors.ENDC
482  s+= bcolors.OKBLUE+"python makerun.py -p Example_CO_burning.par -r Example_CO_burning\n"+bcolors.ENDC
483  s+= bcolors.BOLD +"Literature:\n"+bcolors.ENDC
484  s+= "-\n"
485  s+= '\n\n'
486 
487  # Dardelet et al.
488  s+="A simple model, simulating an "+bcolors.OKCYAN+"i-process"+bcolors.ENDC+" within a one-zone nuclear reaction network.\n"
489  s+= bcolors.BOLD +"Run it with:\n"+bcolors.ENDC
490  s+= bcolors.OKBLUE+"python makerun.py --many -p Example_i_process_dardelet.par -r Example_i_process_dardelet\n"+bcolors.ENDC
491  s+= bcolors.BOLD +"Literature:\n"+bcolors.ENDC
492  s+= self.__link_lit("- Dardelet et al. 2015","https://ui.adsabs.harvard.edu/abs/2015arXiv150505500D/abstract")+"\n"
493  s+= '\n\n'
494 
495 
496  s = "'"+s+"'"
497  return s
498 
499 
500 
501 
502 
503 
504 
505 if __name__ == '__main__':
506  # Test the class
507  example = examplecase()
508  # example.prepare_examples('Example_BigBang_many.par')
509  # example.copy_scripts('Example_BigBang_many.par','test')
510  print(example)
bin.examplecase_class.examplecase.prepare_examples
def prepare_examples(self, parname)
Definition: examplecase_class.py:63
bin.examplecase_class.examplecase.__link_lit
def __link_lit(self, string, link)
Definition: examplecase_class.py:210
bin.examplecase_class.examplecase.__repr__
def __repr__(self)
Definition: examplecase_class.py:217
bin.examplecase_class.examplecase.__example_pars
__example_pars
Definition: examplecase_class.py:34
bin.examplecase_class.examplecase
Definition: examplecase_class.py:22
bin.examplecase_class.examplecase.__init__
def __init__(self)
Definition: examplecase_class.py:23
bin.examplecase_class.examplecase.__ex_script_dir
__ex_script_dir
Definition: examplecase_class.py:30
bin.examplecase_class.examplecase.__path_examples
__path_examples
Definition: examplecase_class.py:31
bin.examplecase_class.bcolors
Definition: examplecase_class.py:6
bin.examplecase_class.examplecase.__script_folder
__script_folder
Definition: examplecase_class.py:32
bin.examplecase_class.examplecase.copy_scripts
def copy_scripts(self, parname, rundir)
Definition: examplecase_class.py:185