FreeScript
CHIPS
by DTsuna · version 2.2 · updated 3 days ago
No reviews yet
- Downloads
- 0
- Reviews
- 0
- Size
- 43 MB
- Code check
- Clean
- Licence
- GPL-3.0
- Released
- Nov 2026
Open source code to unveil the Complete History of Interaction-Powered Supernovae
Complete History of Interaction-Powered Supernovae (CHIPS)
CHIPS is a tool for simulating the circumstellar matter and light curves of
interaction-powered transients. Coupling the MESA stellar evolution
code and codes implemented by the authors, the user can obtain the
circumstellar matter profile and light curves of interaction-powered
supernovae.
The PDF documentation of the code is available in the repository.
What can CHIPS do?
CHIPS can generate a realistic CSM from a model-agnostic mass eruption calculation (reference 2), which can serve as a reference for observers to compare with various observations of the CSM. It can also generate light curves from CSM interaction (reference 3), which can also be compared with observed light curves. For our sample red supergiant models, the calculation of mass eruption (with 3000 cells) and light curve typically takes respectively an hour and half an hour on modern CPUs. For stripped stars, both the eruption and light curve typically takes around an hour.
Pre-reqs
The requirement for running CHIPS is quite minimal. One needs only the standard gcc and gfortran, python3 with numpy and scipy, and mesa_reader (modules for reading MESA output files) installed. If matplotlib is installed, one can also obtain some plots that are automatically generated by CHIPS. For installation of mesa_reader, please see here for details.
Steps for running CHIPS:
cd input/mesa_models_rsg && unzip 1Zsun.zip && cd ../../ (for the first time)
python run.py --tinj 5 --finj 0.3 --Eej 1e51 --stellar-model input/mesa_models_rsg/15Msun_Z0.014_preccsn.data --analytical-CSM
The argument tinj and finj are required, and can be given only once. The argument Eej can be given multiple times to simulate light curves with different explosion energies.
For the argument --stellar-model, one can read in their MESA stellar model generated on their own. Alternatively, one can use the MESA pre-SN models generated by us.
Our sample models cover
For the light curve module, the currently available opacity tables support only solar metallicity (Z=0.014) input progenitor models for IIn/Ibn, and the above four models for Icn. Work is under way to enable more flexibility in the progenitors.
Although this is not recommended, one can also do the MESA calculation inside run.py with additional arguments --run-mesa and --mesa-path
python run.py --tinj 5 --finj 0.3 --Eej 1e51 --stellar-model /output/MESA/model --run-mesa --mesa-path /path/to/execution/directory --analytical-CSM
The argument --stellar-model should be the output file from this MESA calculation that one would like to be using as input for CHIPS. The argument --mesa-path should specify the relative path to where the calling scripts (mk, rn) for the MESA calculation is.
For modeling Type IIn SNe using the RSG model, we strongly advise to use an analytical CSM model (reference 4) that corrects the artifical shock-compressions that arise from the adiabatic mass eruption code. This can be done with the argument --analytical-CSM. Such CSM model is already being taken into account for the stripped stars.
Using a custom opacity table for eruption calculation
For the opacity in the eruption calculations, a simple analytical formula in Kuriyama & Shigeyama (2020) is used by default. One can instead give a custom opacity table (like those made by OPAL, AESOPUS, etc.), by adding the argument --opacity-table. There are two notes of caution:
While the mass eruption calculation is running, files with names intermediateXXyr.txt, which record the envelope profile XX years after energy injection, are created. If these files are available, for calculations of the light curve one can skip the mass-eruption calculation and obtain the light curve using the code after_eruption.py.
python after_eruption.py --Eej 1e51 --stellar-model input/mesa_models_rsg/15Msun_Z0.014_preccsn.data --profile-at-cc EruptionFiles/intermediate10yr.txt --analytical-CSM
The file given as profile-at-cc argument specifies how much time elapsed between mass eruption and core-collapse. The files are produced at an interval of 1 year.
Using an already obtained CSM for light curve calculation (for stripped models)
For stripped star models, files called intermediateXXyr.txt are not created as the eruption calculations are done for timescales much shorter than a year. The extrapolation to the time specified by --tinj is done by an internal analyti
…
CHIPS is a tool for simulating the circumstellar matter and light curves of
interaction-powered transients. Coupling the MESA stellar evolution
code and codes implemented by the authors, the user can obtain the
circumstellar matter profile and light curves of interaction-powered
supernovae.
The PDF documentation of the code is available in the repository.
What can CHIPS do?
CHIPS can generate a realistic CSM from a model-agnostic mass eruption calculation (reference 2), which can serve as a reference for observers to compare with various observations of the CSM. It can also generate light curves from CSM interaction (reference 3), which can also be compared with observed light curves. For our sample red supergiant models, the calculation of mass eruption (with 3000 cells) and light curve typically takes respectively an hour and half an hour on modern CPUs. For stripped stars, both the eruption and light curve typically takes around an hour.
Pre-reqs
The requirement for running CHIPS is quite minimal. One needs only the standard gcc and gfortran, python3 with numpy and scipy, and mesa_reader (modules for reading MESA output files) installed. If matplotlib is installed, one can also obtain some plots that are automatically generated by CHIPS. For installation of mesa_reader, please see here for details.
Steps for running CHIPS:
- git clone this repository
git clone https://github.com/DTsuna/CHIPS.git
- At the top directory, compile the scripts for the mass eruption and light curve.
make
- Execute the script run.py. For example, to simulate an interaction-powered SN of
- a star with ZAMS (Zero-Age Main Sequence) mass 15 Msun and metallicity 0.014,
- which experiences mass eruption 5 years before core-collapse, with energy injection of 0.3 times the envelope's binding energy,
- and finally explodes with energy 1e51 erg,
cd input/mesa_models_rsg && unzip 1Zsun.zip && cd ../../ (for the first time)
python run.py --tinj 5 --finj 0.3 --Eej 1e51 --stellar-model input/mesa_models_rsg/15Msun_Z0.014_preccsn.data --analytical-CSM
The argument tinj and finj are required, and can be given only once. The argument Eej can be given multiple times to simulate light curves with different explosion energies.
For the argument --stellar-model, one can read in their MESA stellar model generated on their own. Alternatively, one can use the MESA pre-SN models generated by us.
Our sample models cover
- IIn progenitors: red supergiants of solar metallicity (Z=0.014) with ZAMS mass range 13-26 Msun, with 1 Msun interval up to 20 Msun and 2 Msun interval from 20 to 26 Msun,
- Ibn progenitors: hydrogen-poor helium stars of solar metallicity (Z=0.014) with ZAMS mass range 15-29 Msun with 1 Msun interval, and
- Icn progenitors: hydrogen and helium poor stars of solar metallicity (Z=0.014) with ZAMS masses of 20, 22, 25, 29 Msun.
For the light curve module, the currently available opacity tables support only solar metallicity (Z=0.014) input progenitor models for IIn/Ibn, and the above four models for Icn. Work is under way to enable more flexibility in the progenitors.
Although this is not recommended, one can also do the MESA calculation inside run.py with additional arguments --run-mesa and --mesa-path
python run.py --tinj 5 --finj 0.3 --Eej 1e51 --stellar-model /output/MESA/model --run-mesa --mesa-path /path/to/execution/directory --analytical-CSM
The argument --stellar-model should be the output file from this MESA calculation that one would like to be using as input for CHIPS. The argument --mesa-path should specify the relative path to where the calling scripts (mk, rn) for the MESA calculation is.
For modeling Type IIn SNe using the RSG model, we strongly advise to use an analytical CSM model (reference 4) that corrects the artifical shock-compressions that arise from the adiabatic mass eruption code. This can be done with the argument --analytical-CSM. Such CSM model is already being taken into account for the stripped stars.
Using a custom opacity table for eruption calculation
For the opacity in the eruption calculations, a simple analytical formula in Kuriyama & Shigeyama (2020) is used by default. One can instead give a custom opacity table (like those made by OPAL, AESOPUS, etc.), by adding the argument --opacity-table. There are two notes of caution:
- The table must be rectangular with a format given as the sample in input/rosseland, and
- when values outside the table is requested, the closest edge values are used.
While the mass eruption calculation is running, files with names intermediateXXyr.txt, which record the envelope profile XX years after energy injection, are created. If these files are available, for calculations of the light curve one can skip the mass-eruption calculation and obtain the light curve using the code after_eruption.py.
python after_eruption.py --Eej 1e51 --stellar-model input/mesa_models_rsg/15Msun_Z0.014_preccsn.data --profile-at-cc EruptionFiles/intermediate10yr.txt --analytical-CSM
The file given as profile-at-cc argument specifies how much time elapsed between mass eruption and core-collapse. The files are produced at an interval of 1 year.
Using an already obtained CSM for light curve calculation (for stripped models)
For stripped star models, files called intermediateXXyr.txt are not created as the eruption calculations are done for timescales much shorter than a year. The extrapolation to the time specified by --tinj is done by an internal analyti
…