Skip to content

Commit d3790b5

Browse files
author
Ilya Mandel
committed
Corrected errors in combining OB and WR winds in CH::CalculateMassLossRateBelczynski2010() and CH::CalculateMassLossRateFractionOB() [previously CalculateMassLossRateWeightOB()]
1 parent 6557a80 commit d3790b5

File tree

3 files changed

+30
-32
lines changed

3 files changed

+30
-32
lines changed

src/CH.cpp

Lines changed: 27 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -286,36 +286,33 @@ void CH::UpdateAgeAfterMassLoss() {
286286

287287

288288
/*
289-
* Calculate the weight for the OB and WR mass loss prescriptions
289+
* CalculateMassLossFractionOB
290290
*
291-
* According to the prescription described in Yoon et al. 2006 (and Szecsi et al. 2015)
292-
* Use OB mass loss rates until Y1 = 0.55, WR mass loss rates above Y2 = 0.7, and
293-
* linearly interpolate for Y1 < Ys < Y2 where Ys is the surface helium fraction.
294-
*
295-
* Since we don't have Ys by default in our models, and detailed models show Ys
296-
* rises ~linearly from 0.2 to 1.0 across the main-sequence, here we simply
297-
* use tau = t / tMS as a proxy for Ys.
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.
298303
*
299-
* CalculateMassLossRateWeightOB(const double p_HeliumAbundanceSurface)
300304
*
301-
* @param [IN] p_HeliumAbundanceSurface Surface helium abundance Ys
305+
* double CalculateMassLossFractionOB(const double p_HeAbundanceSurface) const
302306
*
303-
* @return weight for OB mass loss rate
307+
* @param p_HeAbundanceSurface Helium abundance at the surface of the star
308+
* @return Fraction of mass loss attributable to OB mass loss
304309
*/
305-
double CH::CalculateMassLossRateWeightOB(const double p_HeliumAbundanceSurface) {
310+
double CH::CalculateMassLossFractionOB(const double p_HeAbundanceSurface) const {
306311

307-
const double y1 = 0.55;
308-
const double y2 = 0.70;
309-
double Ys = p_HeliumAbundanceSurface; // Get surface helium abundance
310-
double weight = 0.0;
312+
constexpr double limOB = 0.55; // per Yoon et al. 2006
313+
constexpr double limWR = 0.70; // per Yoon et al. 2006
311314

312-
313-
// Calculate the weight as a function of Ys according to the prescription from Yoon et al. 2006
314-
if (Ys < y1) weight = 1.0;
315-
else if (Ys > y2) weight = 0.0;
316-
else weight = (y2 - Ys) / y2 - y1;
317-
318-
return weight;
315+
return std::min(1.0, std::max (0.0, (limWR - p_HeAbundanceSurface) / (limWR - limOB)));
319316
}
320317

321318

@@ -337,7 +334,7 @@ double CH::CalculateMassLossRateBelczynski2010() {
337334
double Mdot = 0.0;
338335
double MdotOB = 0.0;
339336
double MdotWR = 0.0;
340-
double weight = 1.0; // Initialised to 1.0 to allow us to use the OB mass loss rate by default
337+
double fractionOB = 1.0; // Initialised to 1.0 to allow us to use the OB mass loss rate by default
341338

342339
// Calculate OB mass loss rate according to the Vink et al. formalism
343340
MdotOB = BaseStar::CalculateMassLossRateBelczynski2010();
@@ -348,16 +345,16 @@ double CH::CalculateMassLossRateBelczynski2010() {
348345
// Calculate WR mass loss rate
349346
MdotWR = BaseStar::CalculateMassLossRateWolfRayetZDependent(0.0);
350347

351-
// Calculate weight for combining these into total mass-loss rate
352-
weight = CalculateMassLossRateWeightOB(m_HeliumAbundanceSurface);
348+
// Calculate fraction for combining these into total mass-loss rate
349+
fractionOB = CalculateMassLossRateFractionOB(m_HeliumAbundanceSurface);
353350

354351
}
355352

353+
// Finally, combine each of these prescriptions according to the OB wind fraction
354+
Mdot = (fractionOB * MdotOB) + ((1.0 - fractionOB) * MdotWR);
355+
356356
// Set dominant mass loss rate
357-
m_DominantMassLossRate = weight == 0 ? MASS_LOSS_TYPE::WR : MASS_LOSS_TYPE::OB;
358-
359-
// Finally, combine each of these prescriptions according to the weight
360-
Mdot = (weight * MdotOB) + ((1.0 - weight) * MdotWR);
357+
m_DominantMassLossRate = (fractionOB * MdotOB) > ((1.0 - fractionOB) * MdotWR) ? MASS_LOSS_TYPE::OB : MASS_LOSS_TYPE::WR;
361358

362359
// Enhance mass loss rate due to rotation
363360
Mdot *= CalculateMassLossRateEnhancementRotation();

src/CH.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class CH: virtual public BaseStar, public MS_gt_07 {
7474
// Mass loss rate
7575
double CalculateMassLossRateBelczynski2010();
7676
double CalculateMassLossRateMerritt2025();
77-
double CalculateMassLossRateWeightOB(const double p_HeliumAbundanceSurface);
77+
double CalculateMassLossRateFractionOB(const double p_HeliumAbundanceSurface);
7878

7979
// Radius
8080
double CalculateRadiusOnPhase() const { return m_RZAMS; } // Constant from birth

src/changelog.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1664,8 +1664,9 @@
16641664
// - Corrected calculation for Hurley Gamma constant C (C_GAMMA - see Hurley et al. 2000, just after eq 23, should use a(75) <= 1.0, not a(75) == 1.0 - confirmed in BSE Fortran source)
16651665
// - Added abs() to gamma calculation in Mainsequence.cpp::CalculateGamma() (per BSE Fortran source)
16661666
// - Clamped gamma to [0.0, gamma] in Mainsequence.cpp::CalculateGamma() (per discussion just after eq 23 - confirmed in BSE Fortran source)
1667-
// 03.26.00 IM - September 2, 2025 - Enhancement:
1667+
// 03.26.00 IM - September 2, 2025 - Enhancement, defect repairs:
16681668
// - First (simplified) implementation of the Lau+ (2024) Hamstars thermally limited accretion prescription
1669+
// - Corrected errors in combining OB and WR winds in CH::CalculateMassLossRateBelczynski2010() and CH::CalculateMassLossRateFractionOB() [previously CalculateMassLossRateWeightOB()]
16691670
//
16701671
// Version string format is MM.mm.rr, where
16711672
//

0 commit comments

Comments
 (0)