Skip to content

Commit a4b18ea

Browse files
authored
Merge pull request #1361 from brcekadam/ChangeCalculateRadiusOnPhase
Fixes and enhancements to BRCEK core mass prescription
2 parents f0605e1 + a2dd709 commit a4b18ea

File tree

10 files changed

+141
-135
lines changed

10 files changed

+141
-135
lines changed

src/BaseBinaryStar.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2970,7 +2970,13 @@ double BaseBinaryStar::ChooseTimestep(const double p_Multiplier) {
29702970
if ((utils::Compare(radiusToRL1 * (1.0 + 2.0 * OPTIONS->RadialChangeFraction()), 1.0) >= 0 && utils::Compare(radiusToRL1 * (1.0 + 0.5 * OPTIONS->RadialChangeFraction()), 1.0) <= 0) ||
29712971
(utils::Compare(radiusToRL2 * (1.0 + 2.0 * OPTIONS->RadialChangeFraction()), 1.0) >= 0 && utils::Compare(radiusToRL2 * (1.0 + 0.5 * OPTIONS->RadialChangeFraction()), 1.0) <= 0))
29722972
dt /= 2.0;
2973-
2973+
2974+
// limit time step for stars losing mass on nuclear timescale
2975+
if (utils::Compare(radiusToRL1 * (1.0 + 0.5 * OPTIONS->RadialChangeFraction()), 1.0) > 0)
2976+
dt = std::min(dt, 0.5 * OPTIONS->RadialChangeFraction() * m_Star1->CalculateRadialExpansionTimescaleDuringMassTransfer());
2977+
if (utils::Compare(radiusToRL2 * (1.0 + 0.5 * OPTIONS->RadialChangeFraction()), 1.0) > 0)
2978+
dt = std::min(dt, 0.5 * OPTIONS->RadialChangeFraction() * m_Star2->CalculateRadialExpansionTimescaleDuringMassTransfer());
2979+
29742980
if (OPTIONS->EmitGravitationalRadiation()) { // emitting GWs?
29752981
dt = std::min(dt, -1.0E-2 * m_SemiMajorAxis / m_DaDtGW); // yes - reduce timestep if necessary to ensure that the orbital separation does not change by more than ~1% per timestep due to GW emission
29762982
}

src/BaseStar.cpp

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2569,33 +2569,6 @@ double BaseStar::CalculateMassLossRate() {
25692569
}
25702570

25712571

2572-
/*
2573-
* Calculate the nuclear mass loss rate as the mass divided by the radial expansion timescale
2574-
* We do not use CalculateRadialExpansionTimescale(), however, since in the process of mass transfer the previous radius
2575-
* is determined by binary evolution, not nuclear timescale evolution
2576-
*
2577-
*
2578-
* double CalculateNuclearMassLossRate()
2579-
*
2580-
* @return Nuclear mass loss rate
2581-
*/
2582-
double BaseStar::CalculateNuclearMassLossRate() {
2583-
2584-
// We create and age it slightly to determine how the radius will change.
2585-
// To be sure the clone does not participate in logging, we set its persistence to EPHEMERAL.
2586-
BaseStar *clone = Clone(OBJECT_PERSISTENCE::EPHEMERAL, false); // do not re-initialise the clone
2587-
2588-
double timestep = std::max(1000.0 * NUCLEAR_MINIMUM_TIMESTEP, m_Age / 1.0E6);
2589-
clone->UpdateAttributesAndAgeOneTimestep(0.0, 0.0, timestep, true, false);
2590-
double radiusAfterAging = clone->Radius();
2591-
delete clone; clone = nullptr; // return the memory allocated for the clone
2592-
2593-
double radialExpansionTimescale = timestep * m_Radius / fabs(m_Radius - radiusAfterAging);
2594-
2595-
return m_Mass / radialExpansionTimescale;
2596-
}
2597-
2598-
25992572
/*
26002573
* Calculate values for mDot and mass assuming mass loss is applied
26012574
*
@@ -3684,6 +3657,31 @@ double BaseStar::CalculateRadialExpansionTimescale_Static(const STELLAR_TYPE p_S
36843657
}
36853658

36863659

3660+
/*
3661+
* Calculate the radial expansion timescale in the mass transfer regime
3662+
* We do not use CalculateRadialExpansionTimescale(), since in the process of mass transfer the previous radius
3663+
* is determined by binary evolution, not nuclear timescale evolution
3664+
*
3665+
*
3666+
* double CalculateRadialExpansionTimescaleDuringMassTransfer()
3667+
*
3668+
* @return Radial expansion timescale
3669+
*/
3670+
double BaseStar::CalculateRadialExpansionTimescaleDuringMassTransfer() {
3671+
3672+
// We create and age it slightly to determine how the radius will change.
3673+
// To be sure the clone does not participate in logging, we set its persistence to EPHEMERAL.
3674+
BaseStar *clone = Clone(OBJECT_PERSISTENCE::EPHEMERAL, false); // do not re-initialise the clone
3675+
3676+
double timestep = std::max(1000.0 * NUCLEAR_MINIMUM_TIMESTEP, m_Age / 1.0E6);
3677+
clone->UpdateAttributesAndAgeOneTimestep(0.0, 0.0, timestep, true, false);
3678+
double radiusAfterAging = clone->Radius();
3679+
delete clone; clone = nullptr; // return the memory allocated for the clone
3680+
3681+
return timestep * m_Radius / fabs(m_Radius - radiusAfterAging);
3682+
}
3683+
3684+
36873685
/*
36883686
* Calculate mass change timescale
36893687
*

src/BaseStar.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ class BaseStar {
260260
virtual double CalculateMomentOfInertia() const { return (0.1 * (m_Mass) * m_Radius * m_Radius); } // Defaults to MS. k2 = 0.1 as defined in Hurley et al. 2000, after eq 109
261261
virtual double CalculateMomentOfInertiaAU() const { return CalculateMomentOfInertia() * RSOL_TO_AU * RSOL_TO_AU; }
262262

263-
double CalculateNuclearMassLossRate();
263+
double CalculateNuclearMassLossRate() { return m_Mass / CalculateRadialExpansionTimescaleDuringMassTransfer(); }
264264

265265
double CalculateOmegaCHE(const double p_MZAMS, const double p_Metallicity) const;
266266

@@ -270,6 +270,8 @@ class BaseStar {
270270

271271
double CalculateRadialExpansionTimescale() const { return CalculateRadialExpansionTimescale_Static(m_StellarType, m_StellarTypePrev, m_Radius, m_RadiusPrev, m_DtPrev); } // Use class member variables
272272

273+
double CalculateRadialExpansionTimescaleDuringMassTransfer();
274+
273275
virtual double CalculateRadialExtentConvectiveEnvelope() const { return 0.0; } // Default for stars with no convective envelope
274276

275277
virtual double CalculateRadiusOnMassChange(double p_dM) { return Radius(); } // NO-OP

src/HG.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,14 @@ class HG: virtual public BaseStar, public GiantBranch {
9090
double CalculateHeliumAbundanceCoreOnPhase() const { return 1.0 - m_Metallicity; } // Use class member variables
9191

9292
double CalculateHeliumAbundanceSurfaceAtPhaseEnd() const { return CalculateHeliumAbundanceSurfaceOnPhase(); }
93-
double CalculateHeliumAbundanceSurfaceOnPhase() const { return m_InitialHeliumAbundance; } // Use class member variables
93+
double CalculateHeliumAbundanceSurfaceOnPhase() const { return m_HeliumAbundanceSurface; } // Use class member variables
9494

9595
double CalculateHydrogenAbundanceCoreAtPhaseEnd() const { return CalculateHydrogenAbundanceCoreOnPhase(); }
9696
double CalculateHydrogenAbundanceCoreOnPhase(const double p_Tau) const;
9797
double CalculateHydrogenAbundanceCoreOnPhase() const { return 0.0; } // Star has exhausted hydrogen in its core
9898

9999
double CalculateHydrogenAbundanceSurfaceAtPhaseEnd() const { return CalculateHydrogenAbundanceSurfaceOnPhase(); }
100-
double CalculateHydrogenAbundanceSurfaceOnPhase() const { return m_InitialHydrogenAbundance; } // Use class member variables
100+
double CalculateHydrogenAbundanceSurfaceOnPhase() const { return m_HydrogenAbundanceSurface; } // Use class member variables
101101

102102

103103

src/MS_gt_07.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class MS_gt_07: virtual public BaseStar, public MainSequence {
5151
m_InitialMainSequenceCoreMass = MainSequence::CalculateInitialMainSequenceCoreMass(m_MZAMS);
5252
m_MainSequenceCoreMass = m_InitialMainSequenceCoreMass;
5353
m_Luminosity = MainSequence::CalculateLuminosityOnPhase(m_Age, m_Mass0, m_LZAMS0);
54-
m_Radius = MainSequence::CalculateRadiusOnPhase(m_Mass, m_Age, m_RZAMS0);
54+
m_Radius = MainSequence::CalculateRadiusOnPhase(m_Mass, m_Tau, m_RZAMS0);
5555
m_Temperature = BaseStar::CalculateTemperatureOnPhase_Static(m_Luminosity, m_Radius);
5656
}
5757
}

0 commit comments

Comments
 (0)