-
-
Notifications
You must be signed in to change notification settings - Fork 182
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
Add demo of nonlinear scipy solver #3468
base: main
Are you sure you want to change the base?
Conversation
Thanks, Nate! Co-authored-by: Nate <[email protected]>
Add header Fix functional for complex run.
Co-authored-by: Nate <[email protected]>
We do already have a demo that uses a SciPy solver: https://github.com/FEniCS/dolfinx/blob/main/python/demo/demo_types.py |
We only show how to solve linear problems. |
I at least think we should make it clearer from the demo title that it shows how to use scipy. |
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 withstanding issue on where to put this raised by @garth-wells, here are my comments.
|
||
# If the Jacobian is independent of uh, we can avoid re-assembling the matrix | ||
|
||
is_nonlinear = uh in ufl.algorithms.expand_derivatives(jacobian).coefficients() |
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.
@jhale I've here used `ufl to figure it out.
I think it is a quite nice point to make, as some people prefer always using a non-linear solver, but could benefit alot from not having to reassemble J at every step of the Newton solver (even if it is going to be just 1).
As we now support DOLFINx without PETSc, it is good to have a show-case of how to interface with scipy to solve problems.