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

Do not average unfilled material properties. #5385

Conversation

gassmoeller
Copy link
Member

I found a bug in the average_property function that would cause floating point exceptions if a material output property is not filled. Our current convention for unfilled output properties is no longer that they are set to size 0, but that they are left unfilled at their default values NaN. I left the old condition untouched so that in case a user material model sets the size to 0 it still works the same way as before. I also moved the condition behind the disabling of the floating point exceptions, because isnan(NaN) seems to sometimes throw floating point exceptions (at least it did for me) even though as far as I understand it shouldnt.

Copy link
Contributor

@jdannberg jdannberg left a comment

Choose a reason for hiding this comment

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

Thank you for fixing this! This works for me, and I made a pull request to your branch adding a simple test case (that crashed for me on the current main branch). The problem here was actually the GMG solver.

I don't know if it would be worth investigating in more detail why that averages viscosity values that have not been filled by the material model in the Stokes assembly.

namespace
{
bool
all_entries_NaN(const std::vector<double> &values)
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
all_entries_NaN(const std::vector<double> &values)
all_entries_NaN (const std::vector<double> &values)

@gassmoeller
Copy link
Member Author

I don't know if it would be worth investigating in more detail why that averages viscosity values that have not been filled by the material model in the Stokes assembly.

I am pretty sure that is because the GMG computes only the right-hand side of the Stokes equation in the assembly step. The viscosity is evaluated separately. Therefore it doesnt request the viscosity from the material model.

I merged your test and updated the results to pass. This should be ready for another look.

@jdannberg
Copy link
Contributor

Oh, I see. That makes sense then!

@jdannberg jdannberg merged commit fd321a4 into geodynamics:main Sep 13, 2023
7 checks passed
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.

None yet

2 participants