-
Notifications
You must be signed in to change notification settings - Fork 238
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
Crash when look up table does not cover the range #6100
base: main
Are you sure you want to change the base?
Conversation
…range, and manually set it for entropy method
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.
Strictly speaking, this is an incompatible change. Do you want to document that the entropy reader now needs to be initialized with something that encompasses all possible pressures?
@@ -180,7 +180,8 @@ namespace aspect | |||
*/ | |||
double | |||
get_data(const Point<dim> &position, | |||
const unsigned int component) const; | |||
const unsigned int component, | |||
const bool crash_if_not_in_range = false) const; |
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.
Can you document what the parameter represents in the block above the function?
source/structured_data.cc
Outdated
@@ -855,9 +855,24 @@ namespace aspect | |||
template <int dim> | |||
double | |||
StructuredDataLookup<dim>::get_data(const Point<dim> &position, | |||
const unsigned int component) const | |||
const unsigned int component, | |||
bool crash_if_not_in_range) const |
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.
bool crash_if_not_in_range) const | |
const bool crash_if_not_in_range) const |
source/structured_data.cc
Outdated
|
||
if (crash_if_not_in_range) | ||
{ | ||
const std::vector<double> x_coordinates = get_interpolation_point_coordinates(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.
This is expensive because you are copying the whole vector. But you can make it cheaper:
const std::vector<double> x_coordinates = get_interpolation_point_coordinates(0); | |
const std::vector<double> &x_coordinates = get_interpolation_point_coordinates(0); |
Same for the place a few lines down.
There are also a number of failing tests:
What do we want to do about these tests? |
Hi Wolfgang @bangerth , thank you for looking at this pull request! I have modified it and addressed your comments. For the failed test, 314 failed because the entropy range in the lookup table (600-3000) doesn't cover the model range (up to 3021). I have decreased the maximum entropy in this test setup and will also need to update the result. For 312 and 313, the model is trying to look up data with pressure = 0, while the look-up table has a pressure range start from 0.25 bar. @lhy11009 Haoyuan, I am mentioning you because you made these two tests. Would it be ok if I just simply change the 0.25 bar to 0 bar in your data table? For the entropy look-up method, we definitely want the lookup table to cover the full entropy-pressure range of the model. So the three failed tests shows the exact situation we want to avoid with this new assert throw ;) |
I add an option to make the model crash when the coordinate value is out of the range of the look-up table. I also manually set it for entropy model to make sure the look-up table always cover the entropy-pressure range.