From 573e9bc9ab93b1eb6bd5ab20efaf3a3f7eebbd8d Mon Sep 17 00:00:00 2001 From: Jeff Riley Date: Sat, 9 Aug 2025 17:01:42 +1000 Subject: [PATCH 1/6] Issue 1211 + minor fixes --- .../program-options-list-defaults.rst | 4 ++-- online-docs/pages/whats-new.rst | 10 ++++++++++ src/BaseBinaryStar.cpp | 4 ++-- src/BaseStar.cpp | 12 ++++++------ src/Makefile | 2 +- src/Options.cpp | 6 ------ src/Options.h | 15 +++++++++++---- src/changelog.h | 15 ++++++++++++++- 8 files changed, 46 insertions(+), 22 deletions(-) diff --git a/online-docs/pages/User guide/Program options/program-options-list-defaults.rst b/online-docs/pages/User guide/Program options/program-options-list-defaults.rst index 48514ee94..de57cc973 100644 --- a/online-docs/pages/User guide/Program options/program-options-list-defaults.rst +++ b/online-docs/pages/User guide/Program options/program-options-list-defaults.rst @@ -518,7 +518,7 @@ Default = Sampled from the mass ratio distribution specified by ``--mass-ratio-d **--initial-mass-function [ -i ]** |br| Initial mass function. |br| Options: { SALPETER, POWERLAW, UNIFORM, KROUPA } |br| -``SALPETER`` and ``KROUPA`` use the IMFs of Salpeter 1955 and Kroupa 2001 |br| +``SALPETER`` and ``KROUPA`` use the IMFs of Salpeter 1955 and Kroupa 2001, bounded by ``--initial-mass-function-min`` and ``--initial-mass-function-max`` |br| ``POWERLAW`` is a single power law with slope ``--initial-mass-function-power`` |br| ``UNIFORM`` is a uniform distribution between ``--initial-mass-function-min`` and ``--initial-mass-function-max`` |br| Default = KROUPA @@ -1495,7 +1495,7 @@ Go to :ref:`the top of this page ` for the full alphabetical **Initial conditions** ---initial-mass-function, --initial-mass, --initial-mass-1, --initial-mass-2, --initial-mass-function-min, --initial-mass-function-max, --initial-mass-power +--initial-mass-function, --initial-mass, --initial-mass-1, --initial-mass-2, --initial-mass-function-min, --initial-mass-function-max, --initial-mass-function-power --mass-ratio-distribution, --mass-ratio, --mass-ratio-min, --mass-ratio-max, --minimum-sampled-secondary-mass diff --git a/online-docs/pages/whats-new.rst b/online-docs/pages/whats-new.rst index 9ce9759ad..c3a2e8dc4 100644 --- a/online-docs/pages/whats-new.rst +++ b/online-docs/pages/whats-new.rst @@ -3,6 +3,16 @@ What's new Following is a brief list of important updates to the COMPAS code. A complete record of changes can be found in the file ``changelog.h``. +**03.23.00 August 09, 2025** + +* The following option is now deprecated, and will be removed in 1 year: + + * ``--use-mass-loss`` in favour of ``--mass-loss-prescription`` + +Instead of using ``--use-mass-loss`` or ``--use-mass-loss true`` to enable mass loss, then specifying the mass loss prescription to be used with +``--mass-loss-prescription``, mass loss can be enabled using ``--mass-loss-prescription`` with any valid prescription (that is not ``zero``), and +disabled with ``--mass-loss-prescription zero`` instead of ``use-mass-loss false``. + **03.22.02 August 08, 2025** * The following options are now deprecated, and will be removed in 1 year: diff --git a/src/BaseBinaryStar.cpp b/src/BaseBinaryStar.cpp index 36a81a2d5..04abbdacd 100644 --- a/src/BaseBinaryStar.cpp +++ b/src/BaseBinaryStar.cpp @@ -1987,8 +1987,8 @@ void BaseBinaryStar::CalculateWindsMassLoss(double p_Dt) { m_Star2->HaltWinds(); } else { - if (OPTIONS->UseMassLoss()) { // mass loss enabled? - + if (OPTIONS->MassLossPrescription() != MASS_LOSS_PRESCRIPTION::ZERO) { // mass loss enabled? + // yes double mWinds1 = m_Star1->CalculateMassLossValues(p_Dt, true); // calculate new values assuming mass loss applied double mWinds2 = m_Star2->CalculateMassLossValues(p_Dt, true); // calculate new values assuming mass loss applied diff --git a/src/BaseStar.cpp b/src/BaseStar.cpp index 7b26f032e..a4949407b 100755 --- a/src/BaseStar.cpp +++ b/src/BaseStar.cpp @@ -2526,7 +2526,7 @@ double BaseStar::CalculateMassLossRate() { double mDot = 0.0; // default return value - if (OPTIONS->UseMassLoss()) { // mass loss enabled? + if (OPTIONS->MassLossPrescription() != MASS_LOSS_PRESCRIPTION::ZERO) { // mass loss enabled? // yes double LBVRate; double otherWindsRate; @@ -2565,7 +2565,7 @@ double BaseStar::CalculateMassLossRate() { THROW_ERROR(ERROR::UNKNOWN_MASS_LOSS_PRESCRIPTION); // throw error } - mDot = mDot * OPTIONS->OverallWindMassLossMultiplier(); // apply overall wind mass loss multiplier + mDot *= OPTIONS->OverallWindMassLossMultiplier(); // apply overall wind mass loss multiplier } mDot = min(mDot, MAXIMUM_WIND_MASS_LOSS_RATE); // cap winds at a maximum mass loss rate (typically 0.1 solar masses per year) to avoid convergence issues @@ -2598,8 +2598,8 @@ double BaseStar::CalculateMassLossValues(double p_Dt, const bool p_UpdateMDot) { double mass = m_Mass; - if (OPTIONS->UseMassLoss()) { // only if using mass loss (program option) - + if (OPTIONS->MassLossPrescription() != MASS_LOSS_PRESCRIPTION::ZERO) { // mass loss enabled? + // yes double mDot = CalculateMassLossRate(); // calculate mass loss rate double massLoss = max(0.0, mDot * p_Dt * 1.0E6); // calculate mass loss; mass loss rate given in Msol per year, times are in Myr so need to multiply by 10^6 if (p_UpdateMDot) m_Mdot = mDot; // update class member variable if necessary @@ -2634,8 +2634,8 @@ double BaseStar::CalculateMassLossValues(double p_Dt, const bool p_UpdateMDot) { */ void BaseStar::ResolveMassLoss(double p_Dt) { - if (OPTIONS->UseMassLoss()) { - + if (OPTIONS->MassLossPrescription() != MASS_LOSS_PRESCRIPTION::ZERO) { // mass loss enabled? + // yes double mass = CalculateMassLossValues(p_Dt, true); // calculate new values assuming mass loss applied double angularMomentumChange = (2.0 / 3.0) * (mass - m_Mass) * m_Radius * RSOL_TO_AU * m_Radius * RSOL_TO_AU * Omega(); diff --git a/src/Makefile b/src/Makefile index 5c24d7acc..a20730c19 100644 --- a/src/Makefile +++ b/src/Makefile @@ -40,7 +40,7 @@ ifneq ($(filter staticfast,$(MAKECMDGOALS)),) endif -CXXFLAGS := -std=c++17 -g -fnon-call-exceptions -Wall -Woverloaded-virtual $(OPTFLAGS) +CXXFLAGS := -std=c++17 -g -fnon-call-exceptions -Wall -Woverloaded-virtual -Wno-vla-cxx-extension $(OPTFLAGS) ICFLAGS := -I$(GSLINCDIR) -I$(BOOSTINCDIR) -I$(HDF5INCDIR) -I. LIBS := -lm -lz -ldl -lpthread diff --git a/src/Options.cpp b/src/Options.cpp index 8a2946889..da91cff4d 100644 --- a/src/Options.cpp +++ b/src/Options.cpp @@ -418,7 +418,6 @@ void Options::OptionValues::Initialise() { // Mass loss options - m_UseMassLoss = true; m_CheckPhotonTiringLimit = false; m_EnableRotationallyEnhancedMassLoss = false; @@ -1019,11 +1018,6 @@ bool Options::AddOptions(OptionValues *p_Options, po::options_description *p_Opt po::value(&p_Options->m_ScaleCHEMassLossWithSurfaceHeliumAbundance)->default_value(p_Options->m_ScaleCHEMassLossWithSurfaceHeliumAbundance)->implicit_value(true), ("Whether to transition mass loss rates for chemically homogeneously evolving (CHE) stars between OB mass loss rates and Wolf-Rayet (WR) mass loss rates as a function of the surface helium abundance (Ys) as described by Yoon et al. 2006 (default = " + std::string(p_Options->m_ScaleCHEMassLossWithSurfaceHeliumAbundance ? "TRUE" : "FALSE") + ")").c_str() ) - ( - "use-mass-loss", - po::value(&p_Options->m_UseMassLoss)->default_value(p_Options->m_UseMassLoss)->implicit_value(true), - ("Enable mass loss (default = " + std::string(p_Options->m_UseMassLoss ? "TRUE" : "FALSE") + ")").c_str() - ) ( "use-mass-transfer", po::value(&p_Options->m_UseMassTransfer)->default_value(p_Options->m_UseMassTransfer)->implicit_value(true), diff --git a/src/Options.h b/src/Options.h index a53fbb669..12dd84f86 100755 --- a/src/Options.h +++ b/src/Options.h @@ -228,7 +228,8 @@ class Options { { "minimum-secondary-mass", "minimum-sampled-secondary-mass", false, "20250808" }, { "initial-mass-max", "initial-mass-function-max", false, "20250808" }, { "initial-mass-min", "initial-mass-function-min", false, "20250808" }, - { "initial-mass-power", "initial-mass-function-power", false, "20250808" } + { "initial-mass-power", "initial-mass-function-power", false, "20250808" }, + { "use-mass-loss", "mass-loss-prescription", false, "20250809" } }; std::vector> deprecatedOptionValues = { @@ -237,7 +238,15 @@ class Options { { "pulsational-pair-instability-prescription", "COMPAS", "WOOSLEY", false, "20250208" }, { "pulsar-birth-spin-period-distribution", "ZERO", "NOSPIN", false, "20250303" }, { "tides-prescription", "KAPIL2024", "KAPIL2025", false, "20250525" }, - { "mass-loss-prescription", "MERRITT2024", "MERRITT2025", false, "20250717" } + { "mass-loss-prescription", "MERRITT2024", "MERRITT2025", false, "20250717" }, + { "use-mass-loss", "TRUE", "MERRITT2025", true, "20250809" }, + { "use-mass-loss", "ON", "MERRITT2025", true, "20250809" }, + { "use-mass-loss", "YES", "MERRITT2025", true, "20250809" }, + { "use-mass-loss", "1", "MERRITT2025", true, "20250809" }, + { "use-mass-loss", "FALSE", "ZERO", true, "20250809" }, + { "use-mass-loss", "OFF", "ZERO", true, "20250809" }, + { "use-mass-loss", "NO", "ZERO", true, "20250809" }, + { "use-mass-loss", "0", "ZERO", true, "20250809" } }; // the following vector is used to replace deprecated options in the logfile-definitions file @@ -1003,7 +1012,6 @@ class Options { std::string m_OutputContainerName; // Name of output container (directory) // Mass loss options - bool m_UseMassLoss; // Whether to activate mass loss (default = True) bool m_CheckPhotonTiringLimit; // Whether to check the photon tiring limit for wind mass loss // Can also have options for modifying strength of winds etc here @@ -1748,7 +1756,6 @@ class Options { DBL_VECTOR TimestepMultipliers() const { return OPT_VALUE("timestep-multipliers", m_TimestepMultipliers, true); } bool UseFixedUK() const { return (m_GridLine.optionValues.m_UseFixedUK || m_CmdLine.optionValues.m_UseFixedUK); } - bool UseMassLoss() const { return OPT_VALUE("use-mass-loss", m_UseMassLoss, true); } bool UseMassTransfer() const { return OPT_VALUE("use-mass-transfer", m_UseMassTransfer, true); } bool UsePairInstabilitySupernovae() const { return OPT_VALUE("pair-instability-supernovae", m_UsePairInstabilitySupernovae, true); } bool UsePulsationalPairInstability() const { return OPT_VALUE("pulsational-pair-instability", m_UsePulsationalPairInstability, true); } diff --git a/src/changelog.h b/src/changelog.h index 1f83e2ea5..e4dc53969 100644 --- a/src/changelog.h +++ b/src/changelog.h @@ -1635,6 +1635,19 @@ // - Changed default record types for: // - SSE and BSE detailed output files to include only record types 1, 4, & 5 (INITIAL_STATE, TIMESTEP_COMPLETED, and FINAL_STATE) // - SSE and BSE pulsar evolution files to include only record type 3 ((pulsar) TIMESTEP_COMPLETED) +// - Fixed random kick draw for MULLERMANDEL prescription +// 03.23.00 JR - August 09, 2025 - Enhancement: +// - Deprecated option +// - "--use-mass-loss" in favour of "--mass-loss-prescription" +// +// Instead of using ``--use-mass-loss`` or ``--use-mass-loss true`` to enable mass loss, then specifying the mass loss +// prescription to be used with ``--mass-loss-prescription``, mass loss can be enabled using ``--mass-loss-prescription`` +// with any valid prescription (that is not ``zero``), and disabled with ``--mass-loss-prescription zero`` instead of +// ``use-mass-loss false``. +// - Added compiler flag "-Wno-vla-cxx-extension" to "CXXFLAGS" in Makefile to suppress compiler extension warning +// - Fixed online docs for ommisssions in v03.22.02: +// - fixed description for "--initial-mass-function" in "program-options-list-defaults.rst", and +// - changed "--initial-mass-power" to "--initial-mass-function-power" in "program-options-list-defaults.rst" // // // Version string format is MM.mm.rr, where @@ -1646,7 +1659,7 @@ // if MM is incremented, set mm and rr to 00, even if defect repairs and minor enhancements were also made // if mm is incremented, set rr to 00, even if defect repairs were also made -const std::string VERSION_STRING = "03.22.02"; +const std::string VERSION_STRING = "03.23.00"; # endif // __changelog_h__ From 530fe8495718f1141d00aab0526bcf89162de365 Mon Sep 17 00:00:00 2001 From: Jeff Riley Date: Sat, 9 Aug 2025 17:05:39 +1000 Subject: [PATCH 2/6] fix typo --- src/changelog.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/changelog.h b/src/changelog.h index e4dc53969..97dd17d1c 100644 --- a/src/changelog.h +++ b/src/changelog.h @@ -1645,7 +1645,7 @@ // with any valid prescription (that is not ``zero``), and disabled with ``--mass-loss-prescription zero`` instead of // ``use-mass-loss false``. // - Added compiler flag "-Wno-vla-cxx-extension" to "CXXFLAGS" in Makefile to suppress compiler extension warning -// - Fixed online docs for ommisssions in v03.22.02: +// - Fixed online docs for omissions in v03.22.02: // - fixed description for "--initial-mass-function" in "program-options-list-defaults.rst", and // - changed "--initial-mass-power" to "--initial-mass-function-power" in "program-options-list-defaults.rst" // From 4df69708a67a364fd95a1712b2218ba2f67c56e1 Mon Sep 17 00:00:00 2001 From: Jeff Riley Date: Sat, 9 Aug 2025 17:30:03 +1000 Subject: [PATCH 3/6] Missed a couple of docs edits --- .../program-options-list-defaults.rst | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/online-docs/pages/User guide/Program options/program-options-list-defaults.rst b/online-docs/pages/User guide/Program options/program-options-list-defaults.rst index de57cc973..19e0ad92a 100644 --- a/online-docs/pages/User guide/Program options/program-options-list-defaults.rst +++ b/online-docs/pages/User guide/Program options/program-options-list-defaults.rst @@ -832,6 +832,20 @@ Options: { ZERO, HURLEY, BELCZYNSKI2010, MERRITT2025 } |br| ``BELCZYNSKI2010``: Mass loss as per Belczynski (2010), and the default prior to 2023 |br| ``MERRITT2025`` : Flexible mass loss with phase specific options: (OB, RSG, WR, VMS) |br| Default = MERRITT2025 |br| +|br| +Note that setting this option to ``ZERO`` can have unexpected consequences, e.g., TPAGB stars that are prevented from losing +mass cannot become white dwarfs, so will become massless remnants. This is a useful option for testing, but this setting is +not recommended for production. It is better to use specific wind prescription controls, such as: |br| +|br| +``--cool-wind-mass-loss-multiplier`` |br| +``--overall-wind-mass-loss-multiplier`` |br| +``--wolf-rayet-multiplier`` |br| +``--luminous-blue-variable-multiplier`` |br| +``--LBV-mass-loss-prescription`` |br| +``--OB-mass-loss-prescription`` |br| +``--RSG-mass-loss-prescription`` |br| +``--VMS-mass-loss-prescription`` |br| +``--WR-mass-loss-prescription`` |br| **--mass-ratio [ -q ]** |br| Mass ratio :math:`\frac{m2}{m1}` used to determine secondary mass if not specified via ``--initial-mass-2``. |br| @@ -1399,19 +1413,6 @@ This option is primarily intended for debugging/testing of convergence issues ra :ref:`Back to Top ` -**--use-mass-loss** |br| -Enable mass loss through winds. |br| -Default = TRUE -Note that setting this option to FALSE can have unexpected consequences, e.g., TPAGB stars that are prevented from losing mass -cannot become white dwarfs, so will become massless remnants. This is a useful option for testing, but this setting is not recommended -for production. It is better to use specific wind prescription controls, such as: |br| -``--cool-wind-mass-loss-multiplier`` |br| -``--LBV-mass-loss-prescription`` |br| -``--luminous-blue-variable-multiplier`` |br| -``--mass-loss-prescription`` |br| -``--overall-wind-mass-loss-multiplier`` |br| -``--wolf-rayet-multiplier`` |br| - **--use-mass-transfer** |br| Enable mass transfer. |br| Default = TRUE From 2bf48db51d09ac25e6df59dbea93ffa8a78839dd Mon Sep 17 00:00:00 2001 From: Ilya Mandel Date: Sun, 10 Aug 2025 11:32:52 +1000 Subject: [PATCH 4/6] Update changelog.h Comment in changelog.h was accidentally copied from an earlier PR --- src/changelog.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/changelog.h b/src/changelog.h index 97dd17d1c..ae6fd9382 100644 --- a/src/changelog.h +++ b/src/changelog.h @@ -1635,7 +1635,6 @@ // - Changed default record types for: // - SSE and BSE detailed output files to include only record types 1, 4, & 5 (INITIAL_STATE, TIMESTEP_COMPLETED, and FINAL_STATE) // - SSE and BSE pulsar evolution files to include only record type 3 ((pulsar) TIMESTEP_COMPLETED) -// - Fixed random kick draw for MULLERMANDEL prescription // 03.23.00 JR - August 09, 2025 - Enhancement: // - Deprecated option // - "--use-mass-loss" in favour of "--mass-loss-prescription" From 63474b7a67504b093af160898805012f82750c12 Mon Sep 17 00:00:00 2001 From: Jeff Riley Date: Sun, 10 Aug 2025 13:18:40 +1000 Subject: [PATCH 5/6] Documentation fixes, new yaml file --- compas_python_utils/preprocessing/compasConfigDefault.yaml | 3 +-- .../Program options/program-options-list-defaults.rst | 2 +- src/yaml.h | 1 - 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/compas_python_utils/preprocessing/compasConfigDefault.yaml b/compas_python_utils/preprocessing/compasConfigDefault.yaml index 653826bc5..82ba3ad85 100644 --- a/compas_python_utils/preprocessing/compasConfigDefault.yaml +++ b/compas_python_utils/preprocessing/compasConfigDefault.yaml @@ -1,5 +1,5 @@ ##~!!~## COMPAS option values -##~!!~## File Created Fri Aug 8 15:57:19 2025 by COMPAS v03.22.02 +##~!!~## File Created Sun Aug 10 13:16:13 2025 by COMPAS v03.23.00 ##~!!~## ##~!!~## The default COMPAS YAML file (``compasConfigDefault.yaml``), as distributed, has ##~!!~## all COMPAS option entries commented so that the COMPAS default value for the @@ -25,7 +25,6 @@ booleanChoices: ### STELLAR PROPERTIES # --check-photon-tiring-limit: False # Default: False -# --use-mass-loss: True # Default: True # --enable-rotationally-enhanced-mass-loss: False # Default: False # --enhance-CHE-lifetimes-luminosities: True # Default: True # --expel-convective-envelope-above-luminosity-threshold: False # Default: False diff --git a/online-docs/pages/User guide/Program options/program-options-list-defaults.rst b/online-docs/pages/User guide/Program options/program-options-list-defaults.rst index 19e0ad92a..919044783 100644 --- a/online-docs/pages/User guide/Program options/program-options-list-defaults.rst +++ b/online-docs/pages/User guide/Program options/program-options-list-defaults.rst @@ -1515,7 +1515,7 @@ Go to :ref:`the top of this page ` for the full alphabetical **Stellar evolution and winds** ---use-mass-loss, --check-photon-tiring-limit, --cool-wind-mass-loss-multiplier, --luminous-blue-variable-prescription, --LBV-mass-loss-prescription +--check-photon-tiring-limit, --cool-wind-mass-loss-multiplier, --luminous-blue-variable-prescription, --LBV-mass-loss-prescription --luminous-blue-variable-multiplier, --main-sequence-core-mass-prescription, --mass-loss-prescription, --overall-wind-mass-loss-multiplier, --wolf-rayet-multiplier, --expel-convective-envelope-above-luminosity-threshold, --luminosity-to-mass-threshold, --OB-mass-loss, --OB-mass-loss-prescription, --RSG-mass-loss, --RSG-mass-loss-prescription, --VMS-mass-loss, --vms-mass-loss-prescription, --WR-mass-loss, --WR-mass-loss-prescription diff --git a/src/yaml.h b/src/yaml.h index 9b41784c6..b93d44047 100644 --- a/src/yaml.h +++ b/src/yaml.h @@ -91,7 +91,6 @@ namespace yaml { "", " ### STELLAR PROPERTIES", " --check-photon-tiring-limit", - " --use-mass-loss", " --enable-rotationally-enhanced-mass-loss", " --enhance-CHE-lifetimes-luminosities", " --expel-convective-envelope-above-luminosity-threshold", From f18ef193246c91fb51e8682eb39023b02695adf2 Mon Sep 17 00:00:00 2001 From: Jeff Riley Date: Sun, 10 Aug 2025 13:19:47 +1000 Subject: [PATCH 6/6] changelog --- src/changelog.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/changelog.h b/src/changelog.h index 97dd17d1c..ae6fd9382 100644 --- a/src/changelog.h +++ b/src/changelog.h @@ -1635,7 +1635,6 @@ // - Changed default record types for: // - SSE and BSE detailed output files to include only record types 1, 4, & 5 (INITIAL_STATE, TIMESTEP_COMPLETED, and FINAL_STATE) // - SSE and BSE pulsar evolution files to include only record type 3 ((pulsar) TIMESTEP_COMPLETED) -// - Fixed random kick draw for MULLERMANDEL prescription // 03.23.00 JR - August 09, 2025 - Enhancement: // - Deprecated option // - "--use-mass-loss" in favour of "--mass-loss-prescription"