Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions src/BaseBinaryStar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2546,11 +2546,6 @@ void BaseBinaryStar::CalculateMassTransfer(const double p_Dt) {
bool isEnvelopeRemoved = false;

if (utils::Compare(m_Donor->CoreMass(), 0.0) > 0 && utils::Compare(envMassDonor, 0.0) > 0) { // donor has a core and an envelope
if (m_MassTransferTimescale == MT_TIMESCALE::THERMAL || utils::Compare (massDiffDonor, envMassDonor) >= 0) {
// remove entire envelope if thermal timescale MT from a giant or if the amount of necessary mass loss exceeds the envelope mass
massDiffDonor = -envMassDonor;
isEnvelopeRemoved = true;
}
if (m_MassTransferTimescale == MT_TIMESCALE::THERMAL && OPTIONS->ExpelConvectiveEnvelopeAboveLuminosityThreshold() && m_Donor->DetermineEnvelopeType() == ENVELOPE::CONVECTIVE) {
// check if pulsations remove envelope in the middle of mass transfer; if so, only remove envelope up to that point during mass transfer, leave pulsation itself to next time step
double massPulsation = m_Donor->Luminosity() / PPOW(10.0, OPTIONS->LuminosityToMassThreshold()); // mass at which the pulsation threshold would be passed, log_10 (L/M) = LuminosityToMassThreshold, assumes unchanged L
Expand All @@ -2559,9 +2554,13 @@ void BaseBinaryStar::CalculateMassTransfer(const double p_Dt) {
isEnvelopeRemoved = false;
}
}

else if (m_MassTransferTimescale == MT_TIMESCALE::THERMAL || utils::Compare (massDiffDonor, envMassDonor) >= 0) {
// remove entire envelope if thermal timescale MT from a giant or if the amount of necessary mass loss exceeds the envelope mass
massDiffDonor = -envMassDonor;
isEnvelopeRemoved = true;
}
else
massDiffDonor = -massDiffDonor; // set mass difference
massDiffDonor = -massDiffDonor; // set mass difference if only part of enevelope removed
}
else { // donor has no envelope
if (massDiffDonor <= 0.0) { // no root found
Expand Down
2 changes: 1 addition & 1 deletion src/GiantBranch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2247,7 +2247,7 @@ STELLAR_TYPE GiantBranch::ResolveSupernova() {
double snMass = CalculateInitialSupernovaMass(); // calculate SN initial mass

SetSNHydrogenContent(); // set H-rich or H-poor JR: why don't we do this when we initialise the star at change of stellar type?

if ( OPTIONS->UsePulsationalPairInstability() &&
utils::Compare(m_HeCoreMass, OPTIONS->PulsationalPairInstabilityLowerLimit()) >= 0 &&
utils::Compare(m_HeCoreMass, OPTIONS->PulsationalPairInstabilityUpperLimit()) <= 0) { // Pulsational Pair Instability Supernova
Expand Down
15 changes: 11 additions & 4 deletions src/HeHG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,8 +410,8 @@ double HeHG::ChooseTimestep(const double p_Time) const {
bool HeHG::ShouldEvolveOnPhase() const {

double McMax = CalculateMaximumCoreMass(m_Mass);
double McSN = CalculateCoreMassAtSupernova_Static(MECS, m_GBParams[static_cast<int>(GBP::McBAGB)]);
return ((utils::Compare(m_COCoreMass, McMax) <= 0 || utils::Compare(McMax, McSN) >= 0) && !ShouldEnvelopeBeExpelledByPulsations()); // Evolve on HeHG phase if McCO <= McMax or McMax >= McSN and envelope is not ejected by pulsations
double McSN = CalculateCoreMassAtSupernova_Static(MCH, m_Mass);
return ((utils::Compare(m_COCoreMass, McMax) <= 0 || utils::Compare(McMax, McSN) >= 0) && !ShouldEnvelopeBeExpelledByPulsations()); // Evolve on HeHG phase if McCO <= McMax (see last paragraph of section 6.1 of Hurley+ 2000) and envelope is not ejected by pulsations
}


Expand Down Expand Up @@ -477,8 +477,15 @@ bool HeHG::IsSupernova() const {
if (utils::Compare(m_CoreMass, m_Mass) == 0) { // special case of ultra-stripped-star -- go SN immediately if over ECSN limit
return (utils::Compare(m_Mass, MECS) > 0);
}

return (utils::Compare(m_COCoreMass, CalculateCoreMassAtSupernova_Static(MECS, m_GBParams[static_cast<int>(GBP::McBAGB)])) >= 0); // Go supernova if CO core mass large enough
double snMass = CalculateInitialSupernovaMass(); // calculate SN initial mass
bool isCCSN = utils::Compare(m_COCoreMass, CalculateCoreMassAtSupernova_Static(MCH, m_Mass)) >= 0 &&
utils::Compare(snMass, OPTIONS->MCBUR1()) >= 0 && utils::Compare(m_COCoreMass, m_Mass) < 0;
bool isECSN = utils::Compare(snMass, MCBUR2) < 0 && (!m_MassTransferDonorHistory.empty() || OPTIONS->AllowNonStrippedECSN()) &&
utils::Compare(m_COCoreMass, CalculateCoreMassAtSupernova_Static(MECS, m_Mass)) >= 0 &&
utils::Compare(snMass, OPTIONS->MCBUR1()) >= 0 && utils::Compare(m_COCoreMass, m_Mass) < 0;

return (isCCSN || isECSN);
//return (utils::Compare(m_COCoreMass, CalculateCoreMassAtSupernova_Static(MECS, m_GBParams[static_cast<int>(GBP::McBAGB)])) >= 0); // Go supernova if CO core mass large enough
}

/*
Expand Down
6 changes: 4 additions & 2 deletions src/changelog.h
Original file line number Diff line number Diff line change
Expand Up @@ -1732,7 +1732,9 @@
// Changed default behaviour of mass losing and mass gaining MS stars to the BRCEK prescription
// 03.33.00 IM - Nov 20, 2026 - Enhancement:
// Changed the calculation of the SSE D parameter (above Eq. 39 in Hurley+ 2000) to allow for smooth transitions with mass and prevent excessively high base of the AGB CO core masses for massive stars

// 03.33.01 IM - Nov 25, 2026 - Defect repairs:
// - Fixed a bug in the mass transfer code (introduced in 03.30.00) that could lead to accretors gaining mass during mass transfer (see issue #1512)
// - Corrected the treatment of He star SNe to match Hurley+ 2000 and be consistent with other SN treatments (see issue #1511)


// Version string format is MM.mm.rr, where
Expand All @@ -1744,7 +1746,7 @@
// if MM is incremented, set mm and rr to 00, even if defect repairs and minor enhancements were also made
// if mm is incremented, set rr to 00, even if defect repairs were also made

const std::string VERSION_STRING = "03.33.00";
const std::string VERSION_STRING = "03.33.01";


# endif // __changelog_h__