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

Crash when look up table does not cover the range #6100

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

RanpengLi
Copy link
Contributor

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.

…range, and manually set it for entropy method
Copy link
Contributor

@bangerth bangerth left a 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;
Copy link
Contributor

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?

@@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
bool crash_if_not_in_range) const
const bool crash_if_not_in_range) const


if (crash_if_not_in_range)
{
const std::vector<double> x_coordinates = get_interpolation_point_coordinates(0);
Copy link
Contributor

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:

Suggested change
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.

@bangerth
Copy link
Contributor

There are also a number of failing tests:

The following tests FAILED:
	312 - entropy_initial_lookup (Failed)
	313 - entropy_initial_lookup_wb (Failed)
	314 - entropy_plasticity (Failed)

What do we want to do about these tests?

@RanpengLi
Copy link
Contributor Author

There are also a number of failing tests:

The following tests FAILED:
	312 - entropy_initial_lookup (Failed)
	313 - entropy_initial_lookup_wb (Failed)
	314 - entropy_plasticity (Failed)

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 ;)

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.

2 participants