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

Function.subfunctions annotation #426

Open
jrmaddison opened this issue Nov 2, 2023 · 2 comments
Open

Function.subfunctions annotation #426

jrmaddison opened this issue Nov 2, 2023 · 2 comments
Labels
enhancement New feature or request Firedrake backend

Comments

@jrmaddison
Copy link
Collaborator

No description provided.

@jrmaddison jrmaddison added enhancement New feature or request Firedrake backend labels Nov 2, 2023
@jrmaddison
Copy link
Collaborator Author

jrmaddison commented Nov 2, 2023

Most use cases appear straightforward, although an efficient implementation requires #299 to be resolved.

The more difficult case is a NonlinearVariationalSolver using both an aliased Function and an alias, e.g.

solve(inner(X.subfunctions[0] + X[0] - Constant(2.0), test[0]) * dx + ...)

It's not obvious to me that this would necessarily be an error (maybe some low order fixed-point method might use this deliberately) -- but tlm_adjoint could at least detect it and raise an exception.

@jrmaddison
Copy link
Collaborator Author

jrmaddison commented Feb 6, 2024

The simplest approach is to record extra Equations within Equation._pre_process and Equation._post_process, corresponding to copy operations, and analogous to the pyadjoint FloatingType. This would add some extra inefficiencies:

Some tests suggest that this should work, but:

  • Patches need to be updated to always call Equation._pre_process.
  • There seem to be non-trivial interactions with reference dropping, with non-obvious causes of reference leaks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Firedrake backend
Projects
None yet
Development

No branches or pull requests

1 participant