Skip to content
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

FEniCS backend: assignment and interpolation updates #613

Merged
merged 5 commits into from
Jan 7, 2025

Conversation

jrmaddison
Copy link
Collaborator

@jrmaddison jrmaddison commented Jan 7, 2025

The FEniCS backend previously handled Function.assign([linear combination of functions]) using the ExprInterpolation class. However this seems fragile in the case of non-continuous functions. This PR removes this case. A better approach for non-variable coefficients is to use LinearCombination directly, otherwise a custom Equation class will now be needed.

The FEniCS backend interpolate_expression now always uses point evaluation via Expr for primal Function interpolation. This is slow, but I'm not aware of a good general solution with legacy FEniCS. This may also change the behavior for DG functions, but interpolation is ambiguous anyway in this case.

Firedrake note: The Firedrake backend version of ExprInterpolation uses Firedrake's much faster approach for interpolation of general expressions. The Firedrake ExprInterpolation is still used to transfer functions from restricted to non-restricted spaces, even for non-continuous spaces.

Also:

  • FEniCS backend: Catch the case Function.assign([function in a different space]) (not caught by legacy FEniCS).
  • Update some tests.

@jrmaddison jrmaddison merged commit 2f7bc5a into main Jan 7, 2025
4 checks passed
@jrmaddison jrmaddison deleted the jrmaddison/interpolation branch January 7, 2025 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant