-
Notifications
You must be signed in to change notification settings - Fork 69
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
Naive tides implementation #1012
Conversation
- Added naive tides implementation. Functionality enable with new optin . default is no tides.
…tionality enable with new optiin '--enable-tides'. default is no tides.
…nto naive-tides
WIP: naive tides
Minor fixes; updated docs; added links to splash string
@jeffriley i've added the changes to the pytest to use the fiducial-bbh config (and not use the method-paper config) |
Err, i think i messed the config up.
https://github.com/TeamCOMPAS/COMPAS/actions/runs/6702099754/job/18210562003?pr=1012#step:6:354 |
CI/Pytest changes
|
Lines 285-292 are in code that is called in the constructor - at that stage we don't know if the stars are rotating fast enough to evolve as CH stars, we just know that CHE is enabled (in either mode) and that we need to check whether the stars are rotating fast enough to be evolving as CH stars. Is that not right?
Do you mean this:
That would be a typo... and I think it has probably been there since CHE was implemented (unless I accidentally changed it in this PR, but it looks like I copy-pasted the code above it and missed changing that digit). But it shouldn't make any difference -
Yes, I believe that was code @reinhold-willcox added (including |
I don't know the answer to that - that's the way it was before this PR. EDIT: see Avi's answer above.
I thought I changed that to
I didn't change those - do we need to use the defaults?
Ok - all I cared about here was getting the pytests to run - isn't the goal just to test that the functionality works, rather than produce a plot that is in some way useful? If that's not so, then sure, if you want to suggest what initial conditions and prescriptions should be used, I'll happily change it. |
I think we added one for the pytests - just to make sure we could test functionality. They don't need to be the same do they. But yes, maybe it is better if we combine them and use a single yaml file - but I don't think the fiducial yaml file allowed the pytests to run (I'm struggling to remember what we did...).
Do you mean the inclusion of the code cleanups (if so, I addressed that above), or the inclusion of the changes to tests etc? If tests, we need to change some things to make the tests run... Or am I missing the point? |
I forgot lines 1613-1614. Isn't that how we decided to implement CHE initially? (And partly why I asked about the interaction of CHE with the tides code). Prior to the implementation of CHE (I think - my memory may be failing me) we didn't set omega for the constituents of a binary - when we implemented CHE we chose to set omega for both stars to the same value (omega for the binary) - and then we decide if either (or both) is rotating fast enough to be evolving as a CH star. I haven't actually changed the functionality here - just rearranged it for performance). |
@jeffriley , @avivajpeyi , a few comments (and note my review is still not complete, a couple more items to come :) ) --
|
I meant that star1 has three if-else clauses on lines 304-313 of BaseBinaryStar.cpp, but star2 has only one clause on lines 322-324.
constexpr double G = 6.67E-11; // Gravitational constant in m^3 kg^-1 s^-2 (more accurately known as G M_sol) I'd suggest renaming G1 and G_SN in a way that describes their unit systems (like G_CGS and G_SOLAR_YEAR), e.g., G1 -> G_AUMSOLYR, G_SN->G_KMMSOLS, and removing the comment "for use in the ResolveSupernova() function" since it can be (and now is) used elsewhere. |
Continuing review (still not complete):
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
BaseBinaryStar.h, line 681:
if (it < maxit) { // too many iterations?
I don’t think that’s the right comment here (unlike on line 686) -
It looks like m_AngularMomentum is now defined in BaseStar and set to the default value in BaseStar.cpp, line 144, but does not have a meaningful (physical) value until the star becomes an NS. Do we really need this? I think it’s risky to keep around a variable that’s incorrect for most stellar types: some day someone may output it and will get meaningless values…
-
utils.cpp::Compare() [lines 193—217]
I think if(p_Tolerance > 0.0) can be taken outside the check for #ifdef COMPARE_GLOBAL_TOLERANCE — no need to repeat that code block twice. BTW, in expressions such as std::max(std::abs(p_X), fabs(p_Y)), why is there an asymmetry in the treatment of p_X and p_Y? -
utils.cpp, lines 235–239:
This has to be one of the most round-about ways to do the calculation. :)
How about just the following one-liner?
return std::cbrt((p_Mass1 + m_Mass2) * p_Period * p_Period / 365.25 / 365.25)
[If you don’t like 365.25, you can define DAYS_IN_YEAR as 365.25, and then change the definition of
SECONDS_IN_DAY = SECONDS_IN_YEAR / DAYS_IN_YEAR in constants.h] -
constants.h, line 237:
constexpr double _2_PI = M_PI * 2; // 2PI
I am surprised you didn’t change that to 2.0. :)
BTW, what’s the logic behind using M in constant names? E.g., why _2_PI but SQRT_M_2_PI? -
I see STAR_PROPERTY::MOMENT_OF_INERTIA now listed in constants.h, but I don’t see it defined in BaseStar.cpp — is GitHub not showing that change to me?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I think this is the last batch. :)
-
NS.cpp, line 288:
double r_cm = m_Radius * KM_TO_CM;
I think this is a mistake — if you want to convert the radius from km into cm, this should be
double r_cm = radius * KM_TO_CM; -
NS.cpp, line 308:
- @param [IN] p_Radius Radius of the Neutron Star in metres
I presume that should say in km, given that we later convert it from km into cm; otherwise, the conversion is incorrect!
-
NS.cpp, line 359:
m_AngularMomentum = _2_PI * m_MomentOfInertia_CGS / (m_PulsarDetails.spinPeriod * SECONDS_IN_MS) * factor;
We’ve already computed the spin frequency, so can simplify this to
m_AngularMomentum = m_MomentOfInertia_CGS * factor * m_PulsarDetails.spinFrequency
(But see below!) -
NS.cpp, line 417:
m_AngularMomentum = m_PulsarDetails.spinFrequency * m_MomentOfInertia_CGS; // angular momentum of star
This will clearly have different units from the previous calculation of the angular momentum (cf. previous comment) — we should be consistent in our units! [I think we assume elsewhere that the angular momentum is in CGS units — if so, we don’t need the factor in item 15] -
NS.cpp, line 460:
// his part of the code
->
// This part of the code
:)
Point taken about G_SN. I'll fix that, and G1, now. |
…to naive-tides
…to naive-tides
@ilyamandel I think I have addressed all your review points - I may not have fixed them all yet, but I have addressed them. Notes below.
9a. > I think if(p_Tolerance > 0.0) can be taken outside the check ... I suppose it could, but then we'd need to add more EDIT: Oh wait - I see what you mean. Yes, I'll take another look. 9b. > BTW, in expressions such as std::max(std::abs(p_X) ... I think probably distraction and forgetfulness :-)
(I had to play around a bit with git to get Reinhold's commit for the G constants - I don't think I broke anything or lost any changes - at least I hope not). |
@ilyamandel Last change pushed - ready for you to re-review (at your convenience). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @jeffriley ,
I am very sorry for taking so long to review the latest changes.
I am happy to approve this PR. I leave it to you whether to address the following (none are technically incorrect or mission-critical, though the first item may merit returning to):
BaseBinaryStar.cpp, dealing with CHE stars (lines 285-292, also 1613-1614):
I don’t think we should decide what to do with stellar rotation based on whether CHE options are on — I think it should be based on whether the stars are actually in CHE. If stars are not in CHE, tidal options determine whether stellar rotations should be updated.
(And, from another comment on this:
CHE and tides: my logic is that if someone turns on the CHE option, they are letting us know that they meant that tides should ensure spin-up and CHE if we actually satisfy the CHE criteria, but not necessarily if we don't (i.e., if the CHE option is turned on but stars don't satisfy the CHE threshold, and tides are off, there's no co-rotation). Setting omega initially: I was thinking of the possibility that, in the future, we may wish to assign some meaningful initial spins to stars and, if tides are off and CHE is not happening, we shouldn't over-ride these. BTW, see also lines 2229-2230.)
Calling OrbitalAngularVelocity() instead of introducing m_Omega -- OK, let's leave things as you've implemented them. :-)
utils.cpp::Compare() [lines 193—217]
I think if(p_Tolerance > 0.0) can be taken outside the check for #ifdef COMPARE_GLOBAL_TOLERANCE — no need to repeat that code block twice.
I am not sure if you addressed this one, but it's not a big deal either way.
Thanks @ilyamandel
We may need to discuss so I better understand what you want here - also see my comment here:
I did. At least I think I did - I pulled that check out of the #ifdef as you suggested, |
Ahh, right -- sorry!
Ok, I suggest pulling the PR at this stage. Thank you once again!
…On Mon, 27 Nov 2023, 11:56 pm jeffriley, ***@***.***> wrote:
Thanks @ilyamandel <https://github.com/ilyamandel>
BaseBinaryStar.cpp, dealing with CHE stars (lines 285-292, also 1613-1614):
We may need to discuss so I better understand what you want here - also
see my comment here:
#1012 (comment)
<#1012 (comment)>
utils.cpp::Compare() [lines 193—217]
I am not sure if you addressed this one, but it's not a big deal either
way.
I did. At least I think I did - I pulled that check out of the #ifdef as
you suggested,
—
Reply to this email directly, view it on GitHub
<#1012 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAD5BVJ7MKSUZ64TODZT7ZLYGULDVAVCNFSM6AAAAAA6WNX7ACVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRYG43DKMRVGM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Enhancement, a little cleanup:
--enable-tides
. Default is no tides.