-
Notifications
You must be signed in to change notification settings - Fork 708
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
Fix kinsol #12254
Fix kinsol #12254
Conversation
@sebproell , this addresses everything we discussed on slack. Thanks to you and to @nicola-giuliani for the help. |
/rebuild |
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.
I have just one question, but the rest works for me.
I didn't see where the original bug was. To me it looks like you are only shuffling code into the right place, and support a couple of things that may previously not have been supported (like the get_constraints()
functionality). What was the bug and which part fixes it?
status = KINSetNumMaxIters(kinsol_mem, data.maximum_non_linear_iterations); | ||
AssertKINSOL(status); | ||
|
||
// From the manual: this must be called BEFORE KINInit |
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.
how bizarre...
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.
@bangerth this was the bug. @sebproell discovered that if this function is called after the initialisation a vector of N_Vector is left empty so the fixed point iterations end up segfaulting. Then we looked carefully at the manual and discovered the fix
source/sundials/kinsol.cc
Outdated
@@ -524,6 +542,8 @@ namespace SUNDIALS | |||
reinit_vector = [](VectorType &) { | |||
AssertThrow(false, ExcFunctionNotProvided("reinit_vector")); | |||
}; | |||
|
|||
setup_jacobian = [](const VectorType &, const VectorType &) { return 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.
Wouldn't you want this function to throw an assert, just like 3 lines higher up?
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.
Not really. We claim it is optional. Indeed the older version worked without this method. The new version, however, requires the setup. Providing a "do-nothing" setup by default should maintain backward compatibility and allow one not to specify any setup if required.
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.
I see. In that case, can you please move this line out of this function? The function is called set_functions_to_trigger_an_assert()
:-)
I think the place where we do the general KINSOL set-up would be right.
The CI check shows this failure:
Can you take another look? |
I'll be looking at the failure later today. It is happening in the old version of sundials, not the new one. |
Looks good to me, and it also tests correctly, but I would still like it if you could address this one comment: https://github.com/dealii/dealii/pull/12254/files#r636201155 |
OK to merge with this one change. |
see my comment in #12200. Should we rename the function in this class, or the ones in IDA? |
Let's get this one merged as-is and leave the renaming for later. |
later = later today, in a separate patch |
This should fix all remaining issues with KINSOL.
closes #12223.