Make interpolation code accessible to automatic differentiation#53
Merged
Da-Be-Ru merged 7 commits intoWIAS-PDELib:masterfrom Nov 14, 2025
Merged
Conversation
Member
|
Concerning the HCURLN1 interpolation, I found that if one increases the quadrature order in the normal interpolation tests (test_interpolators.jl:112) by one, then already there the HCURLN1 interpolation fails (and not other FE). That is interesting and indicates that the element itself is buggy. It is not caused by your interpolation matrix code. |
Member
|
I think I have found the problem, please change the following in hcurl_n1.jl:
|
Member
Author
|
This doesn't seem to do anything on my end. Incorporating those changes fails the tests for me before and after with the same errors and numerical values. EDIT: worked after all, was just doing it wrong :) |
Member
Author
Member
|
Great work, I am happy with this |
Member
|
Final thoughts from @chmerdon? |
Member
|
Yes, let's merge. Thanks! |
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.
Here are the proposed changes we've coordinated so far, @chmerdon, @pjaap.
The gist of it:
PointEvaluatorgets an additional type parameterTCoefffor the entry type of the solutionevaluate!functions do an a priori check for theeltypeof the target to match the result'seltypeso the sparsity detection types etc. from the AD evals can run throughcompute_interpolation_jacobiannow computes the jacobian for alazy_interpolate!call between asource_spaceand atarget_spaceinit_interpolator!calls from the element codes to theNodalInterpolator,MomentInterpolator,FunctionalInterpolatorbecause this would necessitate a change to theFESpace.interpolatorsdictionary: now theAssemblyTypewouldn't uniquely identify an interpolator anymore and it seemed weird making interpolators depend on the type of their evaluation (though I'm personally agnostic to that)FETypes on the same gridHCurlinterpolations, @chmerdonThings left to do:
HCurlelements; still needs a fixH1P1intoRT0one contains zero entries innzval)use_cellparents = trueactually has the effect of slowing down the jacobian computation which we should probably look into