Give each pull back an inverse - #70
Closed
pbrubeck wants to merge 1 commit into
Closed
Conversation
A pull back maps a function on the reference cell to the physical cell. Nothing in UFL went the other way, so a form compiler that has to evaluate a physical expression on the reference cell had to carry its own copy of the maps. apply_inverse is the inverse of apply, for every pull back that has one. PhysicalPullback and CustomPullback are their own inverse, and UndefinedPullback inherits the refusal from AbstractPullback. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0155wQMTMSGiF9a6TbyTVK5P
Author
|
Superseded by #71, which uses the same branch as FEniCS#511 instead of a duplicate of it. Written by Claude (Claude Code), posted from @pbrubeck's account. |
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.
Description
A pull back maps a function on the reference cell to the physical cell. UFL had no map in the other direction, so a form compiler that has to evaluate a physical expression on the reference cell — to dual-evaluate an
Interpolate, for instance — carried its own copy of the Piola maps. TSFC has one.This adds
apply_inversetoAbstractPullbackand implements it for every pull back that has an inverse:applyapply_inverseIdentityPullbackggContravariantPiola(1/detJ) J gdetJ K gCovariantPiolaKᵀ gJᵀ gL2Piolag / detJg detJDoubleContravariantPiola(1/detJ)² J g JᵀdetJ² K g KᵀDoubleCovariantPiolaKᵀ g KJᵀ g JCovariantContravariantPiola(1/detJ) Kᵀ g JᵀdetJ Jᵀ g KᵀMixedPullbackSymmetricPullbackPhysicalPullbackandCustomPullbackare their own inverse.UndefinedPullbackinherits theNonStandardPullbackExceptionfromAbstractPullback, as it does forapply.The test asserts the property that matters rather than the formulas: pushing a reference function forward and mapping it back returns the original, once
remove_component_tensorsandcancel_jacobian_productshave cancelled the Jacobian products the round trip leaves behind. That closes exactly for eight of the nine, mixed and symmetric elements included. TheL2Piolaround trip leavesdetJ / detJstanding, because cancelling a scalar factor is not somethingcancel_jacobian_productsdoes, so that one is asserted directly instead.Stacking
Based on
pbrubeck/interpolate-holes(FEniCS#497), so that the branch pairs withpbrubeck/form-interp-tsfcin Firedrake. The pull back work itself is independent of FEniCS#497, and the same commit is proposed upstream againstmainas FEniCS#511.Nothing calls
apply_inverseyet. #69 uses it to lower interpolation incompute_form_data, which lets TSFC delete its copy of the maps.🤖 Generated with Claude Code
https://claude.ai/code/session_0155wQMTMSGiF9a6TbyTVK5P