From 4817704b66e69b96d1d537ca36b4f7294a9d92e0 Mon Sep 17 00:00:00 2001 From: Ilya Mandel Date: Fri, 20 Nov 2026 22:54:59 +1100 Subject: [PATCH 1/3] Tweaking D equation --- src/BaseStar.cpp | 1 + src/BaseStar.h | 4 +++- src/EAGB.cpp | 9 ++++++++- src/GiantBranch.cpp | 7 +++++++ src/GiantBranch.h | 3 ++- src/HeHG.cpp | 1 + 6 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/BaseStar.cpp b/src/BaseStar.cpp index 629eb6703..e54e47428 100755 --- a/src/BaseStar.cpp +++ b/src/BaseStar.cpp @@ -1393,6 +1393,7 @@ double BaseStar::CalculateLuminosityAtBAGB(double p_Mass) const { */ double BaseStar::CalculateLuminosityGivenCoreMass(const double p_CoreMass) const { #define gbParams(x) m_GBParams[static_cast(GBP::x)] // for convenience and readability - undefined at end of function + std::cout<<"q"<(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 + double core = 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))); + std::cout<<"EAGB::CalculateCOCoreMassOnPhase p_Time "<(GBP::McBAGB)]), 1.05 * McCOBAGB); // hack from Hurley fortran code, doesn't seem to be in the paper - std::cout<<"McCOBAGB "<(GBP::McBAGB)])<< " CO core " << m_COCoreMass << std::endl; + std::cout<<"McCOBAGB "<(GBP::McBAGB)])<< " CO core " << m_COCoreMass << " Mass "<< m_Mass << " Mass0 "<< m_Mass0<<" Lum "<< m_Luminosity<= 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; + std::cout<<"D0: "<(GBP::x)] // for convenience and readability - undefined at end of function + std::cout<<"CalculateGBParams mass"<(GBP::x)] // for convenience and readability - undefined at end of function + std::cout<<"HeHG p_Mass0"< Date: Fri, 20 Nov 2026 23:07:22 +1100 Subject: [PATCH 2/3] 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 --- src/BaseStar.cpp | 1 - src/BaseStar.h | 1 - src/EAGB.cpp | 11 +---------- src/GiantBranch.cpp | 8 ++------ src/GiantBranch.h | 2 +- src/HeHG.cpp | 1 - src/changelog.h | 6 ++++-- 7 files changed, 8 insertions(+), 22 deletions(-) diff --git a/src/BaseStar.cpp b/src/BaseStar.cpp index e54e47428..629eb6703 100755 --- a/src/BaseStar.cpp +++ b/src/BaseStar.cpp @@ -1393,7 +1393,6 @@ double BaseStar::CalculateLuminosityAtBAGB(double p_Mass) const { */ double BaseStar::CalculateLuminosityGivenCoreMass(const double p_CoreMass) const { #define gbParams(x) m_GBParams[static_cast(GBP::x)] // for convenience and readability - undefined at end of function - std::cout<<"q"<(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 - - double core = 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))); - std::cout<<"EAGB::CalculateCOCoreMassOnPhase p_Time "<(GBP::McBAGB)]), 1.05 * McCOBAGB); // hack from Hurley fortran code, doesn't seem to be in the paper - std::cout<<"McCOBAGB "<(GBP::McBAGB)])<< " CO core " << m_COCoreMass << " Mass "<< m_Mass << " Mass0 "<< m_Mass0<<" Lum "<< m_Luminosity< 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; - std::cout<<"D0: "<(GBP::x)] // for convenience and readability - undefined at end of function - std::cout<<"CalculateGBParams mass"<(GBP::x)] // for convenience and readability - undefined at end of function - std::cout<<"HeHG p_Mass0"< Date: Fri, 20 Nov 2026 23:11:10 +1100 Subject: [PATCH 3/3] Comment fix --- src/EAGB.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EAGB.cpp b/src/EAGB.cpp index fd6610589..6dce1b885 100755 --- a/src/EAGB.cpp +++ b/src/EAGB.cpp @@ -1080,7 +1080,7 @@ 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