diff --git a/online-docs/pages/User guide/COMPAS output/standard-logfiles-default-record-specifications-BSE-switchlog.rst b/online-docs/pages/User guide/COMPAS output/standard-logfiles-default-record-specifications-BSE-switchlog.rst index 616ae439a..7e95f38f2 100644 --- a/online-docs/pages/User guide/COMPAS output/standard-logfiles-default-record-specifications-BSE-switchlog.rst +++ b/online-docs/pages/User guide/COMPAS output/standard-logfiles-default-record-specifications-BSE-switchlog.rst @@ -67,5 +67,21 @@ Note that the BSE SwitchLog file has the following columns automatically appende * - Header String: - "SWITCHING_TO" +**IS_MERGER** + +.. list-table:: + :widths: 20 80 + :header-rows: 0 + :class: aligned-text + + * - Data type: + - BOOL + * - COMPAS variable: + - Not applicable + * - Description: + - Flag to indicate if the switchlog record records a merger (rather than a simple switch) + * - Header String: + - "IS_MERGER" + These columns will always be automatically appended to each BSE Switch Log record: they cannot be removed via the log file record specifications file. diff --git a/online-docs/pages/whats-new.rst b/online-docs/pages/whats-new.rst index a5fd6420a..3912bde9c 100644 --- a/online-docs/pages/whats-new.rst +++ b/online-docs/pages/whats-new.rst @@ -3,7 +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.09.00 Nov 25, 2024** +**03.10.00 Nov 29, 2024** + +Added functionality to log stellar mergers in the BSE switchlog file. +Switchlog merger records come in pairs (one for each star) so that the stellar type of each star is recorded. + +**03.09.00 Nov 28, 2024** Improved nuclear timescale mass transfer: the nuclear timescale mass transfer rate is now set by the requirement that the star ends the time step just filling its Roche lobe. @@ -23,13 +28,11 @@ Improved the treatment of stellar rotation (with further corrections in 03.08.01 * Assume rigid body rotation * Keep the angular moment of a star constant when there is no mass loss -* When a star with radius r and angular frequency omega loses mass dm through winds or mass transfer, it loses angular momentum dL = -(2/3) dm r^2 omega +* When a star with radius r and angular frequency omega loses mass dm through winds or mass transfer, it loses angular momentum dL = (2/3) dm r^2 omega * (However, angular momentum never drops below zero) * When a star loses its envelope, the remaining core is assumed to rotate with the same rotation rate as the preceding star * When a star of mass m and radius r gains mass dm through accretion, it gain angular momentum dL = dm \sqrt{G m r} -* If initial binary rotation is fast enough for a star to be CHE, it is set to that rotation frequency without regard for the tidal -prescription; CHE stars remain tidally locked if the tidal prescription is NONE +* If initial binary rotation is fast enough for a star to be CHE, it is set to that rotation frequency without regard for the tidal prescription; CHE stars remain tidally locked if the tidal prescription is NONE **03.07.01 Oct 23, 2024** diff --git a/src/BaseBinaryStar.cpp b/src/BaseBinaryStar.cpp index 951daddd0..d742bea7b 100644 --- a/src/BaseBinaryStar.cpp +++ b/src/BaseBinaryStar.cpp @@ -3084,11 +3084,12 @@ EVOLUTION_STATUS BaseBinaryStar::Evolve() { if (StellarMerger() && !HasOneOf({ STELLAR_TYPE::MASSLESS_REMNANT })) { // have stars merged without merger already being resolved? if (m_Star1->IsOneOf(MAIN_SEQUENCE) && m_Star2->IsOneOf(MAIN_SEQUENCE) && OPTIONS->EvolveMainSequenceMergers()) // yes - both MS and evolving MS merger products? ResolveMainSequenceMerger(); // yes - handle main sequence mergers gracefully; no need to change evolution status - else { - // make both stars massless remnants if merging during CE, so this is recorded in the Switch log; eventually, will want to implement a more careful prescription for the merger product, perhaps allowing further evolution of the merger product - m_Star1->SwitchTo(STELLAR_TYPE::MASSLESS_REMNANT); - m_Star2->SwitchTo(STELLAR_TYPE::MASSLESS_REMNANT); - evolutionStatus = EVOLUTION_STATUS::STELLAR_MERGER; // no - for now, stop evolution + else { // no - for now, log the merger and stop evolution + // log the merger to the switchlog file + // eventually, will want to implement a more careful prescription for the merger product, + // perhaps allowing further evolution of the merger product + (void)LogMergerToSwitchLog(); // log merger + evolutionStatus = EVOLUTION_STATUS::STELLAR_MERGER; // stop evolution } } else if (HasStarsTouching()) { // binary components touching? (should usually be avoided as MT or CE or merger should happen prior to this) diff --git a/src/BaseBinaryStar.h b/src/BaseBinaryStar.h index f8442a74d..dffacdb6e 100644 --- a/src/BaseBinaryStar.h +++ b/src/BaseBinaryStar.h @@ -267,10 +267,10 @@ class BaseBinaryStar { EVOLUTION_STATUS Evolve(); - bool PrintSwitchLog(const bool p_PrimarySwitching) { // print to the switch log file + bool PrintSwitchLog(const bool p_PrimarySwitching, const bool p_IsMerger = false) { // print to the switch log file return OPTIONS->SwitchLog() // switch logging enabled? ? (LOGGING->ObjectSwitchingPersistence() == OBJECT_PERSISTENCE::PERMANENT // yes, switch logging enabled - is this a 'permanent' object (i.e. not an ephemeral clone)? - ? LOGGING->LogBSESwitchLog(this, p_PrimarySwitching) // yes, permanent - log it + ? LOGGING->LogBSESwitchLog(this, p_PrimarySwitching, p_IsMerger) // yes, permanent - log it : true // no, ephemeral - ignore the log request ) : true; // no - switch logging not enabled - ignore the log request @@ -504,7 +504,19 @@ class BaseBinaryStar { void UpdateSystemicVelocity(Vector3d p_newVelocity) { m_SystemicVelocity += p_newVelocity; } // printing functions - + + bool LogMergerToSwitchLog() { + // switchlog merger records come in pairs - one for each star + // record merger for primary + LOGGING->SetSwitchParameters(m_ObjectId, ObjectType(), m_ObjectPersistence, m_Star1->StellarType(), m_Star1->StellarType()); // store switch details to LOGGING service + if (PrintSwitchLog(true, true)) { // record merger details to switchlog + // record merger for secondary + LOGGING->SetSwitchParameters(m_ObjectId, ObjectType(), m_ObjectPersistence, m_Star2->StellarType(), m_Star2->StellarType()); // store switch details to LOGGING service + return PrintSwitchLog(false, true); // record merger details to switchlog + } + return false; + } + bool PrintRLOFParameters(const RLOF_RECORD_TYPE p_RecordType = RLOF_RECORD_TYPE::DEFAULT); bool PrintBinarySystemParameters(const BSE_SYSPARMS_RECORD_TYPE p_RecordType = BSE_SYSPARMS_RECORD_TYPE::DEFAULT) const { diff --git a/src/BaseStar.cpp b/src/BaseStar.cpp index 500fb76d3..ded560558 100755 --- a/src/BaseStar.cpp +++ b/src/BaseStar.cpp @@ -2494,8 +2494,6 @@ double BaseStar::CalculateMassLossRateWolfRayetTemperatureCorrectionSander2023(c else { logMdotCorrected = logMdotUncorrected; } - - std::cout<(LOGFILE_DESCRIPTOR.at(LOGFILE::BSE_SUPERNOVAE)), 0, LOGFILE::BSE_SUPERNOVAE, static_cast(p_RecordType), p_Binary); } template - bool LogBSESwitchLog(const T* const p_Binary, const bool p_PrimarySwitching) { - m_PrimarySwitching = p_PrimarySwitching; + bool LogBSESwitchLog(const T* const p_Binary, const bool p_PrimarySwitching, const bool p_IsMerger) { + m_PrimarySwitching = p_PrimarySwitching; + m_SwitchIsMerger = p_IsMerger; return LogStandardRecord(std::get<2>(LOGFILE_DESCRIPTOR.at(LOGFILE::BSE_SWITCH_LOG)), 0, LOGFILE::BSE_SWITCH_LOG, 1U, p_Binary); } diff --git a/src/changelog.h b/src/changelog.h index b85e946e3..7aedd9410 100644 --- a/src/changelog.h +++ b/src/changelog.h @@ -1409,6 +1409,8 @@ // - Define a new function MainSequence::TAMSCoreMass(); use it for determining the amount of He in a star during MS mergers // - Switch both stars to Massless remnants during a CE merger, resolve #1265 // - Minor fixes, including to #1255, #1258 -const std::string VERSION_STRING = "03.09.03"; +// 03.10.00 JR - Nov 29, 2024 - Enhancement: +// - added functionality to allow stellar mergers (for BSE) to be logged to switchlog file (see documentation for details) +const std::string VERSION_STRING = "03.10.00"; # endif // __changelog_h__