Skip to content

Commit 44124d6

Browse files
committed
Defined LogMetallicityXi() for different ZSOLs
1 parent 963748f commit 44124d6

File tree

6 files changed

+25
-23
lines changed

6 files changed

+25
-23
lines changed

src/BaseStar.cpp

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,10 @@ BaseStar::BaseStar(const unsigned long int p_RandomSeed,
9191

9292
// calculate coefficients, constants etc.
9393

94-
CalculateRCoefficients(LogMetallicityXi(), m_RCoefficients);
95-
CalculateLCoefficients(LogMetallicityXi(), m_LCoefficients);
94+
CalculateRCoefficients(LogMetallicityXiHurley(), m_RCoefficients);
95+
CalculateLCoefficients(LogMetallicityXiHurley(), m_LCoefficients);
9696

97-
CalculateMassCutoffs(m_Metallicity, LogMetallicityXi(), m_MassCutoffs);
97+
CalculateMassCutoffs(m_Metallicity, LogMetallicityXiHurley(), m_MassCutoffs);
9898

9999
CalculateAnCoefficients(m_AnCoefficients, m_LConstants, m_RConstants, m_GammaConstants);
100100
CalculateBnCoefficients(m_BnCoefficients);
@@ -506,7 +506,7 @@ void BaseStar::CalculateAnCoefficients(DBL_VECTOR &p_AnCoefficients,
506506
#define GammaConstants(x) p_GammaConstants[static_cast<int>(GAMMA_CONSTANTS::x)] // for convenience and readability - undefined at end of function
507507

508508
double Z = m_Metallicity;
509-
double xi = LogMetallicityXi();
509+
double xi = LogMetallicityXiHurley();
510510
double sigma = LogMetallicitySigma();
511511

512512
// pow() is slow - use multiplication
@@ -606,7 +606,7 @@ void BaseStar::CalculateBnCoefficients(DBL_VECTOR &p_BnCoefficients) {
606606

607607

608608
double Z = m_Metallicity;
609-
double xi = LogMetallicityXi();
609+
double xi = LogMetallicityXiHurley();
610610
double sigma = LogMetallicitySigma();
611611
double rho = LogMetallicityRho();
612612

@@ -879,7 +879,7 @@ void BaseStar::CalculateMassCutoffs(const double p_Metallicity, const double p_L
879879
double BaseStar::CalculateGBRadiusXExponent() const {
880880

881881
// pow()is slow - use multiplication
882-
double xi = LogMetallicityXi();
882+
double xi = LogMetallicityXiHurley();
883883
double xi_2 = xi * xi;
884884
double xi_3 = xi_2 * xi;
885885
double xi_4 = xi_2 * xi_2;
@@ -1834,7 +1834,7 @@ double BaseStar::CalculateMassLossRateOBVink2001() const {
18341834
(2.210 * log10(m_Luminosity / 1.0E5)) -
18351835
(1.339 * log10(m_Mass / 30.0)) -
18361836
(1.601 * log10(v / 2.0)) +
1837-
(0.85 * log10(m_Metallicity / ZSOL_ANDERS)) +
1837+
(0.85 * LogMetallicityXiAnders()) +
18381838
(1.07 * log10(teff / 20000.0));
18391839

18401840
rate = PPOW(10.0, logMdotOB);
@@ -1850,7 +1850,7 @@ double BaseStar::CalculateMassLossRateOBVink2001() const {
18501850
(2.194 * log10(m_Luminosity / 1.0E5)) -
18511851
(1.313 * log10(m_Mass / 30.0)) -
18521852
(1.226 * log10(v / 2.0)) +
1853-
(0.85 * log10(m_Metallicity / ZSOL_ANDERS)) +
1853+
(0.85 * LogMetallicityXiAnders()) +
18541854
(0.933 * log10(teff / 40000.0)) -
18551855
(10.92 * log10(teff / 40000.0) * log10(teff/40000.0));
18561856

@@ -1885,7 +1885,7 @@ double BaseStar::CalculateMassLossRateOBVinkSander2021() const {
18851885

18861886
double teff = m_Temperature * TSOL;
18871887
double Gamma = EDDINGTON_PARAMETER_FACTOR * m_Luminosity / m_Mass;
1888-
double charrho = -14.94 + (3.1857 * Gamma) + (zExp * log10(m_Metallicity / ZSOL_ANDERS));
1888+
double charrho = -14.94 + (3.1857 * Gamma) + (zExp * LogMetallicityXiAnders());
18891889
double T2 = ( 61.2 + (2.59 * charrho) ) * 1000.0; // typically around 25000.0, higher jump first as in Vink python recipe
18901890
double T1 = ( 100.0 + (6.0 * charrho) ) * 1000.0; // typically around 20000.0, has similar behavior when fixed
18911891

@@ -1901,7 +1901,7 @@ double BaseStar::CalculateMassLossRateOBVinkSander2021() const {
19011901
(2.210 * logL5) -
19021902
(1.339 * logM30) -
19031903
(1.601 * log10(V / 2.0)) +
1904-
(zExp2001 * log10(m_Metallicity / ZSOL_ANDERS)) +
1904+
(zExp2001 * LogMetallicityXiAnders()) +
19051905
(1.07 * logT20);
19061906

19071907
rate = PPOW(10.0, logMdotOB);
@@ -1914,7 +1914,7 @@ double BaseStar::CalculateMassLossRateOBVinkSander2021() const {
19141914
(2.210 * logL5) -
19151915
(1.339 * logM30) -
19161916
(1.601 * log10(V / 2.0)) +
1917-
(zExp2001 * log10(m_Metallicity / ZSOL_ANDERS)) +
1917+
(zExp2001 * LogMetallicityXiAnders()) +
19181918
(1.07 * logT20);
19191919

19201920
rate = PPOW(10.0, logMdotOB);
@@ -1927,7 +1927,7 @@ double BaseStar::CalculateMassLossRateOBVinkSander2021() const {
19271927
(2.194 * logL5) -
19281928
(1.313 * logM30) -
19291929
(1.226 * log10(V / 2.0)) +
1930-
(zExp * log10(m_Metallicity / ZSOL_ANDERS)) +
1930+
(zExp * LogMetallicityXiAnders()) +
19311931
(0.933 * logT40) -
19321932
(10.92 * logT40 * logT40);
19331933

@@ -1953,9 +1953,7 @@ double BaseStar::CalculateMassLossRateOBVinkSander2021() const {
19531953
*/
19541954
double BaseStar::CalculateMassLossRateOBKrticka2018() const {
19551955

1956-
double logZ = log10(m_Metallicity / ZSOL_ASPLUND);
1957-
1958-
double logMdot = -5.70 + 0.50 * logZ + (1.61 - 0.12 * logZ) * log10(m_Luminosity / 1.0E6);
1956+
double logMdot = -5.70 + 0.50 * LogMetallicityXiAsplund() + (1.61 - 0.12 * LogMetallicityXiAsplund()) * log10(m_Luminosity / 1.0E6);
19591957

19601958
return PPOW(10.0, logMdot);
19611959
}
@@ -2301,7 +2299,7 @@ double BaseStar::CalculateMassLossRateWolfRayetSanderVink2020(const double p_Mu)
23012299
if (utils::Compare(p_Mu, 1.0) < 0) {
23022300

23032301
double logL = log10(m_Luminosity);
2304-
double logZ = log10(m_Metallicity / ZSOL_ANDERS);
2302+
double logZ = LogMetallicityXiAnders();
23052303

23062304
// Calculate alpha, L0 and Mdot10
23072305
double alpha = 0.32 * logZ + 1.4; // Equation 18 in Sander & Vink 2020
@@ -2369,7 +2367,7 @@ double BaseStar::CalculateMassLossRateWolfRayetTemperatureCorrectionSander2023(c
23692367
*/
23702368
double BaseStar::CalculateMassLossRateHeliumStarVink2017() const {
23712369

2372-
double logMdot = -13.3 + (1.36 * log10(m_Luminosity)) + (0.61 * log10(m_Metallicity / ZSOL_ANDERS)); // Vink 2017 Eq. 1.
2370+
double logMdot = -13.3 + (1.36 * log10(m_Luminosity)) + (0.61 * LogMetallicityXiAnders()); // Vink 2017 Eq. 1.
23732371

23742372
return PPOW(10.0, logMdot);
23752373
}

src/BaseStar.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,11 @@ class BaseStar {
119119
bool IsSNIA() const { return (m_SupernovaDetails.events.current & SN_EVENT::SNIA) == SN_EVENT::SNIA; }
120120
bool IsUSSN() const { return (m_SupernovaDetails.events.current & SN_EVENT::USSN) == SN_EVENT::USSN; }
121121
bool LBV_PhaseFlag() const { return m_LBVphaseFlag; }
122-
double LogMetallicityRho() const { return LogMetallicityXi() + 1.0; } // rho in Hurley+ 2000
122+
double LogMetallicityRho() const { return LogMetallicityXiHurley() + 1.0; } // rho in Hurley+ 2000
123123
double LogMetallicitySigma() const { return m_Log10Metallicity; } // sigma in Hurley+ 2000
124-
double LogMetallicityXi() const { return m_Log10Metallicity - LOG10_ZSOL_HURLEY; } // xi in Hurley+ 2000
124+
double LogMetallicityXiHurley() const { return m_Log10Metallicity - LOG10_ZSOL_HURLEY; } // xi in Hurley+ 2000
125+
double LogMetallicityXiAnders() const { return m_Log10Metallicity - LOG10_ZSOL_ANDERS; } // log10(Z / ZSOL_ANDERS)
126+
double LogMetallicityXiAsplund() const { return m_Log10Metallicity - LOG10_ZSOL_ASPLUND; } // log10(Z / ZSOL_ASPLUND)
125127
double Luminosity() const { return m_Luminosity; }
126128
double MainSequenceCoreMass() const { return m_MainSequenceCoreMass; }
127129
double Mass() const { return m_Mass; }

src/EAGB.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1046,7 +1046,7 @@ STELLAR_TYPE EAGB::ResolveEnvelopeLoss(bool p_Force) {
10461046

10471047
m_Age = HeGB::CalculateAgeOnPhase_Static(m_Mass, m_COCoreMass, timescales(tHeMS), m_GBParams);
10481048

1049-
HeHG::CalculateGBParams_Static(m_Mass0, m_Mass, LogMetallicityXi(), m_MassCutoffs, m_AnCoefficients, m_BnCoefficients, m_GBParams);
1049+
HeHG::CalculateGBParams_Static(m_Mass0, m_Mass, LogMetallicityXiHurley(), m_MassCutoffs, m_AnCoefficients, m_BnCoefficients, m_GBParams);
10501050
m_Luminosity = HeGB::CalculateLuminosityOnPhase_Static(m_COCoreMass, gbParams(B), gbParams(D));
10511051

10521052
double R1, R2;

src/GiantBranch.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ void GiantBranch::CalculateGBParams(const double p_Mass, DBL_VECTOR &p_GBParams)
265265
gbParams(AHe) = CalculateHeRateConstant_Static();
266266

267267
gbParams(B) = CalculateCoreMass_Luminosity_B_Static(p_Mass);
268-
gbParams(D) = CalculateCoreMass_Luminosity_D_Static(p_Mass, LogMetallicityXi(), m_MassCutoffs);
268+
gbParams(D) = CalculateCoreMass_Luminosity_D_Static(p_Mass, LogMetallicityXiHurley(), m_MassCutoffs);
269269

270270
gbParams(p) = CalculateCoreMass_Luminosity_p_Static(p_Mass, m_MassCutoffs);
271271
gbParams(q) = CalculateCoreMass_Luminosity_q_Static(p_Mass, m_MassCutoffs);
@@ -1299,7 +1299,7 @@ double GiantBranch::CalculateRemnantMassByMaltsev2024(const double p_COCoreMass,
12991299

13001300
ST_VECTOR mtHist = MassTransferDonorHistory(); // mass transfer history vector
13011301
MT_CASE massTransferCase = MT_CASE::OTHER;
1302-
double log10Z = m_Log10Metallicity - log10(ZSOL_ASPLUND); // log_{10} (Z/Zsol), for convenience
1302+
double log10Z = m_Log10Metallicity - LOG10_ZSOL_ASPLUND; // log_{10} (Z/Zsol), for convenience
13031303
double M1, M2, M3;
13041304

13051305
if (utils::Compare(p_COCoreMass, MALTSEV2024_MMIN) < 0) // NS formation regardless of metallicity and MT history

src/MainSequence.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,7 @@ double MainSequence::CalculateLifetimeOnPhase(const double p_Mass, const double
967967
double tHook = mu * p_TBGB;
968968

969969
// For mass < Mhook, x > mu (i.e. for stars without a hook)
970-
double x = std::max(0.95, std::min((0.95 - (0.03 * (LogMetallicityXi() + 0.30103))), 0.99));
970+
double x = std::max(0.95, std::min((0.95 - (0.03 * (LogMetallicityXiHurley() + 0.30103))), 0.99));
971971

972972
return std::max(tHook, (x * p_TBGB));
973973

src/constants.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,9 @@ constexpr double RSOL = 6.957E8;
190190
constexpr double ZSOL_HURLEY = 0.02; // Solar Metallicity used in scalings
191191
constexpr double LOG10_ZSOL_HURLEY = -1.698970004336019; // log10(ZSOL_HURLEY) - for performance
192192
constexpr double ZSOL_ANDERS = 0.019; // Solar Metallicity (Anders+ 1989) used in winds
193+
constexpr double LOG10_ZSOL_ANDERS = -1.721246399047171; // log10(ZSOL_ANDERS) - for performance
193194
constexpr double ZSOL_ASPLUND = 0.0142; // Solar Metallicity (Asplund+ 2009) used in initial condition and winds
195+
constexpr double LOG10_ZSOL_ASPLUND = -1.847711655616944; // log10(ZSOL_ASPLUND) - for performance
194196
constexpr double YSOL_ASPLUND = 0.2485; // Asplund+ 2009
195197
constexpr double TSOL = 5778.0; // Solar Temperature in kelvin
196198
constexpr double LSOL = 3.844E33; // Solar Luminosity in erg/s

0 commit comments

Comments
 (0)