Skip to content

Commit

Permalink
Merge pull request #1049 from jeffriley/issue-1048
Browse files Browse the repository at this point in the history
Fix for issue #1048
  • Loading branch information
jeffriley authored Dec 30, 2023
2 parents 0be2bc4 + 55227bd commit 09f597a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
13 changes: 6 additions & 7 deletions src/BaseBinaryStar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1541,7 +1541,7 @@ void BaseBinaryStar::ResolveCommonEnvelopeEvent() {
double k3 = m_Star1->Mass() * m_Star2->Mass() / periastronRsol; // assumes immediate circularisation at periastron at start of CE
double k4 = (endOfFirstStageMass1 * endOfFirstStageMass2);
double aFinalRsol = k4 / (k1 + k2 + k3);
m_SemiMajorAxis = aFinalRsol*RSOL_TO_AU;
m_SemiMajorAxis = aFinalRsol * RSOL_TO_AU;

// Stage 2: radiative envelope removal on a thermal timescale; assumed to be fully non-conservative
if( utils::Compare(radiativeIntershellMass1, 0.0) > 0 ) {
Expand Down Expand Up @@ -1829,8 +1829,7 @@ void BaseBinaryStar::CalculateMassTransfer(const double p_Dt) {

InitialiseMassTransfer(); // initialise - even if not using mass transfer (sets some flags we might need)

if (Unbound())
return; // do nothing for unbound binaries
if (Unbound()) return; // do nothing for unbound binaries

if (!OPTIONS->UseMassTransfer()) return; // mass transfer not enabled - nothing to do

Expand Down Expand Up @@ -2294,10 +2293,6 @@ void BaseBinaryStar::EvaluateBinary(const double p_Dt) {
m_SemiMajorAxis = std::cbrt(G_AU_Msol_yr * (m_Star1->Mass() + m_Star2->Mass()) / m_Omega / m_Omega); // re-calculate semi-major axis
m_Eccentricity = 0.0; // circularise
m_TotalAngularMomentum = CalculateAngularMomentum(); // re-calculate total angular momentum

// assign new values to "previous" values, for following timestep
m_EccentricityPrev = m_Eccentricity;
m_SemiMajorAxisPrev = m_SemiMajorAxis;
}
else { // no (real) root found

Expand Down Expand Up @@ -2328,6 +2323,10 @@ void BaseBinaryStar::EvaluateBinary(const double p_Dt) {
}
}

// assign new values to "previous" values, for following timestep
m_EccentricityPrev = m_Eccentricity;
m_SemiMajorAxisPrev = m_SemiMajorAxis;

m_Star1->UpdateMagneticFieldAndSpin(m_CEDetails.CEEnow, m_Dt * MYR_TO_YEAR * SECONDS_IN_YEAR, EPSILON_PULSAR); // update pulsar parameters for star1
m_Star2->UpdateMagneticFieldAndSpin(m_CEDetails.CEEnow, m_Dt * MYR_TO_YEAR * SECONDS_IN_YEAR, EPSILON_PULSAR); // update pulsar parameters for star2
}
Expand Down
4 changes: 3 additions & 1 deletion src/changelog.h
Original file line number Diff line number Diff line change
Expand Up @@ -1086,8 +1086,10 @@
// These changes have wider implications than just issue #1034 and may change DCO yields slightly.
// - Removed some unused functions.
// - Change to functionality (noted above) noted in 'What's New' online documentation page
// 02.41.04 JR - Dec 30, 2023 - Defect repair:
// - Fix for issue #1048

const std::string VERSION_STRING = "02.41.03";
const std::string VERSION_STRING = "02.41.04";


# endif // __changelog_h__

0 comments on commit 09f597a

Please sign in to comment.