diff --git a/src/BaseBinaryStar.cpp b/src/BaseBinaryStar.cpp index 307fb7b30..21e8603e6 100644 --- a/src/BaseBinaryStar.cpp +++ b/src/BaseBinaryStar.cpp @@ -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 @@ -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 diff --git a/src/GiantBranch.cpp b/src/GiantBranch.cpp index f561a614d..b3c2aad64 100644 --- a/src/GiantBranch.cpp +++ b/src/GiantBranch.cpp @@ -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 diff --git a/src/HeHG.cpp b/src/HeHG.cpp index de947ab54..de8158d13 100755 --- a/src/HeHG.cpp +++ b/src/HeHG.cpp @@ -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(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 } @@ -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(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(GBP::McBAGB)])) >= 0); // Go supernova if CO core mass large enough } /* diff --git a/src/changelog.h b/src/changelog.h index 29d70e0ad..cd1be87af 100644 --- a/src/changelog.h +++ b/src/changelog.h @@ -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 @@ -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__