Skip to content

Flexible initial stellar type #1375

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 53 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
4eb2e6b
added options for initial stellar type, still need to add sanity check
reinhold-willcox Dec 17, 2021
738c6cc
added parameters to handle p_InitialStellarType as input to a star
reinhold-willcox Dec 17, 2021
971298a
added stellar type into assignment for single stars
reinhold-willcox Dec 17, 2021
41bfece
added stellar type assignment for binary star components
reinhold-willcox Dec 17, 2021
9186d0f
Cleaned up initial stellar type call, to take integer input but conve…
reinhold-willcox Dec 17, 2021
f5b4e3a
Cleaned up function calls and PROGRAM_OPTIONS settings for custom ini…
reinhold-willcox Dec 17, 2021
cc4d0aa
code now compiles, and the stars get set correctly (according to stdo…
reinhold-willcox Dec 17, 2021
411abda
added check in Star::SwitchTo to switch also if setting the initial S…
reinhold-willcox Dec 17, 2021
a5f1efc
temp work
reinhold-willcox Dec 20, 2021
d9bfb70
fixed references to hurley stellar type numbers in initial stellar ty…
reinhold-willcox Dec 20, 2021
cb2ca24
changelog
reinhold-willcox Dec 20, 2021
0fcb204
cleaned up call for initial stellar type in main.cpp (it was still us…
reinhold-willcox Dec 20, 2021
8a15926
cleaned up temporary comments and string list of available stellar types
reinhold-willcox Dec 20, 2021
5a341ed
added initial stellar types to program options documentation
reinhold-willcox Dec 20, 2021
cbd0110
Merge branch 'dev' into generalized_zams_stellar_type
reinhold-willcox Jan 1, 2022
6cb9e13
fixed bitwise operators to booleans
reinhold-willcox Jan 1, 2022
eefb7dd
Merge branch 'dev' into generalized_zams_stellar_type
reinhold-willcox Jan 17, 2022
2cd2595
updated pythonSubmitDemo to use OPTIMISTIC CE assumption, and common_…
reinhold-willcox Jan 17, 2022
e44cf6e
Merge branch 'dev' into generalized_zams_stellar_type
reinhold-willcox Jan 18, 2022
7e26ee0
fixed immediate RLOF setting in pythonSubmitDemo.py
reinhold-willcox Jan 18, 2022
8030306
added fastforwarding function to correctly assign stellar attributes …
reinhold-willcox Jan 19, 2022
e3afcbb
added initial radius and initial luminosity parameters to track those…
reinhold-willcox Jan 19, 2022
8530d4e
Merge branch 'dev' into generalized_zams_stellar_type
reinhold-willcox Jan 19, 2022
09f42c2
added initial L and R to STAR_PROPS
reinhold-willcox Jan 19, 2022
a351b68
removed commented line
reinhold-willcox Jan 20, 2022
3328b01
Merge branch 'dev' into generalized_zams_stellar_type
reinhold-willcox Jan 28, 2022
e687a47
Merge branch 'dev' into generalized_zams_stellar_type
reinhold-willcox Feb 4, 2022
e28e271
Merge branch 'dev' into generalized_zams_stellar_type
reinhold-willcox Feb 6, 2022
8d56f07
fixes for jeff's requested changes
reinhold-willcox Feb 7, 2022
1f84af6
added initial temperature param
reinhold-willcox Feb 7, 2022
c41fb42
Merge branch 'dev' into generalized_zams_stellar_type
reinhold-willcox Feb 14, 2022
7a7f7cd
Merge branch 'dev' into generalized_zams_stellar_type
reinhold-willcox Mar 2, 2022
e7c625b
changes
reinhold-willcox Dec 5, 2023
d6cc65b
Merge branch 'dev' into generalized_zams_stellar_type
reinhold-willcox Dec 5, 2023
4c4b463
Merge branch 'dev' into generalized_zams_stellar_type
reinhold-willcox Dec 11, 2023
aa6d7e3
Merge branch 'dev' into generalized_zams_stellar_type
reinhold-willcox Dec 18, 2023
9b7d172
readded missing stellar properties
reinhold-willcox Jan 8, 2024
ee607bc
removed anomalous m_MomentOfIntertia and m_AngluarMomentum in NS.h, t…
reinhold-willcox Jan 8, 2024
5072f02
fixed ordering of comments in changelog
reinhold-willcox Jan 8, 2024
87094e1
returned BINARY_PROPERTY::UNBOUND to its former position after BINARY…
reinhold-willcox Jan 8, 2024
3b545c3
added new options to the end of program options list defaults
reinhold-willcox Jan 8, 2024
01a8376
Merge branch 'dev' into generalized_zams_stellar_type
reinhold-willcox Jan 8, 2024
8d547bf
Merge branch 'dev' into generalized_zams_stellar_type
reinhold-willcox Feb 26, 2024
1b01133
changelog
reinhold-willcox Feb 26, 2024
4bc8dba
Merge branch 'dev' into generalized_zams_stellar_type
reinhold-willcox Mar 26, 2024
7f7ec74
removed double ZSOL_ASPLUND def
reinhold-willcox Mar 26, 2024
0c8a0ec
Merge branch 'dev' into generalized_zams_stellar_type
reinhold-willcox May 15, 2024
a37185e
documentation
reinhold-willcox May 15, 2024
d401a3f
all the changes for non-zams initialization
reinhold-willcox Feb 13, 2025
700f6d8
git merge
reinhold-willcox Mar 14, 2025
1129c63
Merge branch 'dev' into genzams_tracked_with_dev
reinhold-willcox Apr 23, 2025
98a3569
remove auxiliary files
reinhold-willcox Apr 23, 2025
ebaed89
removed erroneously readded Lambda functions
reinhold-willcox Apr 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ Default record definition for the BSE Detailed Output log file::
BINARY_PROPERTY::UNBOUND,
BINARY_PROPERTY::SEMI_MAJOR_AXIS_RSOL,
BINARY_PROPERTY::ECCENTRICITY,
STAR_1_PROPERTY::MZAMS,
STAR_2_PROPERTY::MZAMS,
STAR_1_PROPERTY::MASS_0,
STAR_2_PROPERTY::MASS_0,
STAR_1_PROPERTY::MASS,
STAR_2_PROPERTY::MASS,
STAR_1_PROPERTY::MASS_0,
STAR_2_PROPERTY::MASS_0,
STAR_1_PROPERTY::MZAMS,
STAR_2_PROPERTY::MZAMS,
STAR_1_PROPERTY::ENV_MASS,
STAR_2_PROPERTY::ENV_MASS,
STAR_1_PROPERTY::CORE_MASS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,3 @@ Default record definition for the BSE System Parameters log file::
BINARY_PROPERTY::ERROR,
PROGRAM_OPTION::NOTES
};

Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,22 @@ Following is an alphabetical list of stellar properties available for inclusion
`Note that this property has the same header string as BINARY_PROPERTY::ID & BINARY_PROPERTY::RLOF_CURRENT_ID. It is expected that one or
the other is printed in any file, but not both. If both are printed then the file will contain two columns with the same header string.`

.. flat-table::
:widths: 25 75 1 1
:header-rows: 0
:class: aligned-text

* - :cspan:`2` **INITIAL_RADIUS**
-
* - Data type:
- DOUBLE
* - COMPAS variable:
- BaseStar::m_InitialRadius
* - Description:
- Initial radius of the star at the beginning of the simulation
* - Header Strings:
- Initial_Radius(1), Initial_Radius(2)

.. flat-table::
:widths: 25 75 1 1
:header-rows: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,24 @@ Default = 5.0
Single power law power to generate primary mass using ``POWERLAW`` IMF. |br|
Default = 0.0

**--initial-stellar-type** |br|
Initial stellar type for a single star when evolving in SSE mode. |br|
Options: { MS, HeMS, HeWD, COWD, ONeWD, NS, BH } |br|
Corresponding to Main Sequence, Helium Main Sequence, Helium White Dwarf, Carbon-Oxygen White Dwarf, Oxygen-Neon White Dwarf, Neutron Star, and Black Hole.
Default = MS

**--initial-stellar-type-1** |br|
Initial stellar type for the primary star when evolving in BSE mode |br|
Options: { MS, HeMS, HeWD, COWD, ONeWD, NS, BH } |br|
Corresponding to Main Sequence, Helium Main Sequence, Helium White Dwarf, Carbon-Oxygen White Dwarf, Oxygen-Neon White Dwarf, Neutron Star, and Black Hole.
Default = MS

**--initial-stellar-type-2** |br|
Initial stellar type for the secondary star when evolving in BSE mode |br|
Options: { MS, HeMS, HeWD, COWD, ONeWD, NS, BH } |br|
Corresponding to Main Sequence, Helium Main Sequence, Helium White Dwarf, Carbon-Oxygen White Dwarf, Oxygen-Neon White Dwarf, Neutron Star, and Black Hole.
Default = MS

.. _options-props-J:

.. _options-props-K:
Expand Down Expand Up @@ -1464,6 +1482,8 @@ Go to :ref:`the top of this page <options-props-top>` for the full alphabetical

--initial-mass-function, --initial-mass, --initial-mass-1, --initial-mass-2, --initial-mass-min, --initial-mass-max, --initial-mass-power

--initial-stellar-type, --initial-stellar-type-1, --initial-stellar-type-2

--mass-ratio-distribution, --mass-ratio, --mass-ratio-min, --mass-ratio-max, --minimum-secondary-mass

--eccentricity-distribution, --eccentricity, --eccentricity-min, --eccentricity-max
Expand Down
15 changes: 13 additions & 2 deletions src/BH.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,20 @@ class BH: virtual public BaseStar, public Remnants {
m_Mass0 = 0.0;

EvolveOnPhase(0.0);
}

}

void FastForward() { // Set stellar attributes for stars initialized to this stellar type

m_Radius = CalculateRadiusOnPhase();
m_Luminosity = CalculateLuminosityOnPhase();

m_InitialLuminosity = m_Luminosity;
m_InitialRadius = m_Radius;
m_InitialStellarType = m_StellarType;
m_StellarTypePrev = m_StellarType;
}


// member functions - alphabetically
double CalculateConvergedMassStepZetaNuclear() const { return 0.0; }
double CalculateEddingtonCriticalRate() const { return 2.6E-8 * m_Mass * MYR_TO_YEAR; } // E.g., Marchant+, 2017, Eq. 3, assuming accretion efficiency of 10%
Expand Down
68 changes: 40 additions & 28 deletions src/BaseBinaryStar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ BaseBinaryStar::BaseBinaryStar(const unsigned long int p_Seed, const long int p_

mass2 = mass1 * q; // calculate mass2 using mass ratio
}

STELLAR_TYPE initialStellarType1 = OPTIONS->InitialStellarType1(); // Get primary stellar type, possibly user specified
STELLAR_TYPE initialStellarType2 = OPTIONS->InitialStellarType2(); // Get secondary stellar type, possibly user specified

double metallicity = !OPTIONS->OptionDefaulted("metallicity") // user specified metallicity?
? OPTIONS->Metallicity() // yes, use it
Expand Down Expand Up @@ -158,12 +161,12 @@ BaseBinaryStar::BaseBinaryStar(const unsigned long int p_Seed, const long int p_
// binary star contains two instances of star to hold masses, radii and luminosities.
// star 1 initially more massive
m_Star1 = !OPTIONS->OptionDefaulted("rotational-frequency-1") // user specified primary rotational frequency?
? new BinaryConstituentStar(m_RandomSeed, mass1, metallicity, kickParameters1, OPTIONS->RotationalFrequency1() * SECONDS_IN_YEAR) // yes - use it (convert from Hz to cycles per year - see BaseStar::CalculateZAMSAngularFrequency())
: new BinaryConstituentStar(m_RandomSeed, mass1, metallicity, kickParameters1); // no - let it be calculated
? new BinaryConstituentStar(m_RandomSeed, mass1, initialStellarType1, metallicity, kickParameters1, OPTIONS->RotationalFrequency1() * SECONDS_IN_YEAR) // yes - use it (convert from Hz to cycles per year - see BaseStar::CalculateZAMSAngularFrequency())
: new BinaryConstituentStar(m_RandomSeed, mass1, initialStellarType1, metallicity, kickParameters1); // no - let it be calculated

m_Star2 = !OPTIONS->OptionDefaulted("rotational-frequency-2") // user specified secondary rotational frequency?
? new BinaryConstituentStar(m_RandomSeed, mass2, metallicity, kickParameters2, OPTIONS->RotationalFrequency2() * SECONDS_IN_YEAR) // yes - use it (convert from Hz to cycles per year - see BaseStar::CalculateZAMSAngularFrequency())
: new BinaryConstituentStar(m_RandomSeed, mass2, metallicity, kickParameters2); // no - let it be calculated
? new BinaryConstituentStar(m_RandomSeed, mass2, initialStellarType2, metallicity, kickParameters2, OPTIONS->RotationalFrequency2() * SECONDS_IN_YEAR) // yes - use it (convert from Hz to cycles per year - see BaseStar::CalculateZAMSAngularFrequency())
: new BinaryConstituentStar(m_RandomSeed, mass2, initialStellarType2, metallicity, kickParameters2); // no - let it be calculated

double starToRocheLobeRadiusRatio1 = (m_Star1->Radius() * RSOL_TO_AU) / (m_SemiMajorAxis * (1.0 - m_Eccentricity) * CalculateRocheLobeRadius_Static(mass1, mass2));
double starToRocheLobeRadiusRatio2 = (m_Star2->Radius() * RSOL_TO_AU) / (m_SemiMajorAxis * (1.0 - m_Eccentricity) * CalculateRocheLobeRadius_Static(mass2, mass1));
Expand All @@ -188,13 +191,13 @@ BaseBinaryStar::BaseBinaryStar(const unsigned long int p_Seed, const long int p_
// create new stars with equal masses - all other ZAMS values recalculated
delete m_Star1;
m_Star1 = !OPTIONS->OptionDefaulted("rotational-frequency-1") // user specified primary rotational frequency?
? new BinaryConstituentStar(m_RandomSeed, mass1, metallicity, kickParameters1, OPTIONS->RotationalFrequency1() * SECONDS_IN_YEAR) // yes - use it (convert from Hz to cycles per year - see BaseStar::CalculateZAMSAngularFrequency())
: new BinaryConstituentStar(m_RandomSeed, mass1, metallicity, kickParameters1); // no - let it be calculated
? new BinaryConstituentStar(m_RandomSeed, mass1, initialStellarType1, metallicity, kickParameters1, OPTIONS->RotationalFrequency1() * SECONDS_IN_YEAR) // yes - use it (convert from Hz to cycles per year - see BaseStar::CalculateZAMSAngularFrequency())
: new BinaryConstituentStar(m_RandomSeed, mass1, initialStellarType1, metallicity, kickParameters1); // no - let it be calculated

delete m_Star2;
m_Star2 = !OPTIONS->OptionDefaulted("rotational-frequency-2") // user specified secondary rotational frequency?
? new BinaryConstituentStar(m_RandomSeed, mass2, metallicity, kickParameters2, OPTIONS->RotationalFrequency2() * SECONDS_IN_YEAR) // yes - use it (convert from Hz to cycles per year - see BaseStar::CalculateZAMSAngularFrequency())
: new BinaryConstituentStar(m_RandomSeed, mass2, metallicity, kickParameters2); // no - let it be calculated
? new BinaryConstituentStar(m_RandomSeed, mass2, initialStellarType2, metallicity, kickParameters2, OPTIONS->RotationalFrequency2() * SECONDS_IN_YEAR) // yes - use it (convert from Hz to cycles per year - see BaseStar::CalculateZAMSAngularFrequency())
: new BinaryConstituentStar(m_RandomSeed, mass2, initialStellarType2, metallicity, kickParameters2); // no - let it be calculated

starToRocheLobeRadiusRatio1 = (m_Star1->Radius() * RSOL_TO_AU) / (m_SemiMajorAxis * CalculateRocheLobeRadius_Static(mass1, mass2)); //eccentricity already zero
starToRocheLobeRadiusRatio2 = (m_Star2->Radius() * RSOL_TO_AU) / (m_SemiMajorAxis * CalculateRocheLobeRadius_Static(mass2, mass1));
Expand Down Expand Up @@ -301,33 +304,42 @@ void BaseBinaryStar::SetRemainingValues() {

// check for CHE
//
// because we've changed the rotational frequency of the constituent stars we
// have to reset the stellar type - at this stage, based on their rotational
// frequency at birth, they may have already been assigned one of MS_LTE_07,
// MS_GT_07, or CHEMICALLY_HOMOGENEOUS (ignore if assigned a more evolved type)
//
// here we need to change from MS_* -> CH, or from CH->MS* based on the binary orbital frequency, assuming that the stars are tidally locked
// set the spin to the orbital frequency, unless the user has specified a spin frequency

// star 1
if (utils::Compare(omega, m_Star1->OmegaCHE()) >= 0) { // star 1 CH?
if (m_Star1->StellarType() != STELLAR_TYPE::CHEMICALLY_HOMOGENEOUS) {
(void)m_Star1->SwitchTo(STELLAR_TYPE::CHEMICALLY_HOMOGENEOUS, true); // yes, switch if not already Chemically Homogeneous
if (OPTIONS->OptionDefaulted("rotational-frequency-1")) m_Star1->SetOmega(omega); } // set spin to orbital frequency unless user specified
}
else if (m_Star1->MZAMS() <= 0.7) { // no - MS - initial mass determines actual type (don't use utils::Compare() here)
if (m_Star1->StellarType() != STELLAR_TYPE::MS_LTE_07) (void)m_Star1->SwitchTo(STELLAR_TYPE::MS_LTE_07, true); // MS <= 0.7 Msol - switch if necessary
}
else {
if (m_Star1->StellarType() != STELLAR_TYPE::MS_GT_07) (void)m_Star1->SwitchTo(STELLAR_TYPE::MS_GT_07, true); // MS > 0.7 Msol - switch if necessary
if (m_Star1->IsOneOf({ STELLAR_TYPE::MS_LTE_07, STELLAR_TYPE::MS_GT_07, STELLAR_TYPE::CHEMICALLY_HOMOGENEOUS })) {
if (utils::Compare(omega, m_Star1->OmegaCHE()) >= 0) { // star 1 CH?
if (m_Star1->StellarType() != STELLAR_TYPE::CHEMICALLY_HOMOGENEOUS) {
(void)m_Star1->SwitchTo(STELLAR_TYPE::CHEMICALLY_HOMOGENEOUS, true); // yes, switch if not already Chemically Homogeneous
if (OPTIONS->OptionDefaulted("rotational-frequency-1")) m_Star1->SetOmega(omega); } // set spin to orbital frequency unless user specified
}
else if (m_Star1->MZAMS() <= 0.7) { // no - MS - initial mass determines actual type (don't use utils::Compare() here)
if (m_Star1->StellarType() != STELLAR_TYPE::MS_LTE_07) (void)m_Star1->SwitchTo(STELLAR_TYPE::MS_LTE_07, true); // MS <= 0.7 Msol - switch if necessary
}
else {
if (m_Star1->StellarType() != STELLAR_TYPE::MS_GT_07) (void)m_Star1->SwitchTo(STELLAR_TYPE::MS_GT_07, true); // MS > 0.7 Msol - switch if necessary
}
}

// star 2
if (utils::Compare(omega, m_Star2->OmegaCHE()) >= 0) { // star 2 CH?
if (m_Star2->StellarType() != STELLAR_TYPE::CHEMICALLY_HOMOGENEOUS) {
(void)m_Star2->SwitchTo(STELLAR_TYPE::CHEMICALLY_HOMOGENEOUS, true); // yes, switch if not already Chemically Homogeneous
if (OPTIONS->OptionDefaulted("rotational-frequency-2")) m_Star2->SetOmega(omega); } // set spin to orbital frequency unless user specified
}
else if (m_Star2->MZAMS() <= 0.7) { // no - MS - initial mass determines actual type (don't use utils::Compare() here)
if (m_Star2->StellarType() != STELLAR_TYPE::MS_LTE_07) (void)m_Star2->SwitchTo(STELLAR_TYPE::MS_LTE_07, true); // MS <= 0.0 Msol - switch if necessary
}
else {
if (m_Star2->StellarType() != STELLAR_TYPE::MS_GT_07) (void)m_Star2->SwitchTo(STELLAR_TYPE::MS_GT_07, true); // MS > 0.7 Msol - switch if necessary
if (m_Star2->IsOneOf({ STELLAR_TYPE::MS_LTE_07, STELLAR_TYPE::MS_GT_07, STELLAR_TYPE::CHEMICALLY_HOMOGENEOUS })) {
if (utils::Compare(omega, m_Star2->OmegaCHE()) >= 0) { // star 2 CH?
if (m_Star2->StellarType() != STELLAR_TYPE::CHEMICALLY_HOMOGENEOUS) {
(void)m_Star2->SwitchTo(STELLAR_TYPE::CHEMICALLY_HOMOGENEOUS, true); // yes, switch if not already Chemically Homogeneous
if (OPTIONS->OptionDefaulted("rotational-frequency-2")) m_Star2->SetOmega(omega); } // set spin to orbital frequency unless user specified
}
else if (m_Star2->MZAMS() <= 0.7) { // no - MS - initial mass determines actual type (don't use utils::Compare() here)
if (m_Star2->StellarType() != STELLAR_TYPE::MS_LTE_07) (void)m_Star2->SwitchTo(STELLAR_TYPE::MS_LTE_07, true); // MS <= 0.0 Msol - switch if necessary
}
else {
if (m_Star2->StellarType() != STELLAR_TYPE::MS_GT_07) (void)m_Star2->SwitchTo(STELLAR_TYPE::MS_GT_07, true); // MS > 0.7 Msol - switch if necessary
}
}

}
Expand Down
Loading