From 1deda5da619745b7856b0f59ef51cfb9be6166d9 Mon Sep 17 00:00:00 2001 From: Adam Brcek Date: Thu, 16 Jan 2025 11:53:56 +1100 Subject: [PATCH] A few minor changes --- .../preprocessing/compasConfigDefault.yaml | 2 +- .../program-options-list-defaults.rst | 4 +-- online-docs/pages/whats-new.rst | 6 ++++ src/MainSequence.cpp | 30 +++++++++---------- src/MainSequence.h | 3 +- src/typedefs.h | 4 +-- 6 files changed, 27 insertions(+), 22 deletions(-) diff --git a/compas_python_utils/preprocessing/compasConfigDefault.yaml b/compas_python_utils/preprocessing/compasConfigDefault.yaml index d6d2b7143..fd0cc2a56 100644 --- a/compas_python_utils/preprocessing/compasConfigDefault.yaml +++ b/compas_python_utils/preprocessing/compasConfigDefault.yaml @@ -236,7 +236,7 @@ stringChoices: # --initial-mass-function: 'KROUPA' # Default: 'KROUPA' # Options: ['KROUPA','UNIFORM','POWERLAW','SALPETER'] # --LBV-mass-loss-prescription: 'HURLEY_ADD' # Default: 'HURLEY_ADD' # Options: ['BELCZYNSKI','HURLEY','HURLEY_ADD','ZERO','NONE'] # --luminous-blue-variable-prescription: 'HURLEY_ADD' # Default: 'HURLEY_ADD' # Options: ['BELCZYNSKI','HURLEY','HURLEY_ADD','ZERO','NONE'] -# --main-sequence-core-mass-prescription: 'MANDEL' # Default: 'MANDEL' # Options: ['SHIKAUCHI','MANDEL','NONE'] +# --main-sequence-core-mass-prescription: 'MANDEL' # Default: 'MANDEL' # Options: ['SHIKAUCHI','MANDEL','ZERO'] # --mass-loss-prescription: 'MERRITT2024' # Default: 'MERRITT2024' # Options: ['MERRITT2024','BELCZYNSKI2010','HURLEY','ZERO','NONE'] # --OB-mass-loss: 'VINK2021' # Default: 'VINK2021' # Options: ['KRTICKA2018','BJORKLUND2022','VINK2021','VINK2001','ZERO','NONE'] # --OB-mass-loss-prescription: 'VINK2021' # Default: 'VINK2021' # Options: ['KRTICKA2018','BJORKLUND2022','VINK2021','VINK2001','ZERO','NONE'] diff --git a/online-docs/pages/User guide/Program options/program-options-list-defaults.rst b/online-docs/pages/User guide/Program options/program-options-list-defaults.rst index e58a9c23a..5210923e7 100644 --- a/online-docs/pages/User guide/Program options/program-options-list-defaults.rst +++ b/online-docs/pages/User guide/Program options/program-options-list-defaults.rst @@ -797,8 +797,8 @@ Default = 4.2 **--main-sequence-core-mass-prescription** |br| Main sequence core mass prescription. |br| -Options: {NONE, MANDEL, SHIKAUCHI} |br| -``NONE`` : No core mass treatment |br| +Options: {ZERO, MANDEL, SHIKAUCHI} |br| +``ZERO`` : No core mass treatment, set to zero |br| ``MANDEL`` : The core following case A mass transfer is set equal to the expected core mass of a newly formed HG star with mass equal to that of the donor, scaled by the fraction of the donor's MS lifetime at mass transfer |br| ``SHIKAUCHI`` : Core mass according to Shikauchi et al. (2024) |br| diff --git a/online-docs/pages/whats-new.rst b/online-docs/pages/whats-new.rst index 3912bde9c..596f8e811 100644 --- a/online-docs/pages/whats-new.rst +++ b/online-docs/pages/whats-new.rst @@ -3,6 +3,12 @@ What's new Following is a brief list of important updates to the COMPAS code. A complete record of changes can be found in the file ``changelog.h``. +**03.12.00 Jan 16, 2025** +* Added convective core mass prescription for main sequence stars from Shikauchi+ (2024), describing how the core mass evolves under mass loss and mass gain. +* New command line option ``--main-sequence-core-mass-prescription`` with arguments ``SHIKAUCHI`` (new prescription), ``MANDEL`` (replaces the functionality of ``--retain-core-mass-during-caseA-mass-transfer``), and ``ZERO`` (core mass set to zero, no treatment). +* Added new luminosity prescription for main sequence stars from Shikauchi+ (2024). +* Added treatment for rejuvenation of main sequence accretors when the new prescription is used. + **03.10.00 Nov 29, 2024** Added functionality to log stellar mergers in the BSE switchlog file. diff --git a/src/MainSequence.cpp b/src/MainSequence.cpp index ea9a88ee5..45b417808 100644 --- a/src/MainSequence.cpp +++ b/src/MainSequence.cpp @@ -734,9 +734,9 @@ double MainSequence::CalculateConvectiveCoreMass() const { * Based on section 7.2 (after Eq. 111) of Hurley, Pols, Tout (2000) * * - * double CalculateConvectiveEnvelopeMass() const + * DBL_DBL CalculateConvectiveEnvelopeMass() const * - * @return Mass of convective envelope in Msol + * @return Tuple containing current mass of convective envelope and mass at ZAMS in Msol */ DBL_DBL MainSequence::CalculateConvectiveEnvelopeMass() const { if (utils::Compare(m_Mass, 1.25) > 0) return std::tuple (0.0, 0.0); @@ -765,8 +765,6 @@ DBL_DBL MainSequence::CalculateConvectiveEnvelopeMass() const { */ DBL_DBL MainSequence::CalculateMainSequenceCoreMassShikauchi(const double p_Dt, const double p_MassLossRate) { - static double heliumAbundanceCoreOut{ m_InitialHeliumAbundance }; // Helium abundance just outside the core - initially m_InitialHeliumAbundance - // get Shikauchi coefficients DBL_VECTOR ALPHA_COEFFICIENTS = std::get<0>(SHIKAUCHI_COEFFICIENTS); DBL_VECTOR FMIX_COEFFICIENTS = std::get<1>(SHIKAUCHI_COEFFICIENTS); @@ -798,7 +796,7 @@ DBL_DBL MainSequence::CalculateMainSequenceCoreMassShikauchi(const double p_Dt, if (deltaCoreMass > 0.0) { // If the core grows, we need to account for rejuvenation if (utils::Compare(newMixingCoreMass, m_InitialMainSequenceCoreMass) < 0) { // New core mass less than initial core mass? // Common factors - double f1 = heliumAbundanceCoreOut - m_InitialHeliumAbundance; + double f1 = m_HeliumAbundanceCoreOut - m_InitialHeliumAbundance; double f2 = m_MainSequenceCoreMass - m_InitialMainSequenceCoreMass; double f3 = m_MainSequenceCoreMass + deltaCoreMass; @@ -806,33 +804,33 @@ DBL_DBL MainSequence::CalculateMainSequenceCoreMassShikauchi(const double p_Dt, double deltaYout = f1 / f2 * deltaCoreMass; // Calculate the change in core helium abundance, assuming linear profile between Yc and Y0, and that the the accreted gas has helium fraction Y0 - double deltaY = (heliumAbundanceCoreOut - m_HeliumAbundanceCore) / f3 * deltaCoreMass + 0.5 / f3 * f1 / f2 * deltaCoreMass * deltaCoreMass; + double deltaY = (m_HeliumAbundanceCoreOut - m_HeliumAbundanceCore) / f3 * deltaCoreMass + 0.5 / f3 * f1 / f2 * deltaCoreMass * deltaCoreMass; newCentralHeliumFraction = m_HeliumAbundanceCore + deltaY; - heliumAbundanceCoreOut += deltaYout; + m_HeliumAbundanceCoreOut += deltaYout; } else { // New core mass greater or equal to the initial core mass? double deltaCoreMass1 = m_InitialMainSequenceCoreMass - m_MainSequenceCoreMass; // Mass accreted up to the initial core mass double deltaCoreMass2 = deltaCoreMass - deltaCoreMass1; // Remaining accreted mass - newCentralHeliumFraction = (m_MainSequenceCoreMass * m_HeliumAbundanceCore + 0.5 * (heliumAbundanceCoreOut + m_InitialHeliumAbundance) * deltaCoreMass1 + deltaCoreMass2 * m_InitialHeliumAbundance) / (m_MainSequenceCoreMass + deltaCoreMass); - heliumAbundanceCoreOut = m_InitialHeliumAbundance; + newCentralHeliumFraction = (m_MainSequenceCoreMass * m_HeliumAbundanceCore + 0.5 * (m_HeliumAbundanceCoreOut + m_InitialHeliumAbundance) * deltaCoreMass1 + deltaCoreMass2 * m_InitialHeliumAbundance) / (m_MainSequenceCoreMass + deltaCoreMass); + m_HeliumAbundanceCoreOut = m_InitialHeliumAbundance; m_InitialMainSequenceCoreMass = newMixingCoreMass; } } else - heliumAbundanceCoreOut = newCentralHeliumFraction; // If core did not grow, Y_out = Y_c + m_HeliumAbundanceCoreOut = newCentralHeliumFraction; // If core did not grow, Y_out = Y_c return std::tuple (newMixingCoreMass, std::min(newCentralHeliumFraction, 1.0 - m_Metallicity)); } /* - * Calculate the initial core mass of a main sequence star using Equation (A3) from Shikauchi et al. (2024) - * + * Calculate the initial convective core mass of a main sequence star using Equation (A3) from Shikauchi et al. (2024), + * also used for calculating core mass after MS merger * * double CalculateInitialMainSequenceCoreMass(const double p_MZAMS) * - * @param [IN] p_MZAMS Mass at ZAMS in Msol - * @return Mass of the convective core in Msol at ZAMS + * @param [IN] p_MZAMS Mass at ZAMS or after merger in Msol + * @return Mass of the convective core at ZAMS or after merger in Msol */ double MainSequence::CalculateInitialMainSequenceCoreMass(const double p_MZAMS) const { DBL_VECTOR fmixCoefficients = std::get<1>(SHIKAUCHI_COEFFICIENTS); @@ -858,7 +856,7 @@ void MainSequence::UpdateMainSequenceCoreMass(const double p_Dt, const double p_ double age = m_Age; // default is no change switch (OPTIONS->MainSequenceCoreMassPrescription()) { - case CORE_MASS_PRESCRIPTION::NONE: + case CORE_MASS_PRESCRIPTION::ZERO: mainSequenceCoreMass = 0.0; break; @@ -881,7 +879,7 @@ void MainSequence::UpdateMainSequenceCoreMass(const double p_Dt, const double p_ std::tie(mainSequenceCoreMass, heliumAbundanceCore) = CalculateMainSequenceCoreMassShikauchi(p_Dt, p_MassLossRate); // calculate and update the core mass and central helium fraction double tMS = m_Timescales[static_cast(TIMESCALE::tMS)]; - age = (m_HeliumAbundanceCore - m_InitialHeliumAbundance) / m_InitialHydrogenAbundance * 0.99 * tMS; // update the effective age based on central helium fraction + age = (heliumAbundanceCore - m_InitialHeliumAbundance) / m_InitialHydrogenAbundance * 0.99 * tMS; // update the effective age based on central helium fraction } } // MZAMS less than the limit? MANDEL prescription used diff --git a/src/MainSequence.h b/src/MainSequence.h index 4ef3b6586..6e2b636f7 100644 --- a/src/MainSequence.h +++ b/src/MainSequence.h @@ -20,13 +20,14 @@ class MainSequence: virtual public BaseStar { MT_CASE DetermineMassTransferTypeAsDonor() const { return MT_CASE::A; } // Always case A - const std::tuple SHIKAUCHI_COEFFICIENTS = InterpolateShikauchiCoefficients(m_Metallicity); // Interpolate Shikauchi coefficients for the given metallicity; + const std::tuple SHIKAUCHI_COEFFICIENTS = InterpolateShikauchiCoefficients(m_Metallicity); // Interpolate Shikauchi coefficients for the given metallicity protected: // member variables double m_InitialMainSequenceCoreMass = 0.0; // Initial mass of the mixing core is initialised in MS_gt_07 class + double m_HeliumAbundanceCoreOut = m_InitialHeliumAbundance; // Helium abundance just outside the core, used for rejuvenation calculations // member functions - alphabetically double CalculateAlphaL(const double p_Mass) const; diff --git a/src/typedefs.h b/src/typedefs.h index 66a9fd1b1..251b7bf31 100755 --- a/src/typedefs.h +++ b/src/typedefs.h @@ -385,9 +385,9 @@ const COMPASUnorderedMap CHE_MODE_LABEL = { }; // main sequence core mass prescription -enum class CORE_MASS_PRESCRIPTION: int { NONE, MANDEL, SHIKAUCHI }; +enum class CORE_MASS_PRESCRIPTION: int { ZERO, MANDEL, SHIKAUCHI }; const COMPASUnorderedMap CORE_MASS_PRESCRIPTION_LABEL = { - { CORE_MASS_PRESCRIPTION::NONE, "NONE" }, + { CORE_MASS_PRESCRIPTION::ZERO, "ZERO" }, { CORE_MASS_PRESCRIPTION::MANDEL, "MANDEL" }, { CORE_MASS_PRESCRIPTION::SHIKAUCHI, "SHIKAUCHI" } };