Skip to content

Commit 3661fa9

Browse files
author
Ilya Mandel
committed
Partial commit
1 parent ac979fd commit 3661fa9

File tree

9 files changed

+124
-149
lines changed

9 files changed

+124
-149
lines changed

src/BaseStar.cpp

Lines changed: 84 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2448,8 +2448,14 @@ double BaseStar::CalculateMassLossRateBelczynski2010() {
24482448
otherWindsRate = CalculateMassLossRateHurley() * OPTIONS->CoolWindMassLossMultiplier(); // apply cool wind mass loss multiplier
24492449
}
24502450
else { // hot stars, add Vink et al. 2001 winds (ignoring bistability jump)
2451+
24512452
otherWindsRate = CalculateMassLossRateOBVink2001();
2452-
m_DominantMassLossRate = MASS_LOSS_TYPE::OB; // set dominant mass loss rate
2453+
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+
}
24532459
}
24542460

24552461
if (utils::Compare(LBVRate, otherWindsRate) > 0) { // which is dominant?
@@ -2499,11 +2505,19 @@ double BaseStar::CalculateMassLossRateMerritt2025() {
24992505
}
25002506
else if (utils::Compare(m_Mass, VMS_MASS_THRESHOLD) >= 0) { // mass at or above VMS winds threshold?
25012507
otherWindsRate = CalculateMassLossRateVMS(OPTIONS->VMSMassLossPrescription()); // yes - use VMS mass loss rate
2502-
m_DominantMassLossRate = MASS_LOSS_TYPE::VMS; // set dominant mass loss rate
2508+
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+
}
25032513
}
25042514
else { // otherwise...
25052515
otherWindsRate = CalculateMassLossRateOB(OPTIONS->OBMassLossPrescription()); // use OB mass loss rate
25062516
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+
}
25072521
}
25082522

25092523
if (utils::Compare(LBVRate, otherWindsRate) > 0) { // which is dominant?
@@ -2515,6 +2529,72 @@ double BaseStar::CalculateMassLossRateMerritt2025() {
25152529
}
25162530

25172531

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 have the code below instead; I'd prefer a static function to calculate the luminosity of the WR star.
2553+
//HeMS *clone = HeMS::Clone((HeMS&)static_cast<const MainSequence&>(*this), OBJECT_PERSISTENCE::EPHEMERAL, false); // Do not initialise so that we can use same mass, luminosity, radius etc
2554+
//MdotWR = clone->CalculateMassLossRateMerritt2025(); // Calculate WR mass loss rate
2555+
//delete clone; clone = nullptr; // return the memory allocated for the clone
2556+
}
2557+
2558+
// Combine each of these prescriptions according to the OB wind fraction
2559+
totalWindsRate = ((1.0 - fractionWR) * p_OtherWindsRate) + (fractionWR * MdotWR);
2560+
2561+
if ( fractionWR * MdotWR > (1.0 - fractionWR) * p_OtherWindsRate) {
2562+
m_DominantMassLossRate =MASS_LOSS_TYPE::WR;
2563+
}
2564+
2565+
return totalWindsRate;
2566+
}
2567+
2568+
/*
2569+
* CalculateMassLossFractionWR
2570+
*
2571+
* @brief
2572+
* Calculate the fraction of mass loss attributable to WR mass loss, per Yoon et al. 2006
2573+
*
2574+
* The model described in Yoon et al. 2006 (also Szecsi et al. 2015) uses OB mass loss while the
2575+
* He surface abundance is below 0.55, WR mass loss when the surface He abundance is above 0.7,
2576+
* and linearly interpolate when the He surface abundance is between those limits.
2577+
*
2578+
* This function calculates the fraction of mass loss attributable to OB mass loss, based on
2579+
* the He surface abundance and the abundance limits described in Yoon et al. 2006. The value
2580+
* returned will be 1.0 if 100% of the mass loss is attributable to OB mass lass, 0.0 if 100% of
2581+
* the mass loss is attributable to WR mass loss, and in the range (0.0, 1.0) if the mass loss is
2582+
* a mix of OB and WR.
2583+
*
2584+
*
2585+
* double CalculateMassLossFractionWR(const double p_HeAbundanceSurface) const
2586+
*
2587+
* @param p_HeAbundanceSurface Helium abundance at the surface of the star
2588+
* @return Fraction of mass loss attributable to WR mass loss
2589+
*/
2590+
double BaseStar::CalculateMassLossFractionWR(const double p_HeAbundanceSurface) const {
2591+
2592+
constexpr double limOB = 0.55; // per Yoon et al. 2006
2593+
constexpr double limWR = 0.70; // per Yoon et al. 2006
2594+
2595+
return std::min(1.0, std::max (0.0, (p_HeAbundanceSurface - limOB) / (limWR - limOB)));
2596+
}
2597+
25182598
/*
25192599
* Calculate mass loss rate
25202600
*
@@ -3849,7 +3929,8 @@ double BaseStar::DrawRemnantKickMullerMandel(const double p_COCoreMass,
38493929
double rand = quantile0 + p_Rand * (1.0 - quantile0);
38503930
remnantKick = muKick * (1.0 + gsl_cdf_gaussian_Pinv(rand, sigmaKick));
38513931

3852-
if (utils::SNEventType(m_SupernovaDetails.events.current) == SN_EVENT::USSN ) { // overwrite USSN kick prescription
3932+
// Mandel * Mueller 2020 call for USSN kicks to be treated in the same way as CCSN kicks; however, if this override flag is set, set the USSN kick to be equal to the user-provided magnitude
3933+
if (utils::SNEventType(m_SupernovaDetails.events.current) == SN_EVENT::USSN && OPTIONS->USSNKicksOverrideMandelMuller() ) {
38533934
remnantKick = OPTIONS->KickMagnitudeDistributionSigmaForUSSN();
38543935
}
38553936

src/BaseStar.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,8 @@ 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;
618620

619621
virtual double CalculateMassTransferRejuvenationFactor() { return 1.0; }
620622

@@ -691,7 +693,8 @@ class BaseStar {
691693
const double p_Rand,
692694
const double p_EjectaMass,
693695
const double p_RemnantMass);
694-
696+
double EnhanceWindsWithWolfRayetContribution (double p_OtherWindsRate, double p_WolfRayetRate, bool p_RecalculateWolfRayetRate);
697+
695698
virtual void EvolveOneTimestepPreamble() { }; // Default is NO-OP
696699

697700
STELLAR_TYPE EvolveOnPhase(const double p_DeltaTime);

src/CH.cpp

Lines changed: 0 additions & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -285,134 +285,6 @@ 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-
416288
STELLAR_TYPE CH::EvolveToNextPhase() {
417289

418290
STELLAR_TYPE stellarType = STELLAR_TYPE::MS_GT_07;

src/CH.h

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

99
#include "BaseStar.h"
1010
#include "MS_gt_07.h"
11-
#include "HeMS.h"
1211

1312
class BaseStar;
1413
class MS_gt_07;
@@ -72,9 +71,8 @@ class CH: virtual public BaseStar, public MS_gt_07 {
7271
double CalculateLuminosityOnPhase() const { return m_Luminosity; }
7372

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

7977
// Radius
8078
double CalculateRadiusOnPhase() const { return m_RZAMS; } // Constant from birth

src/LogTypedefs.h

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,7 +1003,7 @@ enum class PROGRAM_OPTION: int {
10031003
ROTATIONAL_FREQUENCY_1,
10041004
ROTATIONAL_FREQUENCY_2,
10051005

1006-
SCALE_CHE_MASS_LOSS_SURF_HE_ABUNDANCE,
1006+
SCALE_MASS_LOSS_SURF_HE_ABUNDANCE,
10071007
SCALE_TERMINAL_WIND_VEL_METALLICITY_POWER,
10081008
SEMI_MAJOR_AXIS,
10091009
SEMI_MAJOR_AXIS_DISTRIBUTION,
@@ -1013,6 +1013,8 @@ enum class PROGRAM_OPTION: int {
10131013
STELLAR_ZETA_PRESCRIPTION,
10141014

10151015
TIDES_PRESCRIPTION,
1016+
1017+
USSN_KICKS_OVERRIDE_MANDEL_MULLER,
10161018

10171019
WR_FACTOR,
10181020

@@ -1231,8 +1233,8 @@ const COMPASUnorderedMap<PROGRAM_OPTION, std::string> PROGRAM_OPTION_LABEL = {
12311233
{ PROGRAM_OPTION::ROTATIONAL_FREQUENCY_1, "ROTATIONAL_FREQUENCY_1" },
12321234
{ PROGRAM_OPTION::ROTATIONAL_FREQUENCY_2, "ROTATIONAL_FREQUENCY_2" },
12331235

1234-
{ PROGRAM_OPTION::SCALE_CHE_MASS_LOSS_SURF_HE_ABUNDANCE, "SCALE_CHE_MASS_LOSS_SURF_HE_ABUNDANCE" },
1235-
{ PROGRAM_OPTION::SCALE_TERMINAL_WIND_VEL_METALLICITY_POWER, "SCALE_TERMINAL_WIND_VEL_METALLICITY_POWER" },
1236+
{ PROGRAM_OPTION::SCALE_MASS_LOSS_SURF_HE_ABUNDANCE, "SCALE_MASS_LOSS_SURF_HE_ABUNDANCE" },
1237+
{ PROGRAM_OPTION::SCALE_TERMINAL_WIND_VEL_METALLICITY_POWER, "SCALE_TERMINAL_WIND_VEL_METALLICITY_POWER" },
12361238
{ PROGRAM_OPTION::SEMI_MAJOR_AXIS, "SEMI_MAJOR_AXIS" },
12371239
{ PROGRAM_OPTION::SEMI_MAJOR_AXIS_DISTRIBUTION, "SEMI_MAJOR_AXIS_DISTRIBUTION" },
12381240
{ PROGRAM_OPTION::SEMI_MAJOR_AXIS_DISTRIBUTION_MAX, "SEMI_MAJOR_AXIS_DISTRIBUTION_MAX" },
@@ -1241,6 +1243,8 @@ const COMPASUnorderedMap<PROGRAM_OPTION, std::string> PROGRAM_OPTION_LABEL = {
12411243
{ PROGRAM_OPTION::STELLAR_ZETA_PRESCRIPTION, "STELLAR_ZETA_PRESCRIPTION" },
12421244

12431245
{ PROGRAM_OPTION::TIDES_PRESCRIPTION, "TIDES_PRESCRIPTION" },
1246+
1247+
{ PROGRAM_OPTION::USSN_KICKS_OVERRIDE_MANDEL_MULLER, "USSN_KICKS_OVERRIDE_MANDEL_MULLER" },
12441248

12451249
{ PROGRAM_OPTION::WR_FACTOR, "WR_FACTOR" },
12461250

@@ -1822,7 +1826,7 @@ const std::map<PROGRAM_OPTION, PROPERTY_DETAILS> PROGRAM_OPTION_DETAIL = {
18221826
{ PROGRAM_OPTION::ROTATIONAL_FREQUENCY_1, { TYPENAME::DOUBLE, "PO_Rotational_Frequency(1)", "Hz", 24, 15}},
18231827
{ PROGRAM_OPTION::ROTATIONAL_FREQUENCY_2, { TYPENAME::DOUBLE, "PO_Rotational_Frequency(2)", "Hz", 24, 15}},
18241828

1825-
{ PROGRAM_OPTION::SCALE_CHE_MASS_LOSS_SURF_HE_ABUNDANCE, { TYPENAME::BOOL, "PO_Scale_CHE_Mass_Loss_Surf_He_Abundance", "flag", 0, 0}},
1829+
{ PROGRAM_OPTION::SCALE_MASS_LOSS_SURF_HE_ABUNDANCE, { TYPENAME::BOOL, "PO_Scale_Mass_Loss_Surf_He_Abundance", "flag", 0, 0}},
18261830
{ PROGRAM_OPTION::SCALE_TERMINAL_WIND_VEL_METALLICITY_POWER, { TYPENAME::DOUBLE, "PO_Scale_Terminal_Wind_Vel_Metallicity_Power", "-", 24, 15}},
18271831
{ PROGRAM_OPTION::SEMI_MAJOR_AXIS, { TYPENAME::DOUBLE, "PO_Semi-Major_Axis", "AU", 24, 15}},
18281832
{ PROGRAM_OPTION::SEMI_MAJOR_AXIS_DISTRIBUTION, { TYPENAME::INT, "PO_Semi-Major_Axis_Dstrbtn", "-", 4, 1 }},
@@ -1832,6 +1836,8 @@ const std::map<PROGRAM_OPTION, PROPERTY_DETAILS> PROGRAM_OPTION_DETAIL = {
18321836
{ PROGRAM_OPTION::STELLAR_ZETA_PRESCRIPTION, { TYPENAME::INT, "PO_Stellar_Zeta_Prscrptn", "-", 4, 1 }},
18331837

18341838
{ PROGRAM_OPTION::TIDES_PRESCRIPTION, { TYPENAME::INT, "PO_Tides_Prscrptn", "-", 4, 1 }},
1839+
1840+
{ PROGRAM_OPTION::USSN_KICKS_OVERRIDE_MANDEL_MULLER, { TYPENAME::BOOL, "PO_USSN_Kicks_Override_Mandel_Muller", "flag", 0, 0}},
18351841

18361842
{ PROGRAM_OPTION::WR_FACTOR, { TYPENAME::DOUBLE, "PO_WR_Factor", "-", 24, 15}},
18371843

0 commit comments

Comments
 (0)