Skip to content

Commit cc7c839

Browse files
authored
Merge pull request #1374 from jeffriley/sharpened
Requested changes
2 parents 49d7175 + a4c2fd6 commit cc7c839

File tree

18 files changed

+177
-182
lines changed

18 files changed

+177
-182
lines changed

compas_python_utils/preprocessing/compasConfigDefault.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
##~!!~## COMPAS option values
2-
##~!!~## File Created Tue Apr 1 17:29:43 2025 by COMPAS v03.17.00
2+
##~!!~## File Created Mon Apr 14 17:15:32 2025 by COMPAS v03.18.00
33
##~!!~##
44
##~!!~## The default COMPAS YAML file (``compasConfigDefault.yaml``), as distributed, has
55
##~!!~## all COMPAS option entries commented so that the COMPAS default value for the
@@ -88,6 +88,7 @@ numericalChoices:
8888
# --number-of-systems: 10 # Default: 10 # number of systems per batch
8989
# --radial-change-fraction: 0.100000 # Default: 0.100000 # approximate desired fractional changes in stellar radius per timestep
9090
# --timestep-multiplier: 1.000000 # Default: 1.000000 # optional multiplier relative to default time step duration
91+
# --timestep-multipliers: '{ }' # Default: '' # optional phase-dependent multipliers relative to default time step duration
9192

9293
### STELLAR PROPERTIES
9394
# --cool-wind-mass-loss-multiplier: 1.000000 # Default: 1.000000

online-docs/pages/User guide/COMPAS output/standard-logfiles-record-specification-stellar.rst

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1789,22 +1789,6 @@ same header string.`
17891789
* - Header Strings:
17901790
- Recycled_NS, Recycled_NS(1), Recycled_NS(2), Recycled_NS(SN), Recycled_NS(CP)
17911791

1792-
.. flat-table::
1793-
:widths: 25 75 1 1
1794-
:header-rows: 0
1795-
:class: aligned-text
1796-
1797-
* - :cspan:`2` **RLOF_ONTO_NS**
1798-
-
1799-
* - Data type:
1800-
- DOUBLE
1801-
* - COMPAS variable:
1802-
- `derived from` BaseStar::m_SupernovaDetails.events.past
1803-
* - Description:
1804-
- Flag to indicate whether the star transferred mass to a neutron star at any time prior to the current timestep.
1805-
* - Header Strings:
1806-
- RLOF->NS, RLOF->NS(1), RLOF->NS(2), RLOF->NS(SN), RLOF->NS(CP)
1807-
18081792
.. flat-table::
18091793
:widths: 25 75 1 1
18101794
:header-rows: 0

online-docs/pages/whats-new.rst

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,36 @@ What's new
33

44
Following is a brief list of important updates to the COMPAS code. A complete record of changes can be found in the file ``changelog.h``.
55

6-
**03.18.00 Apr 13, 2025**
6+
**03.18.00 Apr 14, 2025**
77

88
New command line option:
99

1010
* ``--timestep-multipliers`` to enable more granular, phase-dependent, timestep multipliers
1111

12+
**03.17.03 Apr 14, 2025**
13+
14+
* Neutron stars are now labelled as ``RecycledNS`` when undergoing mass transfer through common envelope (when ``--neutron-star-accretion-in-ce`` is not set to ``ZERO``).
15+
* Removed output option ``RLOF_ONTO_NS`` as it can be retrieved from existing RLOF output info.
16+
1217
**03.17.00 Mar 22, 2025**
1318

14-
* Added ENVELOPE_STATE_PRESCRIPTION::CONVECTIVE_MASS_FRACTION (default threshold of convective envelope by mass to label envelope convective is 0.1, can be set with --convective-envelope-mass-threshold)
19+
* Added ``ENVELOPE_STATE_PRESCRIPTION::CONVECTIVE_MASS_FRACTION`` (default threshold of convective envelope by mass to label envelope convective is 0.1, can be set with ``--convective-envelope-mass-threshold``)
1520
* Stable mass transfer now conserves angular momentum after accounting for the rotational angular momentum lost or gained by the stars
16-
* Imposed Keplerian rotation limit on mass-gaining stars:
17-
* Response depends on the new --response-to-spin-up option
18-
* default (TRANSFER_TO_ORBIT) allows the star to accrete, but excess angular momentum is deposited in the orbit
19-
* KEPLERIAN_LIMIT forces mass transfer to become non-conservative once star (approximately) reaches super-critical rotation
20-
* while the NO_LIMIT variation allows arbitrary super-critical accretion, to match legacy choices
21+
* Imposed Keplerian rotation limit on mass-gaining stars: response depends on the new ``--response-to-spin-up`` option, with possible values:
22+
* ``TRANSFER_TO_ORBIT`` (default) allows the star to accrete, but excess angular momentum is deposited in the orbit
23+
* ``KEPLERIAN_LIMIT`` forces mass transfer to become non-conservative once star (approximately) reaches super-critical rotation
24+
* ``NO_LIMIT`` allows arbitrary super-critical accretion, to match legacy choices
2125

2226
**03.16.02 Mar 19, 2025**
2327

24-
New output options for supernova:
28+
New output options for supernova, which allow for full characterization of the binary orientation post-SN:
2529

26-
* ORBITAL_ANGULAR_MOMENTUM_VECTOR_X, ORBITAL_ANGULAR_MOMENTUM_VECTOR_Y, ORBITAL_ANGULAR_MOMENTUM_VECTOR_Z,
27-
* SYSTEMIC_VELOCITY_X, SYSTEMIC_VELOCITY_Y, SYSTEMIC_VELOCITY_Z,
28-
* These allow for full characterization of the binary orientation post-SN
30+
* ORBITAL_ANGULAR_MOMENTUM_VECTOR_X
31+
* ORBITAL_ANGULAR_MOMENTUM_VECTOR_Y
32+
* ORBITAL_ANGULAR_MOMENTUM_VECTOR_Z
33+
* SYSTEMIC_VELOCITY_X
34+
* SYSTEMIC_VELOCITY_Y
35+
* SYSTEMIC_VELOCITY_Z
2936

3037
**03.15.00 Mar 5, 2025**
3138

src/BaseBinaryStar.cpp

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2146,12 +2146,14 @@ void BaseBinaryStar::CalculateMassTransfer(const double p_Dt) {
21462146
}
21472147
}
21482148

2149-
// Check for recycled pulsars. Not considering CEE as a way of recycling NSs.
2150-
if (!m_CEDetails.CEEnow && m_Accretor->IsOneOf({ STELLAR_TYPE::NEUTRON_STAR })) { // accretor is a neutron star
2151-
m_Donor->SetRLOFOntoNS(); // donor donated mass to a neutron star
2149+
// Check for recycled pulsars. Not considering CEE as a way of recycling NSs.
2150+
if (!m_CEDetails.CEEnow && m_Accretor->IsOneOf({ STELLAR_TYPE::NEUTRON_STAR })) { // accretor is a neutron star, system is not in CE
21522151
m_Accretor->SetRecycledNS(); // accretor is (was) a recycled NS
2153-
}
2154-
2152+
}
2153+
else if (m_CEDetails.CEEnow && m_Accretor->IsOneOf({ STELLAR_TYPE::NEUTRON_STAR })
2154+
&& OPTIONS->NeutronStarAccretionInCE() != NS_ACCRETION_IN_CE::ZERO) { // accretor is a neutron star, system is in CE
2155+
m_Accretor->SetRecycledNS(); // accretor is (was) a recycled NS
2156+
}
21552157
}
21562158

21572159

@@ -2958,8 +2960,9 @@ void BaseBinaryStar::EmitGravitationalWave(const double p_Dt) {
29582960
*/
29592961
double BaseBinaryStar::ChooseTimestep(const double p_Factor) {
29602962

2961-
double dt1 = m_Star1->CalculateTimestep();
2962-
double dt2 = m_Star2->CalculateTimestep();
2963+
double dt1 = m_Star1->CalculateTimestep() * OPTIONS->TimestepMultipliers(static_cast<int>(m_Star1->StellarType()));
2964+
double dt2 = m_Star2->CalculateTimestep() * OPTIONS->TimestepMultipliers(static_cast<int>(m_Star2->StellarType()));
2965+
29632966
double dt = std::min(dt1, dt2); // dt = smaller of timesteps required by individual stars
29642967

29652968
if (!IsUnbound()) { // check that binary is bound
@@ -2970,7 +2973,13 @@ double BaseBinaryStar::ChooseTimestep(const double p_Factor) {
29702973
if ((utils::Compare(radiusToRL1 * (1.0 + 2.0 * OPTIONS->RadialChangeFraction()), 1.0) >= 0 && utils::Compare(radiusToRL1 * (1.0 + 0.5 * OPTIONS->RadialChangeFraction()), 1.0) <= 0) ||
29712974
(utils::Compare(radiusToRL2 * (1.0 + 2.0 * OPTIONS->RadialChangeFraction()), 1.0) >= 0 && utils::Compare(radiusToRL2 * (1.0 + 0.5 * OPTIONS->RadialChangeFraction()), 1.0) <= 0))
29722975
dt /= 2.0;
2973-
2976+
2977+
// limit time step for stars losing mass on nuclear timescale
2978+
if (utils::Compare(radiusToRL1 * (1.0 + 0.5 * OPTIONS->RadialChangeFraction()), 1.0) > 0)
2979+
dt = std::min(dt, 0.5 * OPTIONS->RadialChangeFraction() * m_Star1->CalculateRadialExpansionTimescaleDuringMassTransfer());
2980+
if (utils::Compare(radiusToRL2 * (1.0 + 0.5 * OPTIONS->RadialChangeFraction()), 1.0) > 0)
2981+
dt = std::min(dt, 0.5 * OPTIONS->RadialChangeFraction() * m_Star2->CalculateRadialExpansionTimescaleDuringMassTransfer());
2982+
29742983
if (OPTIONS->EmitGravitationalRadiation()) { // emitting GWs?
29752984
dt = std::min(dt, -1.0E-2 * m_SemiMajorAxis / m_DaDtGW); // yes - reduce timestep if necessary to ensure that the orbital separation does not change by more than ~1% per timestep due to GW emission
29762985
}
@@ -3009,8 +3018,7 @@ double BaseBinaryStar::ChooseTimestep(const double p_Factor) {
30093018
}
30103019
}
30113020

3012-
// apply timestep multipliers
3013-
dt *= OPTIONS->TimestepMultiplier() * (dt1 < dt2 ? OPTIONS->TimestepMultipliers(static_cast<int>(m_Star1->StellarType())) : OPTIONS->TimestepMultipliers(static_cast<int>(m_Star2->StellarType()))) * p_Factor;
3021+
dt *= OPTIONS->TimestepMultiplier() * p_Factor;
30143022

30153023
return std::max(std::round(dt / TIMESTEP_QUANTUM) * TIMESTEP_QUANTUM, TIDES_MINIMUM_FRACTIONAL_NUCLEAR_TIME * NUCLEAR_MINIMUM_TIMESTEP); // quantised and not less than minimum
30163024
}

src/BaseStar.cpp

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2569,33 +2569,6 @@ double BaseStar::CalculateMassLossRate() {
25692569
}
25702570

25712571

2572-
/*
2573-
* Calculate the nuclear mass loss rate as the mass divided by the radial expansion timescale
2574-
* We do not use CalculateRadialExpansionTimescale(), however, since in the process of mass transfer the previous radius
2575-
* is determined by binary evolution, not nuclear timescale evolution
2576-
*
2577-
*
2578-
* double CalculateNuclearMassLossRate()
2579-
*
2580-
* @return Nuclear mass loss rate
2581-
*/
2582-
double BaseStar::CalculateNuclearMassLossRate() {
2583-
2584-
// We create and age it slightly to determine how the radius will change.
2585-
// To be sure the clone does not participate in logging, we set its persistence to EPHEMERAL.
2586-
BaseStar *clone = Clone(OBJECT_PERSISTENCE::EPHEMERAL, false); // do not re-initialise the clone
2587-
2588-
double timestep = std::max(1000.0 * NUCLEAR_MINIMUM_TIMESTEP, m_Age / 1.0E6);
2589-
clone->UpdateAttributesAndAgeOneTimestep(0.0, 0.0, timestep, true, false);
2590-
double radiusAfterAging = clone->Radius();
2591-
delete clone; clone = nullptr; // return the memory allocated for the clone
2592-
2593-
double radialExpansionTimescale = timestep * m_Radius / fabs(m_Radius - radiusAfterAging);
2594-
2595-
return m_Mass / radialExpansionTimescale;
2596-
}
2597-
2598-
25992572
/*
26002573
* Calculate values for mDot and mass assuming mass loss is applied
26012574
*
@@ -3684,6 +3657,31 @@ double BaseStar::CalculateRadialExpansionTimescale_Static(const STELLAR_TYPE p_S
36843657
}
36853658

36863659

3660+
/*
3661+
* Calculate the radial expansion timescale in the mass transfer regime
3662+
* We do not use CalculateRadialExpansionTimescale(), since in the process of mass transfer the previous radius
3663+
* is determined by binary evolution, not nuclear timescale evolution
3664+
*
3665+
*
3666+
* double CalculateRadialExpansionTimescaleDuringMassTransfer()
3667+
*
3668+
* @return Radial expansion timescale
3669+
*/
3670+
double BaseStar::CalculateRadialExpansionTimescaleDuringMassTransfer() {
3671+
3672+
// We create and age it slightly to determine how the radius will change.
3673+
// To be sure the clone does not participate in logging, we set its persistence to EPHEMERAL.
3674+
BaseStar *clone = Clone(OBJECT_PERSISTENCE::EPHEMERAL, false); // do not re-initialise the clone
3675+
3676+
double timestep = std::max(1000.0 * NUCLEAR_MINIMUM_TIMESTEP, m_Age / 1.0E6);
3677+
clone->UpdateAttributesAndAgeOneTimestep(0.0, 0.0, timestep, true, false);
3678+
double radiusAfterAging = clone->Radius();
3679+
delete clone; clone = nullptr; // return the memory allocated for the clone
3680+
3681+
return timestep * m_Radius / fabs(m_Radius - radiusAfterAging);
3682+
}
3683+
3684+
36873685
/*
36883686
* Calculate mass change timescale
36893687
*

src/BaseStar.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ class BaseStar {
260260
virtual double CalculateMomentOfInertia() const { return (0.1 * (m_Mass) * m_Radius * m_Radius); } // Defaults to MS. k2 = 0.1 as defined in Hurley et al. 2000, after eq 109
261261
virtual double CalculateMomentOfInertiaAU() const { return CalculateMomentOfInertia() * RSOL_TO_AU * RSOL_TO_AU; }
262262

263-
double CalculateNuclearMassLossRate();
263+
double CalculateNuclearMassLossRate() { return m_Mass / CalculateRadialExpansionTimescaleDuringMassTransfer(); }
264264

265265
double CalculateOmegaCHE(const double p_MZAMS, const double p_Metallicity) const;
266266

@@ -270,6 +270,8 @@ class BaseStar {
270270

271271
double CalculateRadialExpansionTimescale() const { return CalculateRadialExpansionTimescale_Static(m_StellarType, m_StellarTypePrev, m_Radius, m_RadiusPrev, m_DtPrev); } // Use class member variables
272272

273+
double CalculateRadialExpansionTimescaleDuringMassTransfer();
274+
273275
virtual double CalculateRadialExtentConvectiveEnvelope() const { return 0.0; } // Default for stars with no convective envelope
274276

275277
virtual double CalculateRadiusOnMassChange(double p_dM) { return Radius(); } // NO-OP

src/BinaryConstituentStar.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ COMPAS_VARIABLE BinaryConstituentStar::StellarPropertyValue(const T_ANY_PROPERTY
7979
case ANY_STAR_PROPERTY::RADIAL_EXPANSION_TIMESCALE_POST_COMMON_ENVELOPE: value = RadialExpansionTimescalePostCEE(); break;
8080
case ANY_STAR_PROPERTY::RADIAL_EXPANSION_TIMESCALE_PRE_COMMON_ENVELOPE: value = RadialExpansionTimescalePreCEE(); break;
8181
case ANY_STAR_PROPERTY::RECYCLED_NEUTRON_STAR: value = ExperiencedRecycledNS(); break;
82-
case ANY_STAR_PROPERTY::RLOF_ONTO_NS: value = ExperiencedRLOFOntoNS(); break;
8382
case ANY_STAR_PROPERTY::TEMPERATURE_POST_COMMON_ENVELOPE: value = TemperaturePostCEE() * TSOL; break;
8483
case ANY_STAR_PROPERTY::TEMPERATURE_PRE_COMMON_ENVELOPE: value = TemperaturePreCEE() * TSOL; break;
8584
case ANY_STAR_PROPERTY::THERMAL_TIMESCALE_POST_COMMON_ENVELOPE: value = ThermalTimescalePostCEE(); break;

src/BinaryConstituentStar.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ class BinaryConstituentStar: virtual public Star {
5050
m_CEDetails.postCEE.radialExpansionTimescale = DEFAULT_INITIAL_DOUBLE_VALUE;
5151

5252
m_Flags.recycledNS = false;
53-
m_Flags.rlofOntoNS = false;
54-
53+
5554
m_MassLossDiff = DEFAULT_INITIAL_DOUBLE_VALUE;
5655
m_MassTransferDiff = DEFAULT_INITIAL_DOUBLE_VALUE;
5756

@@ -151,7 +150,6 @@ class BinaryConstituentStar: virtual public Star {
151150

152151
bool ExperiencedRecycledNS() const { return m_Flags.recycledNS; }
153152
bool ExperiencedRLOF() const { return m_RLOFDetails.experiencedRLOF; }
154-
bool ExperiencedRLOFOntoNS() const { return m_Flags.rlofOntoNS; }
155153

156154
double HeCoreMassAtCEE() const { return m_CEDetails.HeCoreMass; }
157155

@@ -196,8 +194,6 @@ class BinaryConstituentStar: virtual public Star {
196194
void ClearRecycledNS() { m_Flags.recycledNS = false; }
197195
void SetRecycledNS() { m_Flags.recycledNS = true; }
198196

199-
void ClearRLOFOntoNS() { m_Flags.rlofOntoNS = false; }
200-
void SetRLOFOntoNS() { m_Flags.rlofOntoNS = true; }
201197

202198
void CalculateCommonEnvelopeValues();
203199

@@ -248,7 +244,6 @@ class BinaryConstituentStar: virtual public Star {
248244

249245
struct FLAGS { // Miscellaneous flags
250246
bool recycledNS; // Indicate whether the accretor was a recycled neutron star
251-
bool rlofOntoNS; // Indicates whether the donor donated mass to neutron star through RLOF
252247
} m_Flags;
253248

254249
double m_MassLossDiff;

src/HG.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,14 @@ class HG: virtual public BaseStar, public GiantBranch {
9090
double CalculateHeliumAbundanceCoreOnPhase() const { return 1.0 - m_Metallicity; } // Use class member variables
9191

9292
double CalculateHeliumAbundanceSurfaceAtPhaseEnd() const { return CalculateHeliumAbundanceSurfaceOnPhase(); }
93-
double CalculateHeliumAbundanceSurfaceOnPhase() const { return m_InitialHeliumAbundance; } // Use class member variables
93+
double CalculateHeliumAbundanceSurfaceOnPhase() const { return m_HeliumAbundanceSurface; } // Use class member variables
9494

9595
double CalculateHydrogenAbundanceCoreAtPhaseEnd() const { return CalculateHydrogenAbundanceCoreOnPhase(); }
9696
double CalculateHydrogenAbundanceCoreOnPhase(const double p_Tau) const;
9797
double CalculateHydrogenAbundanceCoreOnPhase() const { return 0.0; } // Star has exhausted hydrogen in its core
9898

9999
double CalculateHydrogenAbundanceSurfaceAtPhaseEnd() const { return CalculateHydrogenAbundanceSurfaceOnPhase(); }
100-
double CalculateHydrogenAbundanceSurfaceOnPhase() const { return m_InitialHydrogenAbundance; } // Use class member variables
100+
double CalculateHydrogenAbundanceSurfaceOnPhase() const { return m_HydrogenAbundanceSurface; } // Use class member variables
101101

102102

103103

0 commit comments

Comments
 (0)