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
3 changes: 2 additions & 1 deletion src/BaseStar.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions src/EAGB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -881,7 +881,7 @@ double EAGB::CalculateRemnantRadius() const {
double EAGB::CalculateCOCoreMassOnPhase(const double p_Time) const {
#define timescales(x) m_Timescales[static_cast<int>(TIMESCALE::x)] // for convenience and readability - undefined at end of function
#define gbParams(x) m_GBParams[static_cast<int>(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)));
Expand Down Expand Up @@ -1080,7 +1080,8 @@ bool EAGB::ShouldSkipPhase() const {
#define timescales(x) m_Timescales[static_cast<int>(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<int>(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<int>(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
Expand Down
7 changes: 5 additions & 2 deletions src/GiantBranch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion src/GiantBranch.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
4 changes: 3 additions & 1 deletion src/changelog.h
Original file line number Diff line number Diff line change
Expand Up @@ -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



Expand All @@ -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__