diff --git a/src/BaseStar.cpp b/src/BaseStar.cpp index 3ffb1a8ec..00872b64c 100755 --- a/src/BaseStar.cpp +++ b/src/BaseStar.cpp @@ -2802,6 +2802,7 @@ void BaseStar::ResolveMassLoss(const bool p_UpdateMDt) { STELLAR_TYPE st = UpdateAttributesAndAgeOneTimestep(mass - m_Mass, 0.0, 0.0, false, false); // recalculate stellar attributes if (st != m_StellarType) { // should switch? SHOW_WARN(ERROR::SWITCH_NOT_TAKEN); // show warning if we think we should switch again... + if (IsSupernova()) ClearSupernovaStash(); // we may have stashed SN details - need to clear them if we're not going to switch } UpdateInitialMass(); // update effective initial mass (MS, HG & HeMS) diff --git a/src/BaseStar.h b/src/BaseStar.h index 551e22da2..a8e4b4d06 100644 --- a/src/BaseStar.h +++ b/src/BaseStar.h @@ -71,6 +71,7 @@ class BaseStar { bool IsHeSD() const { return (m_SupernovaDetails.events.current & SN_EVENT::HeSD) == SN_EVENT::HeSD; } virtual bool IsDegenerate() const { return false; } // default is not degenerate - White Dwarfs, NS and BH are degenerate bool IsECSN() const { return (m_SupernovaDetails.events.current & SN_EVENT::ECSN) == SN_EVENT::ECSN; } + bool IsSN_NONE() const { return m_SupernovaDetails.events.current == SN_EVENT::NONE; } bool IsOneOf(const STELLAR_TYPE_LIST p_List) const; bool IsPISN() const { return (m_SupernovaDetails.events.current & SN_EVENT::PISN) == SN_EVENT::PISN; } bool IsPPISN() const { return (m_SupernovaDetails.events.current & SN_EVENT::PPISN) == SN_EVENT::PPISN; } @@ -219,20 +220,19 @@ class BaseStar { virtual double CalculateZetaConstantsByEnvelope(ZETA_PRESCRIPTION p_ZetaPrescription) { return 0.0; } // Use inheritance hierarchy void ClearCurrentSNEvent() { m_SupernovaDetails.events.current = SN_EVENT::NONE; } // Clear supernova event/state for current timestep + void ClearSupernovaStash() { LOGGING->ClearSSESupernovaStash(); } // Clear contents of SSE supernova stash + + virtual ACCRETION_REGIME DetermineAccretionRegime(const bool p_HeRich, + const double p_DonorThermalMassLossRate) { return ACCRETION_REGIME::NONE; } // Placeholder, use inheritance for WDs virtual ENVELOPE DetermineEnvelopeType() const { return ENVELOPE::REMNANT; } // Default is REMNANT - but should never be called void HaltWinds() { m_Mdot = 0.0; } // Disable wind mass loss in current time step (e.g., if star is a donor or accretor in a RLOF episode) - virtual ACCRETION_REGIME DetermineAccretionRegime(const bool p_HeRich, - const double p_DonorThermalMassLossRate) { return ACCRETION_REGIME::NONE; } // Placeholder, use inheritance for WDs + double InterpolateGe20QCrit(const QCRIT_PRESCRIPTION p_qCritPrescription); void ResetEnvelopeExpulsationByPulsations() { m_EnvelopeJustExpelledByPulsations = false; } - virtual void ResolveShellChange(const double p_AccretedMass) { } // Default does nothing, use inheritance for WDs. - - double InterpolateGe20QCrit(const QCRIT_PRESCRIPTION p_qCritPrescription); - void ResolveAccretion(const double p_AccretionMass) { m_Mass = std::max(0.0, m_Mass + p_AccretionMass); } // Handles donation and accretion - won't let mass go negative virtual void ResolveAccretionRegime(const ACCRETION_REGIME p_Regime, @@ -241,6 +241,8 @@ class BaseStar { virtual STELLAR_TYPE ResolveEnvelopeLoss(bool p_NoCheck = false) { return m_StellarType; } virtual void ResolveMassLoss(const bool p_UpdateMDt = true); + + virtual void ResolveShellChange(const double p_AccretedMass) { } // Default does nothing, use inheritance for WDs. void SetStellarTypePrev(const STELLAR_TYPE p_StellarTypePrev) { m_StellarTypePrev = p_StellarTypePrev; } diff --git a/src/GiantBranch.cpp b/src/GiantBranch.cpp index 842c73378..3041265b6 100644 --- a/src/GiantBranch.cpp +++ b/src/GiantBranch.cpp @@ -2041,6 +2041,7 @@ STELLAR_TYPE GiantBranch::ResolveSupernova() { STELLAR_TYPE stellarType = m_StellarType; if (IsSupernova()) { // has gone supernova + // no - resolve new supernova event // squirrel away some attributes before they get changed... m_SupernovaDetails.totalMassAtCOFormation = m_Mass; m_SupernovaDetails.HeCoreMassAtCOFormation = m_HeCoreMass; diff --git a/src/Log.h b/src/Log.h index 2610dec71..a55c35ac1 100755 --- a/src/Log.h +++ b/src/Log.h @@ -1218,6 +1218,11 @@ class Log { bool LogSSESystemParameters(const T* const p_Star, const SSE_SYSPARMS_RECORD_TYPE p_RecordType) { return LogStandardRecord(std::get<2>(LOGFILE_DESCRIPTOR.at(LOGFILE::SSE_SYSTEM_PARAMETERS)), 0, LOGFILE::SSE_SYSTEM_PARAMETERS, static_cast(p_RecordType), p_Star); } + void ClearSSESupernovaStash() { + m_SSESupernovae_DelayedWrite.logRecordType = 0; // delayed log record type for SSE_Supernovae file - initially 0 (set later) + m_SSESupernovae_DelayedWrite.logRecordString = ""; // delayed log record (string) for SSE_Supernovae file - initially empty + m_SSESupernovae_DelayedWrite.logRecordValues = {}; // delayed log record (property values) for SSE_Supernovae file - initially empty + } template void StashSSESupernovaDetails(const T* const p_Star, const STELLAR_TYPE p_StellarType, const SSE_SN_RECORD_TYPE p_RecordType) { diff --git a/src/Star.cpp b/src/Star.cpp index 4bf414010..7e04422a8 100644 --- a/src/Star.cpp +++ b/src/Star.cpp @@ -559,6 +559,8 @@ EVOLUTION_STATUS Star::Evolve(const long int p_Id) { SHOW_WARN(ERROR::TIMESTEPS_NOT_CONSUMED); // show warning } + (void)m_Star->PrintStashedSupernovaDetails(); // print final stashed SSE Supernova log record if necessary + (void)m_Star->PrintDetailedOutput(m_Id, SSE_DETAILED_RECORD_TYPE::FINAL_STATE); // log record m_Star->SetEvolutionStatus(evolutionStatus); // set evolution final outcome for star diff --git a/src/WhiteDwarfs.cpp b/src/WhiteDwarfs.cpp index a2b1790ce..249f57b69 100644 --- a/src/WhiteDwarfs.cpp +++ b/src/WhiteDwarfs.cpp @@ -47,7 +47,7 @@ double WhiteDwarfs::CalculateEtaH(const double p_MassTransferRate) { * table A1. The thresholds here are named by the boundaries RG/SS, SS/MF, and SF/Dt, * respectively (see text for details). Note that the different flashes regimes from * Piersanti+ 2014 have been merged into one, i.e we omit the MF/SF boundary, and - * the accumulation regime has been change so we can get double detonations. Finally, + * the accumulation regime has been changed so we can get double detonations. Finally, * eta_KH04 has also been updated with the accretion efficiency values from Piersanti+ 2014. * * double CalculateEtaHe(const double p_MassTransferRate) diff --git a/src/changelog.h b/src/changelog.h index 4334b5e37..fc7651235 100644 --- a/src/changelog.h +++ b/src/changelog.h @@ -1117,8 +1117,9 @@ // - Added Hirai pulsar rocket kick, and related options // 02.43.01 SS - Apr 8, 2024 - Defect repair // - Fix CalculateMassLossRateBjorklundEddingtonFactor to use LSOLW (in SI) rather than LSOL (in cgs) -// +// 02.43.02 JR - Apr 15, 2024 - Defect repair +// - Fix for issue #1074 - SSE Supernova records duplicated -const std::string VERSION_STRING = "02.43.01"; +const std::string VERSION_STRING = "02.43.02"; # endif // __changelog_h__