Skip to content

Commit

Permalink
Merge pull request #1012 from TeamCOMPAS/naive-tides
Browse files Browse the repository at this point in the history
Naive tides implementation
  • Loading branch information
jeffriley authored Nov 27, 2023
2 parents 2e128eb + 739c8f5 commit 9fa0baf
Show file tree
Hide file tree
Showing 38 changed files with 1,382 additions and 1,813 deletions.
1 change: 0 additions & 1 deletion .dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@ accrete
accreted
YHe
yhe

2 changes: 1 addition & 1 deletion .github/workflows/compas-compile-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ jobs:
with:
name: COMPAS-run-artifacts
path: |
py_tests/test_artifacts
py_tests/test_artifacts
2 changes: 2 additions & 0 deletions .github/workflows/precommit-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ jobs:
with:
python-version: 3.8
- uses: pre-commit/[email protected]


13 changes: 6 additions & 7 deletions compas_python_utils/preprocessing/compasConfigDefault.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
##~!!~## COMPAS option values
##~!!~## File Created Wed Nov 1 11:25:11 2023 by COMPAS v02.40.00
##~!!~## File Created Tue Oct 31 04:36:43 2023 by COMPAS v02.40.00
##~!!~##
##~!!~## The default COMPAS YAML file (``compasConfigDefault.yaml``), as distributed, has
##~!!~## all COMPAS option entries commented so that the COMPAS default value for the
Expand Down Expand Up @@ -47,6 +47,9 @@ booleanChoices:
# --common-envelope-lambda-nanjing-use-rejuvenated-mass: False # Default: False
# --revised-energy-formalism-nandez-ivanova: False # Default: False

### TIDES
# --enable-tides: False # Default: False

### SUPERNOVAE, KICKS AND REMNANTS
# --allow-non-stripped-ECSN: False # Default: False
# --pair-instability-supernovae: True # Default: True
Expand Down Expand Up @@ -96,7 +99,7 @@ numericalChoices:
# --rotational-frequency: 0.000000 # Default: 0.000000
# --rotational-frequency-1: 0.000000 # Default: 0.000000
# --rotational-frequency-2: 0.000000 # Default: 0.000000
# --wolf-rayet-multiplier: 1.000000 # Default: 1.000000
# --wolf-rayet-multiplier: 0.100000 # Default: 0.100000

### BINARY PROPERTIES
# --eccentricity: 0.000000 # Default: 0.000000 # eccentricity for BSE
Expand Down Expand Up @@ -213,11 +216,7 @@ stringChoices:
# --envelope-state-prescription: 'LEGACY' # Default: 'LEGACY' # Options: ['FIXED_TEMPERATURE','HURLEY','LEGACY']
# --initial-mass-function: 'KROUPA' # Default: 'KROUPA' # Options: ['KROUPA','UNIFORM','POWERLAW','SALPETER']
# --luminous-blue-variable-prescription: 'HURLEY_ADD' # Default: 'HURLEY_ADD' # Options: ['BELCZYNSKI','HURLEY','HURLEY_ADD','NONE']
# --mass-loss-prescription: 'FLEXIBLE2023' # Default: 'FLEXIBLE2023' # Options: ['FLEXIBLE2023','BELCZYNSKI2010','HURLEY','NONE']
# --OB-mass-loss: 'VINK2021' # Default: 'VINK2021' # Options: ['KRTICKA2018','BJORKLUND2022','VINK2021','VINK2001','NONE']
# --RSG-mass-loss: 'DECIN2023' # Default: 'DECIN2023' # Options: ['NJ90','KEE2021','YANG2023','DECIN2023','BEASOR2020','VINKSABHAHIT2023','NONE']
# --VMS-mass-loss: 'SABHAHIT2023' # Default: 'SABHAHIT2023' # Options: ['SABHAHIT2023','BESTENLEHNER2020','VINK2011','NONE']
# --WR-mass-loss: 'SANDERVINK2023' # Default: 'SANDERVINK2023' # Options: ['SHENAR2019','SANDERVINK2023','BELCZYNSKI2010']
# --mass-loss-prescription: 'VINK' # Default: 'VINK' # Options: ['VINK','HURLEY','NONE']
# --metallicity-distribution: 'ZSOLAR' # Default: 'ZSOLAR' # Options: ['LOGUNIFORM','ZSOLAR']
# --pulsational-pair-instability-prescription: 'MARCHANT' # Default: 'MARCHANT' # Options: ['FARMER','MARCHANT','STARTRACK','COMPAS']

Expand Down
3 changes: 3 additions & 0 deletions examples/methods_paper_plots/detailed_evolution/Grid_demo.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
--initial-mass-1 35.0 --initial-mass-2 31.0 --metallicity 0.001 --eccentricity 0.000000e+00 --semi-major-axis 3.5 --kick-magnitude-1 0 --kick-magnitude-2 0
--initial-mass-1 35.0 --initial-mass-2 31.0 --metallicity 0.001 --eccentricity 0.000000e+00 --semi-major-axis 3.5 --kick-magnitude-1 0 --kick-magnitude-2 0

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
##~!!~## COMPAS option values
##~!!~## File Created Wed Nov 1 11:22:29 2023 by COMPAS v02.40.00
##~!!~## File Created Tue Oct 31 10:11:32 2023 by COMPAS v02.40.00
##~!!~##
##~!!~## The default COMPAS YAML file (``compasConfigDefault.yaml``), as distributed, has
##~!!~## all COMPAS option entries commented so that the COMPAS default value for the
Expand All @@ -10,7 +10,7 @@ booleanChoices:

### LOGISTICS
# --debug-to-file: False # Default: False
# --detailed-output: False # Default: False # WARNING! this creates a data heavy file
--detailed-output: True # Default: False # WARNING! this creates a data heavy file
# --enable-warnings: False # Default: False # option to enable/disable warning messages
# --errors-to-file: False # Default: False
# --evolve-unbound-systems: True # Default: True
Expand Down Expand Up @@ -47,6 +47,9 @@ booleanChoices:
# --common-envelope-lambda-nanjing-use-rejuvenated-mass: False # Default: False
# --revised-energy-formalism-nandez-ivanova: False # Default: False

### TIDES
# --enable-tides: False # Default: False

### SUPERNOVAE, KICKS AND REMNANTS
# --allow-non-stripped-ECSN: False # Default: False
# --pair-instability-supernovae: True # Default: True
Expand Down Expand Up @@ -96,7 +99,7 @@ numericalChoices:
# --rotational-frequency: 0.000000 # Default: 0.000000
# --rotational-frequency-1: 0.000000 # Default: 0.000000
# --rotational-frequency-2: 0.000000 # Default: 0.000000
# --wolf-rayet-multiplier: 1.000000 # Default: 1.000000
# --wolf-rayet-multiplier: 0.100000 # Default: 0.100000

### BINARY PROPERTIES
# --eccentricity: 0.000000 # Default: 0.000000 # eccentricity for BSE
Expand Down Expand Up @@ -202,7 +205,7 @@ stringChoices:

### LOGISTICS
# --add-options-to-sysparms: 'GRID' # Default: 'GRID' # Options: ['NEVER','GRID','ALWAYS']
# --grid: '' # Default: '' # grid file name (e.g. 'mygrid.txt')
--grid: 'Grid_demo.txt' # Default: '' # grid file name (e.g. 'mygrid.txt')
# --mode: 'BSE' # Default: 'BSE' # Options: ['BSE','SSE'] # evolving single (SSE) or binary stars (BSE)
# --notes: { } # Default: { }
# --notes-hdrs: { } # Default: { }
Expand All @@ -213,11 +216,7 @@ stringChoices:
# --envelope-state-prescription: 'LEGACY' # Default: 'LEGACY' # Options: ['FIXED_TEMPERATURE','HURLEY','LEGACY']
# --initial-mass-function: 'KROUPA' # Default: 'KROUPA' # Options: ['KROUPA','UNIFORM','POWERLAW','SALPETER']
# --luminous-blue-variable-prescription: 'HURLEY_ADD' # Default: 'HURLEY_ADD' # Options: ['BELCZYNSKI','HURLEY','HURLEY_ADD','NONE']
# --mass-loss-prescription: 'FLEXIBLE2023' # Default: 'FLEXIBLE2023' # Options: ['FLEXIBLE2023','BELCZYNSKI2010','HURLEY','NONE']
# --OB-mass-loss: 'VINK2021' # Default: 'VINK2021' # Options: ['KRTICKA2018','BJORKLUND2022','VINK2021','VINK2001','NONE']
# --RSG-mass-loss: 'DECIN2023' # Default: 'DECIN2023' # Options: ['NJ90','KEE2021','YANG2023','DECIN2023','BEASOR2020','VINKSABHAHIT2023','NONE']
# --VMS-mass-loss: 'SABHAHIT2023' # Default: 'SABHAHIT2023' # Options: ['SABHAHIT2023','BESTENLEHNER2020','VINK2011','NONE']
# --WR-mass-loss: 'SANDERVINK2023' # Default: 'SANDERVINK2023' # Options: ['SHENAR2019','SANDERVINK2023','BELCZYNSKI2010']
# --mass-loss-prescription: 'VINK' # Default: 'VINK' # Options: ['VINK','HURLEY','NONE']
# --metallicity-distribution: 'ZSOLAR' # Default: 'ZSOLAR' # Options: ['LOGUNIFORM','ZSOLAR']
# --pulsational-pair-instability-prescription: 'MARCHANT' # Default: 'MARCHANT' # Options: ['FARMER','MARCHANT','STARTRACK','COMPAS']

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,10 @@ Default = 0.0
Multiplication factor for Eddington accretion for NS & BH (i.e. > 1 is super-eddington and 0 is no accretion). |br|
Default = 1.0

**--enable-tides** |br|
Enables tides. |br|
Default = FALSE

**--enable-warnings** |br|
Display warning messages to stdout. |br|
Default = FALSE
Expand Down Expand Up @@ -935,12 +939,6 @@ Default = 10

:ref:`Back to Top <options-props-top>`

**--OB-mass-loss** |br|
Main sequence mass loss prescription. |br|
Options: { NONE, VINK2001, VINK2021, BJORKLUND2022, KRTICKA2018 } |br|
NONE turns off mass loss for main sequence stars. Also available are Vink (2001, previous default), Vink (2021), Bjorklund (2022), and Krticka (2018). |br|
Default = VINK2021

**--orbital-period** |br|
Initial orbital period for a binary star when evolving in BSE mode (days). |br|
Used only if the semi-major axis is not specified via ``--semi-major-axis``. |br|
Expand Down Expand Up @@ -1107,12 +1105,6 @@ Options: { ZERO, HURLEY, VLTFLAMES } |br|
``ZERO`` sets all initial rotational velocities to 0, while ``HURLEY`` and ``VLTFLAMES`` sample them from the Hurley, Pols, Tout (2000) and Ramirez-Agudelo et al. (2013,2015), respectively |br|
Default = ZERO

**--RSG-mass-loss** |br|
Red supergiant mass loss prescription. |br|
Options: { NONE, VINKSABHAHIT2023, BEASOR2020, DECIN2023, YANG2023, KEE2021, NJ90 } |br|
NONE turns off mass loss for giant (CHeB, FGB, AGB, TPAGB stellar types) stars below the RSG_MAXIMUM_TEMP. Also available are Vink and Sabhahit (2023), Beasor et al. (2020), Decin et al. (2023), Yang et al. (2023), Kee et. al (2021), and Nieuwenhuijzen and de Jager (1990, previous default). |br|
Default = DECIN2023

.. _options-props-S:

:ref:`Back to Top <options-props-top>`
Expand Down Expand Up @@ -1181,12 +1173,6 @@ Default = TRUE
**--version [ -v ]** |br|
Prints COMPAS version string.

**--VMS-mass-loss** |br|
Very massive main sequence mass loss prescription. |br|
Options: { NONE, VINK2011, SABHAHIT2023, BESTENLEHNER2020 } |br|
Applied above the VERY_MASSIVE_MINIMUM_MASS (100 Msol by default). NONE turns off mass loss. Also available are Vink (2011), Bestenlehner (2020), and Sabhahit (2023). |br|
Default = SABHAHIT2023

.. _options-props-W:

:ref:`Back to Top <options-props-top>`
Expand All @@ -1196,12 +1182,6 @@ Multiplicative constant for Wolf Rayet winds. Note that wind mass loss will also
``overall-wind-mass-loss-multiplier``. |br|
Default = 1.0

**--WR-mass-loss** |br|
Wolf-Rayet mass loss prescription. |br|
Options: { BELCZYNSKI2010, SANDERVINK2023, SHENAR2019 } |br|
Selects between Belczynski (2010), Sander and Vink (2021 updated), and Shenar (2019). |br|
Default = SANDERVINK2023

.. _options-props-X:
.. _options-props-Y:

Expand Down Expand Up @@ -1259,8 +1239,7 @@ Go to :ref:`the top of this page <options-props-top>` for the full alphabetical

--use-mass-loss, --check-photon-tiring-limit, --cool-wind-mass-loss-multiplier, --luminous-blue-variable-prescription,
--luminous-blue-variable-multiplier, --mass-loss-prescription, --overall-wind-mass-loss-multiplier, --wolf-rayet-multiplier,
--expel-convective-envelope-above-luminosity-threshold, --luminosity-to-mass-threshold,
--OB-mass-loss, --RSG-mass-loss, --VMS-mass-loss, --WR-mass-loss
--expel-convective-envelope-above-luminosity-threshold, --luminosity-to-mass-threshold

--chemically-homogeneous-evolution

Expand All @@ -1281,7 +1260,7 @@ Go to :ref:`the top of this page <options-props-top>` for the full alphabetical
--mass-transfer-rejuvenation-prescription, --mass-transfer-thermal-limit-accretor, --mass-transfer-thermal-limit-C, --retain-core-mass-during-caseA-mass-transfer,
--stellar-zeta-prescription, --zeta-adiabatic-arbitrary, --zeta-main-sequence, --zeta-radiative-giant-star

--circulariseBinaryDuringMassTransfer, --angular-momentum-conservation-during-circularisation
--circulariseBinaryDuringMassTransfer, --angular-momentum-conservation-during-circularisation, --enable-tides

--envelope-state-prescription, --common-envelope-alpha, --common-envelope-alpha-thermal, --common-envelope-formalism,
--common-envelope-lambda-prescription, --common-envelope-lambda,
Expand Down
5 changes: 5 additions & 0 deletions online-docs/pages/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ Following is a brief list of important updates to the COMPAS code. A complete r

**LATEST RELEASE** |br|

**02.41.00 Nov 02, 2023**

* Added a naive tides implementation.
* Added program option ``enable-tides`` to enable the tides implementation (default is ``false``).

**02.40.00 Oct 20, 2023**

* Added ``FLEXIBLE2023`` as a new default, and ``BELCZYNSKI2010`` as a replacement for the previous ``VINK`` mass loss prescription. The following new sub-wrappers are overridden when selecting ``BELCZYNSKI2010``:
Expand Down
17 changes: 10 additions & 7 deletions py_tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import os
from typing import Any, Dict

import subprocess
import h5py
import pytest
from compas_python_utils.cosmic_integration.binned_cosmic_integrator.bbh_population import \
generate_mock_bbh_population_file

HERE = os.path.dirname(__file__)
DETAILED_EVOLUTION_PATH = os.path.join(
HERE, "../misc/examples/methods_paper_plots/detailed_evolution"
)

TEST_CONFIG_DIR = os.path.join(HERE, "test_data")
TEST_CONFIG_FNAME = os.path.join(TEST_CONFIG_DIR, "fiducial_bbh_config.yaml")
TEST_ARCHIVE_DIR = os.path.join(HERE, "test_artifacts")


Expand All @@ -21,16 +20,20 @@ def example_compas_output_path(clean=False):
(This is a fixture so it can passed as a parameter to other tests)
"""
compas_data_path = os.path.join(
DETAILED_EVOLUTION_PATH, "COMPAS_Output/COMPAS_Output.h5"
TEST_CONFIG_DIR, "COMPAS_Output/COMPAS_Output.h5"
)

if not os.path.exists(compas_data_path) or clean: # Check if path exists
curr_dir = os.getcwd()
os.chdir(DETAILED_EVOLUTION_PATH)
os.system("python runSubmitDemo.py")
os.chdir(TEST_CONFIG_DIR)
cmd = f"compas_run_submit {TEST_CONFIG_FNAME}"
# run the command in shell "compas_run_submit {TEST_CONFIG_FNAME}" with subprocess
subprocess.run(cmd, shell=True, check=True)

os.chdir(curr_dir)
print("Generated COMPAS test data")


return compas_data_path


Expand Down
10 changes: 7 additions & 3 deletions py_tests/test_data/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# Test Data

This folder contains all the COMPAS test data generated manually by running:
This folder contains COMPAS configs used for testing.
COMPAS is run from within the pytest environment and the output is cached for the remainder of the tests.

The pytest runs the following command:
```bash
bash generate_test_data.sh
compas_run_submit fiducial_bbh_configs.yaml
```

These files may need to be periodically updated if the COMPAS code changes.
The pytest cache is _not_ cleared locally (but will be cleared on the CI server).
Hence, this may need to be rerun locally if changes are made to COMPAS.
Loading

0 comments on commit 9fa0baf

Please sign in to comment.