Skip to content

Commit 3dc3021

Browse files
Merge branch 'dev' into postProcessingUpdates
2 parents 12dc2ea + 2ffc9a2 commit 3dc3021

File tree

36 files changed

+571
-291
lines changed

36 files changed

+571
-291
lines changed

online-docs/index.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ COMPAS
1111
======
1212

1313
**C**\ ompact **O**\ bject **M**\ ergers: **P**\ opulation **A**\ strophysics and **S**\ tatistics
14+
is a publicly available rapid stellar / binary population synthesis code designed so that evolution prescriptions and model parameters are
15+
easily adjustable. COMPAS draws properties for a binary star system from a set of initial distributions, and evolves it from
16+
zero-age main sequence to the end of its life as two compact remnants. It has been used for inference from observations of
17+
gravitational-wave mergers, Galactic neutron stars, X-ray binaries, and luminous red novae.
1418

1519
`... by` `TeamCOMPAS <https://compas.science/index.html>`_
1620

online-docs/pages/Getting started/building-COMPAS.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ in which all source files are compiled, type::
5454
The `clean` option instructs ``make`` to remove all existing object files (.o), and the COMPAS executable. A subsequent ``make`` is then forced to compile
5555
all source files and link the resultant object files (and external libraries) into a new executable.
5656

57+
The executable can be tested with, e.g.,
58+
59+
./COMPAS -v
60+
61+
which will display the code version.
5762

5863
See :doc:`../Developer guide/Developer build/COMPAS-local-build` for a detailed description of ``Makefile`` functionality.
5964

online-docs/pages/User guide/Post-processing/post-processing-h5copy.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
h5copy.py
22
=========
33

4-
This program copies ``HDF5`` file(s) to a designated output ``HDF5`` file. If the output file is an existing ``HDF5`` file,
5-
the user can specify whether the existing content should be erased before copying begins, or whether the copied data should
6-
be appended to the existing data. If multiple files are given as input files, the resultant ``HDF5`` file is the concatenation
7-
of the input files.
4+
This program copies ``COMPAS_Output.h5`` ``HDF5`` file(s) [but not ``Detailed_Ouput`` files] to a designated output ``HDF5`` file.
5+
If the output file is an existing ``HDF5`` file, the user can specify whether the existing content should be erased before copying
6+
begins, or whether the copied data should be appended to the existing data. If multiple files are given as input files, the
7+
resultant ``HDF5`` file is the concatenation of the input files.
88

99

1010
Some nomenclature

online-docs/pages/User guide/Program options/program-options-ranges.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ where `range-specifier` is defined as:
3232
`start` and `increment` must be the same data type as option-name. |br|
3333
`count` must be a positive integer value.
3434

35+
There should be no spaces inside the brackets ([]). Spaces on the command line are interpreted as argument delimiters
36+
by the shell parser before passing the command-line arguments to the COMPAS executable, so if spaces are present inside
37+
the brackets the shell parser breaks the range specification into multiple command-line arguments.
38+
3539
To specify a range of values for the ``--metallicity`` option, a user, if running COMPAS from the command line
3640
and with no grid file, would type any of the following::
3741

@@ -51,3 +55,9 @@ type::
5155
./COMPAS --metallicity [0.0001,10,0.0013] --common-envelope-alpha [0.1,5,0.2]
5256

5357
and COMPAS would evolve a grid of 50 binaries using the 10 metallicity values and 5 common envelope alpha values.
58+
59+
Note that when a range is, or ranges are, specified on the command line, the ``--number-of-systems`` command-line option is ignored.
60+
This is to avoid multiple systems with identical initial values being evolved. Ranges and sets can be mixed with grid files, and
61+
in that case ranges and sets specified on the command line will be played out for each grid file line.
62+
63+

online-docs/pages/User guide/Program options/program-options-sets.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ where `set-specifier` is defined as:
2828

2929
`set-identifier` is mandatory for `set-specifier`. |br|
3030
`value`:sub:`i` must be the same data type as `option-name`.
31+
32+
There should be no spaces inside the brackets ([]). Spaces on the command line are interpreted as argument delimiters
33+
by the shell parser before passing the command-line arguments to the COMPAS executable, so if spaces are present inside
34+
the brackets the shell parser breaks the set specification into multiple command-line arguments.
3135

3236
Valid values for boolean options are {1|0, TRUE|FALSE, YES|NO, ON|OFF}, and all set values must be of
3337
the same type (i.e. all 1|0, or all YES|NO etc.).
@@ -44,3 +48,9 @@ command line and with no grid file, would type any of the following::
4448

4549
In each of the examples above the user has specified, by the use of the `set-specifier`, that three binary stars
4650
should be evolved, using the eccentricity distributions ’THERMALISED’, ’FIXED’, and ’FLAT’.
51+
52+
Note that when a set is, or sets are, specified on the command line, the ``--number-of-systems`` command-line option is ignored.
53+
This is to avoid multiple systems with identical initial values being evolved. Ranges and sets can be mixed with grid files, and
54+
in that case ranges and sets specified on the command line will be played out for each grid file line.
55+
56+

online-docs/pages/User guide/Running COMPAS/running-via-docker-running.rst

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@ To run COMPAS via a ``pythonSubmit.py`` file, type::
1313
docker run \
1414
--rm \
1515
-it \
16+
-v $(pwd)/compas-input:/app/COMPAS/config \
1617
-v $(pwd)/compas-logs:/app/COMPAS/logs \
1718
-v $(pwd)/pythonSubmit.py:/app/starts/pythonSubmit.py \
1819
-e COMPAS_EXECUTABLE_PATH=/app/COMPAS/bin/COMPAS \
20+
-e COMPAS_INPUT_DIR_PATH=/app/COMPAS/config \
1921
-e COMPAS_LOGS_OUTPUT_DIR_PATH=/app/COMPAS/logs \
2022
teamcompas/compas \
2123
python3 /app/starts/pythonSubmit.py
@@ -35,8 +37,9 @@ short for [-i and -t] - provides an interactive terminal\ [#f2]_.
3537
**-v <path-on-host>:<path-in-container>** |br|
3638
mount ``<path-on-host>`` to ``<path-in-container>``\ [#f3]_. |br|
3739

38-
This time we not only want to get the output from COMPAS on the host machine, we also want to supply a ``pythonSubmit.py`` to the
39-
container from the host machine.
40+
This time we not only want to read the COMPAS input files (i.e. grid file and/or logfile-definitions file) on the
41+
host from the container, and get the output from COMPAS in the container onto the host machine, we also want to
42+
supply a ``pythonSubmit.py`` to the container from the host machine.
4043

4144
**-e VAR_NAME=value** |br|
4245
set the environment variable ``VAR_VAME`` to `value`\ [#f4]_.
@@ -53,13 +56,14 @@ via the command line
5356

5457
To run the COMPAS executable from the command line (i.e. without ``pythonSubmit.py``), type::
5558

56-
docker run \
57-
--rm \
58-
-it \
59-
-v $(pwd)/compas-logs:/app/COMPAS/logs \
60-
teamcompas/compas \
61-
bin/COMPAS \
62-
--number-of-systems=5 \
59+
docker run \
60+
--rm \
61+
-it \
62+
-v $(pwd)/compas-input:/app/COMPAS/config \
63+
-v $(pwd)/compas-logs:/app/COMPAS/logs \
64+
teamcompas/compas \
65+
bin/COMPAS \
66+
--number-of-systems=5 \
6367
--output-path=/app/COMPAS/logs
6468

6569

@@ -77,7 +81,9 @@ short for [-i and -t] - provides an interactive terminal\ [#f2]_.
7781
**-v <path-on-host>:<path-in-container>** |br|
7882
mount ``<path-on-host>`` to ``<path-in-container>``\ [#f3]_. |br|
7983

80-
In this instance, make it so `$(pwd)/compas-logs` on my machine is the same as `/app/COMPAS/logs` inside the container.
84+
In this instance, make it so |br|
85+
`$(pwd)/compas-input` on my machine is the same as `/app/COMPAS/config` inside the container. |br|
86+
`$(pwd)/compas-logs` on my machine is the same as `/app/COMPAS/logs` inside the container.
8187

8288
**teamcompas/compas** |br|
8389
the image to run.
@@ -102,7 +108,7 @@ environment, and are non-breaking changes (i.e. benign to other environments).
102108
``COMPAS_EXECUTABLE_PATH`` specifies where ``pythonSubmit.py`` looks for the COMPAS executable. This override exists purely for
103109
ease-of-use from the command line.
104110

105-
`COMPAS_LOGS_OUTPUT_DIR_PATH` specifies where COMPAS output log filess are created. The override exists because the mounted directory
111+
`COMPAS_LOGS_OUTPUT_DIR_PATH` specifies where COMPAS output log files are created. The override exists because the mounted directory
106112
(option `-v`) is created before COMPAS runs. COMPAS sees that the directory where it's supposed to put logs already exists, so it
107113
creates a different (i.e. non-mapped) directory for the output log files.
108114

@@ -143,3 +149,4 @@ to get the container id of interest, then type::
143149
.. [#f5] https://docs.docker.com/engine/reference/run/
144150
.. [#f6] https://docs.docker.com/engine/reference/run/#detached--d
145151
152+

src/BaseBinaryStar.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2132,14 +2132,14 @@ void BaseBinaryStar::ResolveMassChanges() {
21322132

21332133
// update mass of star1 according to mass loss and mass transfer, then update age accordingly
21342134
(void)m_Star1->UpdateAttributes(m_Star1->MassPrev() - m_Star1->Mass() + m_Star1->MassLossDiff() + m_Star1->MassTransferDiff(), 0.0); // update mass for star1
2135-
m_Star1->UpdateInitialMass(); // update initial mass of star1 (MS, HG & HeMS) JR: todo: fix this kludge one day - mass0 is overloaded, and isn't always "initial mass"
2135+
m_Star1->UpdateInitialMass(); // update effective initial mass of star1 (MS, HG & HeMS)
21362136
m_Star1->UpdateAgeAfterMassLoss(); // update age of star1
21372137
m_Star1->ApplyMassTransferRejuvenationFactor(); // apply age rejuvenation factor for star1
21382138
m_Star1->UpdateAttributes(0.0, 0.0, true);
21392139

21402140
// rinse and repeat for star2
21412141
(void)m_Star2->UpdateAttributes(m_Star2->MassPrev() - m_Star2->Mass() + m_Star2->MassLossDiff() + m_Star2->MassTransferDiff(), 0.0); // update mass for star2
2142-
m_Star2->UpdateInitialMass(); // update initial mass of star 2 (MS, HG & HeMS) JR: todo: fix this kludge one day - mass0 is overloaded, and isn't always "initial mass"
2142+
m_Star2->UpdateInitialMass(); // update effective initial mass of star 2 (MS, HG & HeMS)
21432143
m_Star2->UpdateAgeAfterMassLoss(); // update age of star2
21442144
m_Star2->ApplyMassTransferRejuvenationFactor(); // apply age rejuvenation factor for star2
21452145
m_Star2->UpdateAttributes(0.0, 0.0, true);

src/BaseBinaryStar.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ class BaseBinaryStar {
543543
(void)donorCopy->UpdateAttributes(-dM, -dM*donorCopy->Mass0()/donorCopy->Mass());
544544

545545
// Modify donor Mass0 and Age for MS (including HeMS) and HG stars
546-
donorCopy->UpdateInitialMass(); // update initial mass (MS, HG & HeMS) JR: todo: fix this kludge - mass0 is overloaded, and isn't always "initial mass"
546+
donorCopy->UpdateInitialMass(); // update initial mass (MS, HG & HeMS)
547547
donorCopy->UpdateAgeAfterMassLoss(); // update age (MS, HG & HeMS)
548548

549549
(void)donorCopy->AgeOneTimestep(0.0); // recalculate radius of star - don't age - just update values

src/BaseStar.cpp

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,7 +1055,7 @@ double BaseStar::CalculateLogBindingEnergyLoveridge(bool p_IsMassLoss) const {
10551055
logBindingEnergy += lCoefficients.alpha_mr * utils::intPow(log10(m_Mass), lCoefficients.m) * utils::intPow(log10(m_Radius + deltaR), lCoefficients.r);
10561056
}
10571057

1058-
double MZAMS_Mass = (m_MZAMS - m_Mass) / m_MZAMS;
1058+
double MZAMS_Mass = (m_MZAMS - m_Mass) / m_MZAMS; // Should m_ZAMS really be m_Mass0 (i.e., account for change in effective mass through mass loss in winds, MS mass transfer?)
10591059
logBindingEnergy *= p_IsMassLoss ? 1.0 + (0.25 * MZAMS_Mass * MZAMS_Mass) : 1.0; // apply mass-loss correction factor (lambda)
10601060

10611061
constexpr double logBE0 = 33.29866; // JR: todo: what is this for? Should it be in constants.h?
@@ -1239,7 +1239,7 @@ double BaseStar::CalculateLuminosityAtZAMS(const double p_MZAMS) {
12391239
*
12401240
* double CalculateLuminosityAtBAGB(double p_Mass)
12411241
*
1242-
* @param [IN] p_Mass Mass in Msol
1242+
* @param [IN] p_Mass (Effective) mass in Msol
12431243
* @return Luminosity at BAGB in Lsol
12441244
*/
12451245
double BaseStar::CalculateLuminosityAtBAGB(double p_Mass) const {
@@ -1842,7 +1842,7 @@ void BaseStar::ResolveMassLoss() {
18421842
m_COCoreMass=std::min(m_COCoreMass,m_Mass); // Not expected, only a precaution to avoid inconsistencies
18431843
m_CoreMass=std::min(m_CoreMass, m_Mass);
18441844

1845-
UpdateInitialMass(); // update initial mass (MS, HG & HeMS) JR: todo: fix this kludge one day - mass0 is overloaded, and isn't always "initial mass"
1845+
UpdateInitialMass(); // update effective initial mass (MS, HG & HeMS)
18461846
UpdateAgeAfterMassLoss(); // update age (MS, HG & HeMS)
18471847
ApplyMassTransferRejuvenationFactor(); // apply age rejuvenation factor
18481848
}
@@ -2964,14 +2964,10 @@ void BaseStar::UpdateAttributesAndAgeOneTimestepPreamble(const double p_DeltaMas
29642964
* attributes are updated. The p_DeltaMass parameter may be zero, in which case no change is made to the
29652965
* star's mass before the attributes of the star are calculated.
29662966
*
2967-
* - if required, the star's initial mass is changed by the amount passed as the p_DeltaMass0 parameter before
2968-
* other attributes are updated. The p_DeltaMass parameter may be zero, in which case no change is made to
2969-
* the star's mass before the attributes of the star are calculated. This should be used infrequently, and
2970-
* is really a kludge because the Mass0 attribute in Hurley et al. 2000 was overloaded after the introduction
2971-
* of mass loss (see section 7.1). We should really separate the different uses of Mass0 in the code and
2972-
* use a different variable - initial mass shouldn't change (other than to initial mass upon entering a
2973-
* stellar phase - it doesn't make a lot of sense for initial mass to change during evolution through the
2974-
* phase). JR: todo: action this paragraph.
2967+
* - if required, the star's effective initial mass is changed by the amount passed as the p_DeltaMass0 parameter before
2968+
* other attributes are updated. The p_DeltaMass0 parameter may be zero, in which case no change is made to
2969+
* the star's mass before the attributes of the star are calculated. The Mass0 attribute in Hurley et al. 2000 is overloaded by the introduction
2970+
* of mass loss (see section 7.1).
29752971
*
29762972
* - if required, the star is aged by the amount passed as the p_DeltaTime parameter, and the simulation time is
29772973
* advanced by the same amount, before other attributes are updated. The p_deltaTime parameter may be zero,

src/BaseStar.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,6 @@ class BaseStar {
201201

202202
virtual void ResolveMassLoss();
203203

204-
virtual STELLAR_TYPE ResolveRemnantAfterEnvelopeLoss() { return m_StellarType; }
205-
206204
void SetStellarTypePrev(const STELLAR_TYPE p_StellarTypePrev) { m_StellarTypePrev = p_StellarTypePrev; }
207205

208206
void StashSupernovaDetails(const STELLAR_TYPE p_StellarType) { LOGGING->StashSSESupernovaDetails(this, p_StellarType); }

0 commit comments

Comments
 (0)