Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/deploy-github-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
Expand All @@ -42,6 +44,7 @@ jobs:
sudo apt-get install gfortran swig libhdf5-serial-dev
pip install -r requirements.txt
pip install meson numpy

python -m pip install .

- name: Make dependencies
Expand Down
2 changes: 2 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ def setup(app):
plot_pre_code = """
from generate_default_bsedict import get_default_BSE_settings
default_BSEDict = get_default_BSE_settings(to_python=True)
default_SSEDict = {'stellar_engine': 'sse'}

"""


Expand Down
2 changes: 2 additions & 0 deletions docs/create_params_ini.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ def construct_ini_from_json(config, include_comments=True):
if "default" in option and option["default"]:
if setting["type"] == "checkbox":
default.append(str(option["name"]))
elif option["name"] == "":
default = '""'
else:
default = str(option["name"])

Expand Down
4 changes: 3 additions & 1 deletion docs/pages/evolve/interface.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@ samples ~100 binaries and evolving them.

.. ipython:: python

SSEDict = {'stellar_engine': 'sse'}

InitialBinaries, mass_singles, mass_binaries, n_singles, n_binaries = InitialBinaryTable.sampler(
'independent', [13, 14], [13, 14], binfrac_model=0.5, primary_model='kroupa01',
ecc_model='sana12', porb_model='sana12', qmin=-1, SF_start=13700.0, SF_duration=0.0,
met=0.002, size=1000)

bpp, bcm, initC, kick_info = Evolve.evolve(initialbinarytable=InitialBinaries, BSEDict=BSEDict)
bpp, bcm, initC, kick_info = Evolve.evolve(initialbinarytable=InitialBinaries, BSEDict=BSEDict, SSEDict=SSEDict)

Now we can create a ``COSMICOutput`` object quite easily (with an optional label):

Expand Down
2 changes: 1 addition & 1 deletion docs/pages/evolve/multiple.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,5 @@ progenitor, we expect most of the evolution to take place in the first ~60 Myr.
import numpy as np
np.random.seed(5)
binary_set = InitialBinaryTable.InitialBinaries(m1=[85.543645, 11.171469], m2=[84.99784, 9.67305], porb=[446.795757, 370.758343], ecc=[0.448872, 0.370], tphysf=[13700.0, 13700.0], kstar1=[1, 1], kstar2=[1, 1], metallicity=[0.002, 0.02])
fig = evolve_and_plot(binary_set, t_min=None, t_max=[6.0, 60.0], BSEDict=BSEDict, SSEDict=SSEDict, sys_obs={})
fig = evolve_and_plot(binary_set, t_min=None, t_max=[6.0, 60.0], BSEDict=default_BSEDict, SSEDict=default_SSEDict, sys_obs={})

9 changes: 6 additions & 3 deletions docs/pages/evolve/rerun.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,14 @@ First, let's evolve a binary and save the initC table.

.. ipython:: python


SSEDict = {'stellar_engine': 'sse'}

binary = InitialBinaryTable.InitialBinaries(
m1=20, m2=15, porb=100, ecc=0.1, tphysf=13700.0, kstar1=1, kstar2=1, metallicity=0.02
)

bpp, bcm, initC, kick_info = Evolve.evolve(initialbinarytable=binary, BSEDict=BSEDict)
bpp, bcm, initC, kick_info = Evolve.evolve(initialbinarytable=binary, BSEDict=BSEDict, SSEDict=SSEDict)

We can check some of the output for this binary so that we can see it's identical after we re-run it.

Expand Down Expand Up @@ -74,7 +77,7 @@ pass in a BSEDict this time, since we are modifying the physics assumptions dire

# modify alpha1 in the initC table
initC_modified = initC.copy()
initC_modified['alpha1'] = 10
initC_modified['alpha1_0'] = 10

# re-run the binary with modified physics
bpp_rerun_mod, bcm_rerun_mod, initC_rerun_mod, kick_info_rerun_mod = Evolve.evolve(
Expand Down Expand Up @@ -107,7 +110,7 @@ very small sigma value for both regular core-collapse supernovae and electron-ca

# modify alpha1 in the initC table
initC_modified_kick = initC.copy()
initC_modified_kick['alpha1'] = 10
initC_modified_kick['alpha1_0'] = 10
initC_modified_kick['sigma'] = 1.0
initC_modified_kick['sigmadiv'] = -1.0
initC_modified_kick['kickflag'] = 1
Expand Down
5 changes: 1 addition & 4 deletions docs/pages/evolve/resolution.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,14 @@ First, print all time steps during mass transfer

.. include:: ../../_generated/default_bsedict.rst

bpp, bcm, initC, kick_info = Evolve.evolve(initialbinarytable=single_binary, BSEDict=BSEDict,
SSEDict=SSEDict, timestep_conditions=timestep_conditions)

.. ipython:: python
:okwarning:

# Define the condition for the time step
timestep_conditions = [['RRLO_1>=1', 'dtp=0.0'], ['RRLO_2>=1', 'dtp=0.0']]

bpp, bcm, initC, kick_info = Evolve.evolve(
initialbinarytable=single_binary, BSEDict=BSEDict,
initialbinarytable=single_binary, BSEDict=BSEDict, SSEDict=SSEDict,
timestep_conditions=timestep_conditions
)
print(bcm[['tphys', 'kstar_1', 'kstar_2', 'mass_1', 'mass_2', 'RRLO_1', 'RRLO_2']])
Expand Down
6 changes: 2 additions & 4 deletions docs/pages/evolve/single.rst
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,7 @@ You can also use the built-in plotting function to see how the system evolves:
from cosmic.sample.initialbinarytable import InitialBinaryTable
from cosmic.plotting import evolve_and_plot
single_binary = InitialBinaryTable.InitialBinaries(m1=85.543645, m2=84.99784, porb=446.795757, ecc=0.448872, tphysf=13700.0, kstar1=1, kstar2=1, metallicity=0.002)
SSEDict = {'stellar_engine': 'sse'}
fig = evolve_and_plot(single_binary, t_min=None, t_max=None, BSEDict=default_BSEDict, SSEDict=SSEDict, sys_obs={})
fig = evolve_and_plot(single_binary, t_min=None, t_max=None, BSEDict=default_BSEDict, SSEDict=default_SSEDict, sys_obs={})


In this case, all the action happens in the first few Myr, so let's specify a t_max:
Expand All @@ -199,5 +198,4 @@ In this case, all the action happens in the first few Myr, so let's specify a t_
from cosmic.sample.initialbinarytable import InitialBinaryTable
from cosmic.plotting import evolve_and_plot
single_binary = InitialBinaryTable.InitialBinaries(m1=85.543645, m2=84.99784, porb=446.795757, ecc=0.448872, tphysf=13700.0, kstar1=1, kstar2=1, metallicity=0.002)
SSEDict = {'stellar_engine': 'sse'}
fig = evolve_and_plot(single_binary, t_min=None, t_max=6.0, BSEDict=default_BSEDict, SSEDict=SSEDict, sys_obs={})
fig = evolve_and_plot(single_binary, t_min=None, t_max=6.0, BSEDict=default_BSEDict, SSEDict=default_SSEDict, sys_obs={})
7 changes: 7 additions & 0 deletions docs/pages/inifile.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ Random Seed
:file: ../_generated/config_insert_rand_seed.html


Single star evolution
---------------------

.. raw:: html
:file: ../_generated/config_insert_sse.html


Binary physics
--------------

Expand Down
47 changes: 47 additions & 0 deletions examples/Params.ini
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,53 @@ match = -5.0
; Default: 42
seed = 42

[sse]

; stellar_engine
; Select which stellar evolution engine to use for single star evolution
;
; Options:
; sse - Use SSE for single star evolution which will apply the fitting formulae from Hurley+2000 for the single star evolution
; metisse - Use METISSE for single star evolution, must supply ``path_to_tracks`` and ``path_to_he_tracks``
; Default: sse
stellar_engine = sse

; path_to_tracks
; Path to the METISSE tracks for single star evolution. Must be supplied if ``stellar_engine`` is set to ``metisse``
;
; Options:
; path/to/tracks - This specifies the absolute path to the EEP tracks for single star evolution. Leave the string empty if not using METISSE for single star evolution.
; - Default value (not using METISSE for single star evolution)
; Default: ""
path_to_tracks = ""

; path_to_he_tracks
; Path to the METISSE tracks for helium star evolution. Must be supplied if ``stellar_engine`` is set to ``metisse``
;
; Options:
; path/to/he_tracks - This specifies the absolute path to the EEP tracks for helium star evolution. Leave the string empty if not using METISSE for single star evolution.
; - Default value (not using METISSE for single star evolution)
; Default: ""
path_to_he_tracks = ""

; z_accuracy_limit
; Sets the maximum allowed relative difference between the supplied metallicity and the tracks used by METISSE. If cosmic throws an error due to metallicity, increasing this slightly may help. Must be supplied if ``stellar_engine`` is set to ``metisse``
;
; Options:
; positive values - Minimum metallicity
; 0.01 - Recommended value
; Default: 0.01
z_accuracy_limit = 0.01

; metisse_verbose
; Whether to print verbose output from METISSE when using METISSE for single star evolution.
;
; Options:
; True - Print verbose output from METISSE when using METISSE for single star evolution.
; False - Do not print verbose output from METISSE when using METISSE for single star evolution.
; Default: False
metisse_verbose = False

[bse]

;;;;;;;;;;;;;;;;;
Expand Down
94 changes: 94 additions & 0 deletions src/cosmic/data/cosmic-settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,100 @@
}
]
},
{
"category": "sse",
"category_label": "Single star evolution",
"category_description": "Settings that control the single star evolution in the simulation",
"docs-colour": "lightsteelblue",
"settings": [
{
"name": "stellar_engine",
"description": "Select which stellar evolution engine to use for single star evolution",
"type": "dropdown",
"options-preface": "",
"options": [
{
"name": "sse",
"description": "Use SSE for single star evolution which will apply the fitting formulae from <a href='https://ui.adsabs.harvard.edu/abs/2000MNRAS.315..543H/abstract'>Hurley+2000</a> for the single star evolution",
"default": true

},
{
"name": "metisse",
"description": "Use METISSE for single star evolution, must supply <code>path_to_tracks</code> and <code>path_to_he_tracks</code>"
}
]
},
{
"name": "path_to_tracks",
"description": "Path to the METISSE tracks for single star evolution. Must be supplied if <code>stellar_engine</code> is set to <code>metisse</code>",
"type": "string",
"options-preface": "",
"options": [
{
"name": "path/to/tracks",
"description": "This specifies the absolute path to the EEP tracks for single star evolution. Leave the string empty if not using METISSE for single star evolution."
},
{
"name": "",
"description": "Default value (not using METISSE for single star evolution)",
"default": true
}
]
},
{
"name": "path_to_he_tracks",
"description": "Path to the METISSE tracks for helium star evolution. Must be supplied if <code>stellar_engine</code> is set to <code>metisse</code>",
"type": "string",
"options-preface": "",
"options": [
{
"name": "path/to/he_tracks",
"description": "This specifies the absolute path to the EEP tracks for helium star evolution. Leave the string empty if not using METISSE for single star evolution."
},
{
"name": "",
"description": "Default value (not using METISSE for single star evolution)",
"default": true
}
]
},
{
"name": "z_accuracy_limit",
"description": "Sets the maximum allowed relative difference between the supplied metallicity and the tracks used by METISSE. If cosmic throws an error due to metallicity, increasing this slightly may help. Must be supplied if <code>stellar_engine</code> is set to <code>metisse</code>",
"type": "number",
"options-preface": "",
"options": [
{
"name": "positive values",
"description": "Minimum metallicity"
},
{
"name": 0.01,
"description": "Recommended value",
"default": true
}
]
},
{
"name": "metisse_verbose",
"description": "Whether to print verbose output from METISSE when using METISSE for single star evolution.",
"type": "dropdown",
"options-preface": "",
"options": [
{
"name": "True",
"description": "Print verbose output from METISSE when using METISSE for single star evolution."
},
{
"name": "False",
"description": "Do not print verbose output from METISSE when using METISSE for single star evolution.",
"default": true
}
]
}
]
},
{
"category": "bse",
"category_label": "Binary physics",
Expand Down
Loading