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

Add Interpolate and BaseFormOperator #205

Merged
merged 303 commits into from
Sep 13, 2023
Merged

Conversation

nbouziani
Copy link
Contributor

This PR builds on the dual space changes recently introduced (#21, #25) and introduces the symbolic interpolation operator (ufl.Interpolate). This PR prepares the ground for operators that can be seen as operators and as forms such as Interp or ExternalOperator. Most of the bits in this PR come from the ExternalOperator dual branch which will come in another PR.

For example, let I(u, V2) be the interpolation of the coefficient u \in V1 into the function space V2, where I refers to the interpolation operator I: V1 -> V2. I can also be seen as a form using the reflexivity of V2. That is, we have I: V1 x V2^{*} -> R where I is linear with respect to both entries, we use the notation I(u, v^*) where v^* is a Coargument in V2

Main components of this PR:

Add BaseFormOperator:

We introduce the so-called BaseFormOperator class which accounts for operators than can also be seen as forms such as Interpolate or ExternalOperator.

Add Interpolate:

Add the Interpolate class which we refer to as the symbolic interpolation operator.

Add differentiation mechanisms for BaseFormOperator objects and Interpolate differentiation:

  1. Add a BaseFormOperatorDerivative node

  2. Add differentiation (2 stages mechanism) for base form operators:
    dF(u, I(u, v^{*}); v)/du [uhat] = \partial F/\partial u + Action(dF/dI, dI/du)
    which works by:

  • Applying differentiation by traversing the DAG and whenever we see a BaseFormOperator, we return 0 and record the operations, i.e. instead of returning dF/du we return \partial F/\partial u.

  • Applying chain rule on the recorded operations, i.e. add terms like Action(dF/dI, dI/du) for all the base form operators that got recorded.

  1. Add Interpolate differentiation: dI(u, v*)/du [uhat] = I(uhat, v*) (by linearity).
  2. Add replace_derivative_nodes algorithm for replacing derivative nodes.

Update analysis.py

(cf. firedrakeproject#26)

@mscroggs mscroggs merged commit 71698e1 into FEniCS:main Sep 13, 2023
11 checks passed
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.

None yet

7 participants