diff --git a/src/BaseStar.h b/src/BaseStar.h index 233282e8e..9f8be7880 100644 --- a/src/BaseStar.h +++ b/src/BaseStar.h @@ -232,7 +232,8 @@ class BaseStar { double CalculateEddyTurnoverTimescale() const; virtual void CalculateGBParams(const double p_Mass, DBL_VECTOR &p_GBParams) { } // Default is NO-OP - virtual void CalculateGBParams() { CalculateGBParams(m_Mass0, m_GBParams); } // Use class member variables + virtual void CalculateGBParams() { + CalculateGBParams(m_Mass0, m_GBParams); } // Use class member variables double CalculateInitialHeliumAbundance() const { return 0.24 + 2.0 * m_Metallicity; } // Pols et al. 1998 double CalculateInitialHydrogenAbundance() const { return 0.76 - 3.0 * m_Metallicity; } // Pols et al. 1998 diff --git a/src/EAGB.cpp b/src/EAGB.cpp index 40658c761..6dce1b885 100755 --- a/src/EAGB.cpp +++ b/src/EAGB.cpp @@ -36,7 +36,7 @@ void EAGB::CalculateTimescales(const double p_Mass, DBL_VECTOR &p_Timescales) { double tBAGB = CalculateLifetimeToBAGB(timescales(tHeI), timescales(tHe)); double LBAGB = CalculateLuminosityAtBAGB(p_Mass); - + timescales(tinf1_FAGB) = tBAGB + ((1.0 / (p1 * gbParams(AHe) * gbParams(D))) * PPOW((gbParams(D) / LBAGB), p1_p)); timescales(tMx_FAGB) = timescales(tinf1_FAGB) - ((timescales(tinf1_FAGB) - tBAGB) * PPOW((LBAGB / gbParams(Lx)), p1_p)); timescales(tinf2_FAGB) = timescales(tMx_FAGB) + ((1.0 / (q1 * gbParams(AHe) * gbParams(B))) * PPOW((gbParams(B) / gbParams(Lx)), q1_q)); @@ -881,7 +881,7 @@ double EAGB::CalculateRemnantRadius() const { double EAGB::CalculateCOCoreMassOnPhase(const double p_Time) const { #define timescales(x) m_Timescales[static_cast(TIMESCALE::x)] // for convenience and readability - undefined at end of function #define gbParams(x) m_GBParams[static_cast(GBP::x)] // for convenience and readability - undefined at end of function - + return utils::Compare(p_Time, timescales(tMx_FAGB)) <= 0 ? PPOW((gbParams(p) - 1.0) * gbParams(AHe) * gbParams(D) * (timescales(tinf1_FAGB) - p_Time), 1.0 / (1.0 - gbParams(p))) : PPOW((gbParams(q) - 1.0) * gbParams(AHe) * gbParams(B) * (timescales(tinf2_FAGB) - p_Time), 1.0 / (1.0 - gbParams(q))); @@ -1080,7 +1080,8 @@ bool EAGB::ShouldSkipPhase() const { #define timescales(x) m_Timescales[static_cast(TIMESCALE::x)] // for convenience and readability - undefined at end of function double McCOBAGB = CalculateCOCoreMassOnPhase(timescales(tHeI) + timescales(tHe)); - double McSN = std::max(CalculateCoreMassAtSupernova_Static(MCH, m_GBParams[static_cast(GBP::McBAGB)]), 1.05 * McCOBAGB); // hack from Hurley fortran code, doesn't seem to be in the paper + double McSN = std::max(CalculateCoreMassAtSupernova_Static(MCH, m_GBParams[static_cast(GBP::McBAGB)]), 1.05 * McCOBAGB); // hack from Hurley fortran code (not in the paper), protects in case core mass is already above threshold at base of AGB, but should no longer be needed following D adjustment + return (utils::Compare(McSN, m_COCoreMass) < 0); // skip phase if core is heavy enough to go supernova #undef timescales diff --git a/src/GiantBranch.cpp b/src/GiantBranch.cpp index 244a9d2bc..f561a614d 100644 --- a/src/GiantBranch.cpp +++ b/src/GiantBranch.cpp @@ -97,7 +97,8 @@ double GiantBranch::CalculateCoreMass_Luminosity_B_Static(const double p_Mass) { /* * Calculate the Core mass - Luminosity relation parameter D * - * Hurley et al. 2000, eqs 31 - 38 + * Hurley et al. 2000, eqs 31 - 38, adjusted to vary smoothly with mass + * and prevent AGB stars from having excessively high core masses at the base of the AGB (immediate supernovae) * * * double CalculateCoreMass_Luminosity_D_Static(const double p_Mass, const double p_LogMetallicityXi, DBL_VECTOR &p_MassCutoffs) @@ -117,7 +118,9 @@ double GiantBranch::CalculateCoreMass_Luminosity_D_Static(const double p_Mass, c if (utils::Compare(p_Mass, massCutoffs(MHeF)) > 0) { if (utils::Compare(p_Mass, 2.5) >= 0) { double D2 = (0.5 * D0) - (0.06 * p_Mass); - logD = std::max(std::max(-1.0, D1), D2); + D1 = D1 > -2.0 ? D1 + 2.0 : 0.0; + D2 = D2 > -2.0 ? D2 + 2.0 : 0.0; + logD = PPOW(PPOW(D1,(100.0/p_Mass)) + PPOW(D2,(100.0/p_Mass)) + 1.0, p_Mass/100.0) - 2.0; } else { // Linear interpolation between end points double gradient = (D0 - D1) / (massCutoffs(MHeF) - 2.5); diff --git a/src/GiantBranch.h b/src/GiantBranch.h index e9d8e4de7..4144a9414 100755 --- a/src/GiantBranch.h +++ b/src/GiantBranch.h @@ -50,7 +50,8 @@ class GiantBranch: virtual public BaseStar, public MainSequence { void CalculateGBParams(const double p_Mass, DBL_VECTOR &p_GBParams); static void CalculateGBParams_Static(const double p_Mass, const double p_LogMetallicityXi, const DBL_VECTOR &p_MassCutoffs, const DBL_VECTOR &p_AnCoefficients, const DBL_VECTOR &p_BnCoefficients, DBL_VECTOR &p_GBParams); - void CalculateGBParams() { CalculateGBParams(m_Mass0, m_GBParams); } // Use class member variables + void CalculateGBParams() { + CalculateGBParams(m_Mass0, m_GBParams); } // Use class member variables static double CalculateHRateConstant_Static(const double p_Mass); diff --git a/src/changelog.h b/src/changelog.h index 285ba1ee4..29d70e0ad 100644 --- a/src/changelog.h +++ b/src/changelog.h @@ -1730,6 +1730,8 @@ // (*) https://github.com/ruggero-valli/spindler-c, installation required to use the CBD module // 03.32.00 IM - Nov 20, 2026 - Enhancement: // 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 @@ -1742,7 +1744,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.32.00"; +const std::string VERSION_STRING = "03.33.00"; # endif // __changelog_h__