Handle MeshGeometry in cached solvers (-> #4638)#5188
Draft
angus-g wants to merge 3 commits into
Draft
Conversation
This test relies on moving geometry, so it does exercise the changes in this branch. test_shape_derivatives probably does too, but implicitly through interpolate so it might not fail until we route all solves through the cached solver block.
For whatever reason, derivative(-F, m, dm) has very different behaviour when passed through the adjoint -> action -> expand_derivatives chain compared to the non-negated variant. We just push subtraction to the dFdm_adj and dFdm_adj2 forms instead.
dc82f03 to
3be5af2
Compare
angus-g
commented
Jun 18, 2026
Comment on lines
+43
to
+45
| def __init__( | ||
| self, forward_cache, tangent_cache, adjoint_cache, hessian_cache, ad_block_tag=None | ||
| ): |
Contributor
Author
There was a problem hiding this comment.
Oops I was going to type-annotate these but that introduces a circular dependency, I should probably go back to an if TYPE_CHECKING import.
Contributor
|
I’m currently on leave. I can look into this next Thursday.
…On Thu, 18 Jun 2026 at 06:35 Angus Gibson ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In firedrake/adjoint_utils/blocks/solving.py
<#5188 (comment)>
:
> + def __init__(
+ self, forward_cache, tangent_cache, adjoint_cache, hessian_cache, ad_block_tag=None
+ ):
Oops I was going to type-annotate these but that introduces a circular
dependency, I should probably go back to an if TYPE_CHECKING import.
—
Reply to this email directly, view it on GitHub
<#5188?email_source=notifications&email_token=AFAFSPXODRBPRWTNPMCCZ6T5AN5RTA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTINJSGE4DQNRRGIY2M4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#pullrequestreview-4521886121>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFAFSPTFE6ZQHI5NIAJTRNL5AN5RTAVCNFSNUABEKJSXA33TNF2G64TZHMYTGMZYGQYDKMR3JFZXG5LFHM2DMOBYHAZDIOBQGKQXMAQ>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/AFAFSPW5LSFTM2KPZTUIXWT5AN5RTA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTINJSGE4DQNRRGIY2M4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJKTGN5XXIZLSL5UW64Y>
and Android
<https://github.com/notifications/mobile/android/AFAFSPUZ4GW7BQXUUB3N4LD5AN5RTA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTINJSGE4DQNRRGIY2M4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLTGN5XXIZLSL5QW4ZDSN5UWI>.
Download it today!
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This threads
MeshGeometrydependencies through theCachedSolverBlock. BecauseCoordinateDerivativeis a bit strange, we do need to special case forms and flip signs here and there. Particularly for the Hessian forms it goes back to the action -> derivative approach (restrained byCoordinateDerivative) rather than derivative -> action -> adjoint.I did also test Fireshape here (it passes, whereas before this PR it would fail on
test_L2tracking[FeMultiGridControlSpace]andtest_TimeTracking). @APaganini do you have anything that we should ensure we check related to this?