You can interact with this notebook online: Launch notebook
[ ]:
from numba import config
#config.DISABLE_JIT = True
[ ]:
from tardis.io.configuration.config_reader import Configuration
from tardis.workflows.type_iip_workflow import TypeIIPWorkflow
This notebook uses existing atomic data from the Vogl IIp paper converted to an updated format. It can be found on moria in /storage/group_storage/atom_data/iip_data/
Documentation builds render this notebook without executing it because it requires external atomic data and C-TARDIS reference files. Provide these files before running the notebook interactively.
[ ]:
iip_conf = Configuration.from_yaml('iip_config.yml')
The config here is not particularly good or appropriate for a IIp currently. It is mostly to test a pure hydrogen ejecta with continuum processes and non-thermal equilibrium plasma calculations. None of the other values are necessarily appropriate to model a IIp.
MUST BE AT LEAST 2 SHELLS
Opacity and Monte Carlo thread counts
Set plasma.continuum_interaction.nthreads in iip_config.yml to control the maximum number of worker threads used by ContinuumMacroAtomSolver, including the absorbing Markov chain opacity solve. It must be a positive integer and defaults to 1. This setting is independent of montecarlo.nthreads, which controls Monte Carlo transport threads.
For example, the following settings use one opacity worker and eight Monte Carlo threads:
plasma:
continuum_interaction:
nthreads: 1
montecarlo:
nthreads: 8
Consider a low thread count for the opacity solve: simulations containing many elements can require large amounts of memory per worker thread. Start with 1 and increase it only if sufficient memory is available. If this setting is omitted, opacity calculations use one worker regardless of the Monte Carlo thread count.
[ ]:
workflow = TypeIIPWorkflow(iip_conf)
[ ]:
import matplotlib.pyplot as plt
import pandas as pd
j_blues_ctardis = pd.read_csv(
"/home/afullard/tardis-chvogl-configs/j_blues_first.csv", index_col=0
)
plt.plot(workflow.plasma_solver.j_blues[0])
plt.plot(j_blues_ctardis.values[0], linestyle="dashed")
[ ]:
workflow.run()
[ ]:
import matplotlib.pyplot as plt
spectrum = workflow.spectrum_solver.spectrum_real_packets
[ ]:
%matplotlib inline
plt.figure(figsize=(10, 6.5))
spectrum.plot(label="Normal packets")
plt.xlim(500, 9000)
plt.title("TARDIS example model spectrum")
plt.xlabel(r"Wavelength [$\AA$]")
plt.ylabel(r"Luminosity density [erg/s/$\AA$]")
plt.legend()
plt.show()
[ ]:
from tardis.visualization import SDECPlotter
import astropy.units as u
plotter = SDECPlotter.from_workflow(workflow)
plotter.generate_plot_mpl(packets_mode="real", packet_wvl_range=[500, 9000] * u.AA)
[ ]:
workflow.transport_state.tracker_last_interaction_df[workflow.transport_state.tracker_last_interaction_df["last_interaction_type"] == "CONTINUUM_PROCESS"]
[ ]:
from tardis.visualization.tools.liv_plot import LIVPlotter
[ ]:
plotter = LIVPlotter.from_workflow(workflow)
plotter.generate_plot_mpl(packets_mode="real")
[ ]: