Skip to content

Commit c7182e0

Browse files
committed
Merge branch 'dev' into tides_pseudo_sync
2 parents ce60b5a + 266dc47 commit c7182e0

File tree

13 files changed

+179
-112
lines changed

13 files changed

+179
-112
lines changed

compas_python_utils/preprocessing/compasConfigDefault.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
##~!!~## COMPAS option values
2-
##~!!~## File Created Mon Oct 27 18:34:22 2025 by COMPAS v03.27.01
2+
##~!!~## File Created Tue Dec 9 15:41:35 2025 by COMPAS v03.27.02
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
@@ -29,7 +29,7 @@ booleanChoices:
2929
# --enhance-CHE-lifetimes-luminosities: True # Default: True
3030
# --expel-convective-envelope-above-luminosity-threshold: False # Default: False
3131
# --natal-kick-for-PPISN: False # Default: False
32-
# --scale-mass-loss-with-surface-helium-abundance: True # Default: True
32+
# --scale-CHE-mass-loss-with-surface-helium-abundance: True # Default: True
3333

3434
### BINARY PROPERTIES
3535
# --allow-touching-at-birth: False # Default: False # record binaries that have stars touching at birth in output files

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1319,9 +1319,9 @@ Default = DECIN2023 |br|
13191319

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

1322-
**--scale-mass-loss-with-surface-helium-abundance** |br|
1323-
Scale mass loss for main sequence, including chemically homogeneously evolving (CHE), stars with the surface helium abundance.
1324-
Transition from OB/VMS to WR mass loss towards the end of the main sequence.
1322+
**--scale-CHE-mass-loss-with-surface-helium-abundance** |br|
1323+
Scale mass loss for chemically homogeneously evolving (CHE) stars with the surface helium abundance.
1324+
Transition from OB to WR mass loss towards the end of the main sequence.
13251325
Default = TRUE
13261326

13271327
**--scale-terminal-wind-velocity-with-metallicity-power** |br|
@@ -1535,7 +1535,7 @@ Go to :ref:`the top of this page <options-props-top>` for the full alphabetical
15351535

15361536
--check-photon-tiring-limit, --cool-wind-mass-loss-multiplier, --luminous-blue-variable-prescription, --LBV-mass-loss-prescription
15371537
--luminous-blue-variable-multiplier, --main-sequence-core-mass-prescription, --mass-loss-prescription, --overall-wind-mass-loss-multiplier, --wolf-rayet-multiplier,
1538-
--expel-convective-envelope-above-luminosity-threshold, --luminosity-to-mass-threshold, --scale--mass-loss-with-surface-helium-abundance
1538+
--expel-convective-envelope-above-luminosity-threshold, --luminosity-to-mass-threshold, --scale-CHE-mass-loss-with-surface-helium-abundance
15391539
--OB-mass-loss, --OB-mass-loss-prescription, --RSG-mass-loss, --RSG-mass-loss-prescription, --VMS-mass-loss, --vms-mass-loss-prescription, --WR-mass-loss, --WR-mass-loss-prescription
15401540

15411541
--chemically-homogeneous-evolution, --chemically-homogeneous-evolution-mode

online-docs/pages/whats-new.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ 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.27.02 December 16, 2025**
7+
8+
* Fixed a bug in the assignment of kick direction angles
9+
* Undid replacement of --scale-CHE-mass-loss-with-surface-helium-abundance with the more general --scale-mass-loss-with-surface-helium-abundance (see 03.26.02)
10+
611
**03.26.02 October 27, 2025**
712

813
* Added option --USSN-kicks-override-mandel-muller ; if set to true, use user-defined USSN kicks (as a fixed value) in lieu of the Mandel & Muller kick prescription for USSNe

src/BaseBinaryStar.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2037,6 +2037,10 @@ void BaseBinaryStar::CalculateWindsMassLoss(double p_Dt) {
20372037

20382038
m_aMassLossDiff = aWinds - m_SemiMajorAxisPrev; // change to orbit (semi-major axis) due to winds mass loss
20392039
}
2040+
else { // reset total mass loss rate to zero
2041+
m_Star1->UpdateTotalMassLossRate(0.0);
2042+
m_Star2->UpdateTotalMassLossRate(0.0);
2043+
}
20402044
}
20412045
}
20422046

src/BaseStar.cpp

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -2451,11 +2451,6 @@ double BaseStar::CalculateMassLossRateBelczynski2010() {
24512451

24522452
otherWindsRate = CalculateMassLossRateOBVink2001();
24532453
m_DominantMassLossRate = MASS_LOSS_TYPE::OB;
2454-
2455-
// If user wants to transition between OB and WR mass loss rates
2456-
if (OPTIONS->ScaleMassLossWithSurfaceHeliumAbundance()) {
2457-
otherWindsRate = EnhanceWindsWithWolfRayetContribution(otherWindsRate, BaseStar::CalculateMassLossRateWolfRayetZDependent(0.0), false);
2458-
}
24592454
}
24602455

24612456
if (utils::Compare(LBVRate, otherWindsRate) > 0) { // which is dominant?
@@ -2506,18 +2501,10 @@ double BaseStar::CalculateMassLossRateMerritt2025() {
25062501
else if (utils::Compare(m_Mass, VMS_MASS_THRESHOLD) >= 0) { // mass at or above VMS winds threshold?
25072502
otherWindsRate = CalculateMassLossRateVMS(OPTIONS->VMSMassLossPrescription()); // yes - use VMS mass loss rate
25082503
m_DominantMassLossRate = MASS_LOSS_TYPE::VMS; // set dominant mass loss rate
2509-
// If user wants to transition between OB/VMS and WR mass loss rates
2510-
if (OPTIONS->ScaleMassLossWithSurfaceHeliumAbundance()) {
2511-
otherWindsRate = EnhanceWindsWithWolfRayetContribution(otherWindsRate, 0.0, true);
2512-
}
25132504
}
25142505
else { // otherwise...
25152506
otherWindsRate = CalculateMassLossRateOB(OPTIONS->OBMassLossPrescription()); // use OB mass loss rate
25162507
m_DominantMassLossRate = MASS_LOSS_TYPE::OB; // set dominant mass loss rate
2517-
// If user wants to transition between OB and WR mass loss rates
2518-
if (OPTIONS->ScaleMassLossWithSurfaceHeliumAbundance()) {
2519-
otherWindsRate = EnhanceWindsWithWolfRayetContribution(otherWindsRate, 0.0, true);
2520-
}
25212508
}
25222509

25232510
if (utils::Compare(LBVRate, otherWindsRate) > 0) { // which is dominant?
@@ -2529,69 +2516,6 @@ double BaseStar::CalculateMassLossRateMerritt2025() {
25292516
}
25302517

25312518

2532-
/*
2533-
* EnhanceWindsWithWolfRayetContribution
2534-
*
2535-
* Enhance the winds with a contribution due to WR finds (see CalculateMassLossFractionWR)
2536-
*
2537-
* double EnhanceWindsWithWolfRayetContribution (double p_OtherWindsRate, double p_WolfRayetRate, bool p_RecalculateWolfRayetRate)
2538-
*
2539-
* @param p_OtherWindsRate Wind mass loss rate due to OB or VMS winds to avoid recompution
2540-
* @param p_WolfRayetRate Wind mass loss rate due to WR winds if already computed
2541-
* @param p_RecalculateWolfRayetRate If true, recompute the WR winds by cloning the star as a HeMS star
2542-
* @return Total wind mass loss rate
2543-
*/
2544-
double BaseStar::EnhanceWindsWithWolfRayetContribution (double p_OtherWindsRate, double p_WolfRayetRate, bool p_RecalculateWolfRayetRate) {
2545-
2546-
double MdotWR = p_WolfRayetRate;
2547-
double fractionWR = CalculateMassLossFractionWR(m_HeliumAbundanceSurface);
2548-
double totalWindsRate = 0.0;
2549-
2550-
if (p_RecalculateWolfRayetRate && fractionWR > 0.0 ) {
2551-
MdotWR = BaseStar::CalculateMassLossRateWolfRayetZDependent(0.0);
2552-
// *Jeff* This used to clone the star as a HeMS star and query its CalculateMassLossRateMerritt2025(); eventually, let's switch to a static function to calculate the luminosity of the WR star
2553-
}
2554-
2555-
// Combine each of these prescriptions according to the OB wind fraction
2556-
totalWindsRate = ((1.0 - fractionWR) * p_OtherWindsRate) + (fractionWR * MdotWR);
2557-
2558-
if ( fractionWR * MdotWR > (1.0 - fractionWR) * p_OtherWindsRate) {
2559-
m_DominantMassLossRate =MASS_LOSS_TYPE::WR;
2560-
}
2561-
2562-
return totalWindsRate;
2563-
}
2564-
2565-
/*
2566-
* CalculateMassLossFractionWR
2567-
*
2568-
* @brief
2569-
* Calculate the fraction of mass loss attributable to WR mass loss, per Yoon et al. 2006
2570-
*
2571-
* The model described in Yoon et al. 2006 (also Szecsi et al. 2015) uses OB mass loss while the
2572-
* He surface abundance is below 0.55, WR mass loss when the surface He abundance is above 0.7,
2573-
* and linearly interpolate when the He surface abundance is between those limits.
2574-
*
2575-
* This function calculates the fraction of mass loss attributable to OB mass loss, based on
2576-
* the He surface abundance and the abundance limits described in Yoon et al. 2006. The value
2577-
* returned will be 1.0 if 100% of the mass loss is attributable to OB mass lass, 0.0 if 100% of
2578-
* the mass loss is attributable to WR mass loss, and in the range (0.0, 1.0) if the mass loss is
2579-
* a mix of OB and WR.
2580-
*
2581-
*
2582-
* double CalculateMassLossFractionWR(const double p_HeAbundanceSurface) const
2583-
*
2584-
* @param p_HeAbundanceSurface Helium abundance at the surface of the star
2585-
* @return Fraction of mass loss attributable to WR mass loss
2586-
*/
2587-
double BaseStar::CalculateMassLossFractionWR(const double p_HeAbundanceSurface) const {
2588-
2589-
constexpr double limOB = 0.55; // per Yoon et al. 2006
2590-
constexpr double limWR = 0.70; // per Yoon et al. 2006
2591-
2592-
return std::min(1.0, std::max (0.0, (p_HeAbundanceSurface - limOB) / (limWR - limOB)));
2593-
}
2594-
25952519
/*
25962520
* Calculate mass loss rate
25972521
*

src/BaseStar.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -615,8 +615,6 @@ class BaseStar {
615615
double CalculateMassLossRateWolfRayetTemperatureCorrectionSander2023(const double p_Mdot) const;
616616
double CalculateMassLossRateHeliumStarVink2017() const;
617617
virtual double CalculateMassLossRateWolfRayetShenar2019() const;
618-
619-
double CalculateMassLossFractionWR(const double p_HeAbundanceSurface) const;
620618

621619
virtual double CalculateMassTransferRejuvenationFactor() { return 1.0; }
622620

@@ -692,7 +690,6 @@ class BaseStar {
692690
const double p_Rand,
693691
const double p_EjectaMass,
694692
const double p_RemnantMass);
695-
double EnhanceWindsWithWolfRayetContribution (double p_OtherWindsRate, double p_WolfRayetRate, bool p_RecalculateWolfRayetRate);
696693

697694
virtual void EvolveOneTimestepPreamble() { }; // Default is NO-OP
698695

src/CH.cpp

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,134 @@ void CH::UpdateAgeAfterMassLoss() {
285285
}
286286

287287

288+
/*
289+
* CalculateMassLossFractionOB
290+
*
291+
* @brief
292+
* Calculate the fraction of mass loss attributable to OB mass loss, per Yoon et al. 2006
293+
*
294+
* The model described in Yoon et al. 2006 (also Szecsi et al. 2015) uses OB mass loss while the
295+
* He surface abundance is below 0.55, WR mass loss when the surface He abundance is above 0.7,
296+
* and linearly interpolate when the He surface abundance is between those limits.
297+
*
298+
* This function calculates the fraction of mass loss attributable to OB mass loss, based on
299+
* the He surface abundance and the abundance limits described in Yoon et al. 2006. The value
300+
* returned will be 1.0 if 100% of the mass loss is attributable to OB mass lass, 0.0 if 100% of
301+
* the mass loss is attributable to WR mass loss, and in the range (0.0, 1.0) if the mass loss is
302+
* a mix of OB and WR.
303+
*
304+
*
305+
* double CalculateMassLossFractionOB(const double p_HeAbundanceSurface) const
306+
*
307+
* @param p_HeAbundanceSurface Helium abundance at the surface of the star
308+
* @return Fraction of mass loss attributable to OB mass loss
309+
*/
310+
double CH::CalculateMassLossFractionOB(const double p_HeAbundanceSurface) const {
311+
312+
constexpr double limOB = 0.55; // per Yoon et al. 2006
313+
constexpr double limWR = 0.70; // per Yoon et al. 2006
314+
315+
return std::min(1.0, std::max (0.0, (limWR - p_HeAbundanceSurface) / (limWR - limOB)));
316+
}
317+
318+
319+
/*
320+
* Calculate the dominant mass loss mechanism and associated rate for the star
321+
* at the current evolutionary phase
322+
*
323+
* According to Belczynski et al. 2010 prescription - based on implementation in StarTrack
324+
*
325+
* Modifications for CH stars
326+
*
327+
* double CalculateMassLossRateBelczynski2010()
328+
*
329+
* @return Mass loss rate in Msol per year
330+
*/
331+
double CH::CalculateMassLossRateBelczynski2010() {
332+
333+
// Define variables
334+
double Mdot = 0.0;
335+
double MdotOB = 0.0;
336+
double MdotWR = 0.0;
337+
double fractionOB = 1.0; // Initialised to 1.0 to allow us to use the OB mass loss rate by default
338+
339+
// Calculate OB mass loss rate according to the Vink et al. formalism
340+
MdotOB = BaseStar::CalculateMassLossRateBelczynski2010();
341+
342+
// If user wants to transition between OB and WR mass loss rates
343+
if (OPTIONS->ScaleCHEMassLossWithSurfaceHeliumAbundance()) {
344+
345+
// Calculate WR mass loss rate
346+
MdotWR = BaseStar::CalculateMassLossRateWolfRayetZDependent(0.0);
347+
348+
// Calculate fraction for combining these into total mass-loss rate
349+
fractionOB = CalculateMassLossFractionOB(m_HeliumAbundanceSurface);
350+
351+
}
352+
353+
// Finally, combine each of these prescriptions according to the OB wind fraction
354+
Mdot = (fractionOB * MdotOB) + ((1.0 - fractionOB) * MdotWR);
355+
356+
// Set dominant mass loss rate
357+
m_DominantMassLossRate = (fractionOB * MdotOB) > ((1.0 - fractionOB) * MdotWR) ? MASS_LOSS_TYPE::OB : MASS_LOSS_TYPE::WR;
358+
359+
// Enhance mass loss rate due to rotation
360+
Mdot *= CalculateMassLossRateEnhancementRotation();
361+
362+
return Mdot;
363+
}
364+
365+
366+
/*
367+
* Calculate the dominant mass loss mechanism and associated rate for the star
368+
* at the current evolutionary phase
369+
*
370+
* According to Merritt et al. 2024 prescription
371+
*
372+
* Modifications for CH stars
373+
*
374+
* double CalculateMassLossRateMerritt2025()
375+
*
376+
* @return Mass loss rate in Msol per year
377+
*/
378+
double CH::CalculateMassLossRateMerritt2025() {
379+
380+
// Define variables
381+
double Mdot = 0.0;
382+
double MdotOB = 0.0;
383+
double MdotWR = 0.0;
384+
double fractionOB = 1.0; // Initialised to 1.0 to allow us to use the OB mass loss rate by default
385+
386+
// Calculate OB mass loss rate according to the chosen prescription
387+
MdotOB = BaseStar::CalculateMassLossRateOB(OPTIONS->OBMassLossPrescription());
388+
389+
// If user wants to transition between OB and WR mass loss rates
390+
if (OPTIONS->ScaleCHEMassLossWithSurfaceHeliumAbundance()) {
391+
392+
// Here we are going to pretend that this CH star is an HeMS star by
393+
// cloning it, so that we can ask it what its mass loss rate would be if it were
394+
// a HeMS star
395+
HeMS *clone = HeMS::Clone((HeMS&)static_cast<const CH&>(*this), OBJECT_PERSISTENCE::EPHEMERAL, false); // Do not initialise so that we can use same mass, luminosity, radius etc
396+
MdotWR = clone->CalculateMassLossRateMerritt2025(); // Calculate WR mass loss rate
397+
delete clone; clone = nullptr; // return the memory allocated for the clone
398+
399+
// Calculate weight for combining these into total mass-loss rate
400+
fractionOB = CalculateMassLossFractionOB(m_HeliumAbundanceSurface);
401+
}
402+
403+
// Finally, combine each of these prescriptions according to the OB wind fraction
404+
Mdot = (fractionOB * MdotOB) + ((1.0 - fractionOB) * MdotWR);
405+
406+
// Set dominant mass loss rate
407+
m_DominantMassLossRate = (fractionOB * MdotOB) > ((1.0 - fractionOB) * MdotWR) ? MASS_LOSS_TYPE::OB : MASS_LOSS_TYPE::WR;
408+
409+
// Enhance mass loss rate due to rotation
410+
Mdot *= CalculateMassLossRateEnhancementRotation();
411+
412+
return Mdot;
413+
}
414+
415+
288416
STELLAR_TYPE CH::EvolveToNextPhase() {
289417

290418
STELLAR_TYPE stellarType = STELLAR_TYPE::MS_GT_07;

src/CH.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include "BaseStar.h"
1010
#include "MS_gt_07.h"
11+
#include "HeMS.h"
1112

1213
class BaseStar;
1314
class MS_gt_07;
@@ -68,11 +69,12 @@ class CH: virtual public BaseStar, public MS_gt_07 {
6869
double CalculateLuminosityAtPhaseEnd() const { return CalculateLuminosityAtPhaseEnd(m_Mass0); } // Use class member variables
6970

7071
double CalculateLuminosityOnPhase(const double p_Time, const double p_Mass, const double p_LZAMS) const;
71-
double CalculateLuminosityOnPhase() const { return m_Luminosity; }
72+
double CalculateLuminosityOnPhase() const { return CalculateLuminosityOnPhase(m_Age, m_Mass0, m_LZAMS0); }
7273

7374
// Mass loss rate
74-
double CalculateMassLossRateBelczynski2010() { return BaseStar::CalculateMassLossRateBelczynski2010() * CalculateMassLossRateEnhancementRotation(); }
75-
double CalculateMassLossRateMerritt2025() { return BaseStar::CalculateMassLossRateBelczynski2010() * CalculateMassLossRateEnhancementRotation(); }
75+
double CalculateMassLossRateBelczynski2010();
76+
double CalculateMassLossRateMerritt2025();
77+
double CalculateMassLossFractionOB(const double p_HeAbundanceSurface) const;
7678

7779
// Radius
7880
double CalculateRadiusOnPhase() const { return m_RZAMS; } // Constant from birth

0 commit comments

Comments
 (0)