-
Notifications
You must be signed in to change notification settings - Fork 98
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
clean up linear interpolation #2664
Conversation
closes #2663 |
There are now a bunch of unit tests in These test what happens when you ask for an r outside of the model range and if you get exactly the model data (to roundoff) if you ask for an r which is exactly a model point. |
okay, looking at this more. The old interpolation did work fine, in the sense that it had a general enough scheme to check if we need to use i, i-1 or i, i+1 for the bulk of the interpolation. In fact, the test suite is just roundoff diffs now: http://groot.astro.sunysb.edu/Castro/test-suite/gfortran/2023-12-17/index.html |
Util/model_parser/model_parser.H
Outdated
|
||
} | ||
// safety check to make sure interp lies within the bounding points | ||
Real minvar = std::min(model::profile(model_index).state(id+1, var_index), |
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.
Do we want this for r < profile.r(0)?
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.
indeed, probably not. That's a good point.
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.
updated
The locate() function was returning the index of the zone that is higher than the input coordinate r. The logic in interpolate accounted for this, but things were more complex than they need be. This simplifies locate and the linear interpolation.
It also adds a unit test to help understand what's happening.
PR summary
PR motivation
PR checklist
CHANGES
file has been updated, if appropriate