Skip to content

Commit

Permalink
Fix for issue 1317
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffriley committed Jan 7, 2025
1 parent 3bcc530 commit 4828e30
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
24 changes: 13 additions & 11 deletions src/BaseBinaryStar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2908,8 +2908,8 @@ void BaseBinaryStar::EvaluateBinary(const double p_Dt) {
}
}

if (!StellarMerger()) { // stellar merger?
// no - continue evolution
if (!StellarMerger() || (HasOneOf({ STELLAR_TYPE::MASSLESS_REMNANT }) && OPTIONS->EvolveMainSequenceMergers())) { // check stellar merger or evolving MS mergers
// continue evolution
if ((m_Star1->IsSNevent() || m_Star2->IsSNevent())) {
EvaluateSupernovae(); // evaluate supernovae (both stars) if mass changes are responsible for a supernova
(void)PrintDetailedOutput(m_Id, BSE_DETAILED_RECORD_TYPE::POST_SN); // print (log) detailed output
Expand Down Expand Up @@ -3163,23 +3163,25 @@ EVOLUTION_STATUS BaseBinaryStar::Evolve() {
}
}

(void)PrintDetailedOutput(m_Id, BSE_DETAILED_RECORD_TYPE::PRE_STELLAR_TIMESTEP); // print (log) detailed output

if (evolutionStatus == EVOLUTION_STATUS::CONTINUE) { // continue evolution?
// yes
(void)PrintDetailedOutput(m_Id, BSE_DETAILED_RECORD_TYPE::PRE_STELLAR_TIMESTEP); // print (log) detailed output

error = EvolveOneTimestep(dt); // evolve the binary system one timestep
if (error != ERROR::NONE) { // SSE error for either constituent star?
evolutionStatus = EVOLUTION_STATUS::SSE_ERROR; // yes - stop evolution
}
else { // continue evolution
}

(void)PrintDetailedOutput(m_Id, BSE_DETAILED_RECORD_TYPE::TIMESTEP_COMPLETED); // print (log) detailed output: this is after all changes made in the timestep
(void)PrintDetailedOutput(m_Id, BSE_DETAILED_RECORD_TYPE::TIMESTEP_COMPLETED); // print (log) detailed output: this is after all changes made in the timestep

if (stepNum >= OPTIONS->MaxNumberOfTimestepIterations()) evolutionStatus = EVOLUTION_STATUS::STEPS_UP; // number of timesteps for evolution exceeds maximum
else if (evolutionStatus == EVOLUTION_STATUS::CONTINUE && usingProvidedTimesteps && stepNum >= timesteps.size()) { // using user-provided timesteps and all consumed
evolutionStatus = EVOLUTION_STATUS::TIMESTEPS_EXHAUSTED; // yes - set status
SHOW_WARN(ERROR::TIMESTEPS_EXHAUSTED); // show warning
}

if (evolutionStatus == EVOLUTION_STATUS::CONTINUE) { // continue evolution?
// yes
if (stepNum >= OPTIONS->MaxNumberOfTimestepIterations()) evolutionStatus = EVOLUTION_STATUS::STEPS_UP; // number of timesteps for evolution exceeds maximum
else if (evolutionStatus == EVOLUTION_STATUS::CONTINUE && usingProvidedTimesteps && stepNum >= timesteps.size()) { // using user-provided timesteps and all consumed
evolutionStatus = EVOLUTION_STATUS::TIMESTEPS_EXHAUSTED; // yes - set status
SHOW_WARN(ERROR::TIMESTEPS_EXHAUSTED); // show warning
}

if (evolutionStatus == EVOLUTION_STATUS::CONTINUE) { // continue evolution?
Expand Down
6 changes: 5 additions & 1 deletion src/changelog.h
Original file line number Diff line number Diff line change
Expand Up @@ -1423,7 +1423,11 @@
// - fix for issue #1310 - run terminates prematurely if error in grid file
// 03.10.04 RTW - Nov 27, 2024 - Defect repair:
// - fix for issue #1247 - SN Euler angles had incomplete logic, leading to a div by zero in some cases
// 03.10.05 JR - Jan 08, 2024 - Defect repair:
// - fix for issue #1317 - SN events not always logged in BSE SN file when evolving MS merger products
// - added code to ensure final BSE detailed output file TIMESTEP_COMPLETED record is always logged
// (may duplicate FINAL_STATE record, but logging TIMESTEP_COMPLETED is consistent, and it's what most people look for)

const std::string VERSION_STRING = "03.10.04";
const std::string VERSION_STRING = "03.10.05";

# endif // __changelog_h__

0 comments on commit 4828e30

Please sign in to comment.