Skip to content
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

replace sin/cos with multiangle formula in neutrino cooling (part II) #597

Merged
merged 7 commits into from
Dec 11, 2023

Conversation

evbauer
Copy link
Member

@evbauer evbauer commented Nov 9, 2023

Continuation of #596

zingale and others added 3 commits November 9, 2023 08:57
this reduces the number of expensive intrinsics needed
replace sin/cos with multiangle formula in neutrino cooling
@evbauer evbauer requested a review from fxt44 as a code owner November 9, 2023 19:01
The git-lfs installation check was complaining about these files
for some reason on my mac, but they can just be deleted.
@evbauer
Copy link
Member Author

evbauer commented Nov 9, 2023

ndiff shows that the largest relative change in the test output is ~7e-12.

@warrickball
Copy link
Contributor

Doesn't look like any tests failed but I'm not sure if we need to look more closely at the results. I was trying to have a quick look at a case that might depend relatively sensitively on neutrino rates. I noticed 20M_pre_ms_to_core_collapse's results have changed. e.g. fe_core_mass seems to have gone from 1.5 before these changes to 1.58 afterwards.

I didn't expect these changes to make a difference.

@fxt44
Copy link
Member

fxt44 commented Nov 13, 2023

maybe the neutrino emission routine be tested in standalone for one composition over the rho-T plane (unit test)? one with the original trig functions and one with the new trig functions, and diff the two.

@evbauer
Copy link
Member Author

evbauer commented Nov 13, 2023

maybe the neutrino emission routine be tested in standalone for one composition over the rho-T plane (unit test)? one with the original trig functions and one with the new trig functions, and diff the two.

Isn't this what our built-in installation unit test is already doing? The test output from looping over the following ranges is where ndiff returned differences no larger than 7e-12.

subroutine do_test_neutrinos()
real(dp),parameter :: logT_start=6.d0,logT_end=10.5d0
real(dp),parameter :: logRho_start=6.d0,logRho_end=10.5d0
real(dp),parameter :: abar_start=1.d0,abar_end=60d0
real(dp),parameter :: zbar_start=1.d0,zbar_end=26d0

@fxt44
Copy link
Member

fxt44 commented Nov 13, 2023

yea, you are right. i'm mystified then how apparent changes of les than ~7e-12 induce an iron core mass change of nearly 0.1 msun.

@warrickball
Copy link
Contributor

Okay, my next thought: do we trust the test case? Is it exceptionally sensitive anyway? I'll have a brief look later to see if there are any other test cases that change suspiciously.

I'll also try to have a look at what the unit test calculates and how it depends on this change. Relative changes of 7e-12 were already bordering on suspiciously large.

@Debraheem
Copy link
Member

I've checked the high mass test cases and I think we are okay with the Fe core mass change. A majority of the difference between the 'main' and 'update_sneu' branch for the 20Msun_pre_ms_to_cc test case was a result of restarting from a .mod file over photo restarts and the control 'min_dq_for_xa = 1d-4' which limited the convergence of these models. I have also looked at the ppisn test case and the final mass seems to be reasonably converged. The 20Msun and 12Msun test cases are due for a rehaul, but I'd like to make quite a few changes so I will leave it out of this branch.

By adopting the double angle formula, I am finding that bit for bit changes in neu are useful in measuring the sensitivity of massive star model to numerical noise. I'm in favor of adding an inlist control which one can use to toggle between both formulations of these double formula, unless there is a better way to seed bit for bit differences in a model?

@fxt44
Copy link
Member

fxt44 commented Dec 7, 2023

... restarting from a .mod file over photo restarts ...

why do we prefer .mod over photos on restarts in the test suite? one is complete, the other is not ...

@Debraheem
Copy link
Member

I think we are fine to merge this pull request!

@evbauer evbauer merged commit 39298f7 into main Dec 11, 2023
3 checks passed
@evbauer
Copy link
Member Author

evbauer commented Dec 11, 2023

why do we prefer .mod over photos on restarts in the test suite? one is complete, the other is not ...

This might be worth discussing on one of the dev calls in terms of overall design choices. Do we have a sense of what would be the biggest drivers of state differences from these different kinds of restarts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants