MESAHub / mesa

Modules for Experiments in Stellar Astrophysics
http://mesastar.org
GNU Lesser General Public License v2.1
142 stars 38 forks source link

Bumps when loading custom rates #421

Open rjfarmer opened 2 years ago

rjfarmer commented 2 years ago

Interpolating over the rate table seems to be adding bumps in the rate (this is the issue reported by Francisco De Geronimo)

For the attached triple alpha rate see the plot for what happens at low T. Sure the rate has only 23 points so is under-sampled but I would have expected a smoother curve from MESA.

cache_rate

Input rate r_he4_he4_he4_to_c12.txt

MESA's cached rate

r_he4_he4_he4_to_c12_0.txt

Maybe its an issue with having only a few points near the boundary? As at higher T's the curve is smooth.

warrickball commented 2 years ago

Is this not just an issue of the interpolation happening in the rate's linear, not logarithmic, value? Here's a linear plot. image

rjfarmer commented 2 years ago

Note the bumps are in the first 4 points (so below logT8 <=3)

warrickball commented 2 years ago

Sorry, the x-axis label should be T8, not logT. Here's a better attempt but the point stands. image

fxt44 commented 2 years ago

6 orders of magnitude in the rate between the first two temperature points, followed by 2-3 orders of magnitude for the next few temperature points. what are the expectations for such a poorly resolved tabulated rate?!

rjfarmer commented 2 years ago

Again @warrickball , you need to look at the first 4 data points ie log T8 < 8.5.

@fxt Here is a version where i defined the rate to be the values 1 to 24 (add one for each temperature point)

24 1.00 1 1.50 2 2.00 3 3.00 4 4.00 5 5.00 6 6.00 7 7.00 8 8.00 9 9.00 10 10.0 11 15.0 12 20.0 13 25.0 14 30.0 15 35.0 16 40.0 17 45.0 18 50.0 19 60.0 20 70.0 21 80.0 22 90.0 24 100.0 25

rate_integers

Still wiggly for the first few points. Besides even if it was just due to an under sampled rate, all rate tables are horribly under sampled so we need to do the best we can with what we have.

Or maybe we just refuse to work if people don't give us enough data points in the rate tables?

fxt44 commented 2 years ago

i smell a spline boundary condition at play.

rjfarmer commented 2 years ago

We are using interp_pm for the rates but that doesn't specify boundary conditions. Only the 2d interp routines specify boundary conditions

warrickball commented 2 years ago

Okay, last stab at explaining what I mean. Here's the raw rate data plotted first, as I think you did, in Matplotlib's '.-' style, as well as a line where I interpolated linearly in the rate as a function of logT. The bumps are there. image At this point, I don't think the "bumps" are a problem, they're just an artefact of how the data is plotted/interpolated. If you want log(rate) to be smoother, why not interpolate in log(rate)? Maybe the question is why MESA's interpolant is so similar to linear? (I may well be missing something here!)

jeremysakstein commented 2 years ago

My collaborators and I also found this issue when trying to interpolate the r_c12_ag_o16 using this table: deboer_median_old.txt

We reproduced the Steffen Interpolation routine that MESA uses (https://ui.adsabs.harvard.edu/abs/1990A&A...239..443S) in Mathematica and saw the bumps (thought not as extreme as in the triple alpha plot above) so I think it's a feature of the interpolation routine and not a bug:

image

When we tried using Steffen Interpolation in log space the bumps went away so this seems more stable:

image

evbauer commented 1 year ago

I think we should close this issue, as it isn't clear there is any actual bug that needs resolution. Any objection?

fxt44 commented 1 year ago

second.