-
-
Notifications
You must be signed in to change notification settings - Fork 66
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
Conversation
This file contains 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
W503 is no longer PEP8 best practice. E129 causes spurious problems on long `if` statements.
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.
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 asInterp
orExternalOperator
. Most of the bits in this PR come from theExternalOperator
dual branch which will come in another PR.For example, let
I(u, V2)
be the interpolation of the coefficientu \in V1
into the function spaceV2
, whereI
refers to the interpolation operatorI: V1 -> V2
.I
can also be seen as a form using the reflexivity ofV2
. That is, we haveI: V1 x V2^{*} -> R
whereI
is linear with respect to both entries, we use the notationI(u, v^*)
wherev^*
is aCoargument
inV2
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 asInterpolate
orExternalOperator
.Add
Interpolate
:Add the
Interpolate
class which we refer to as the symbolic interpolation operator.Add differentiation mechanisms for
BaseFormOperator
objects andInterpolate
differentiation:Add a
BaseFormOperatorDerivative
nodeAdd 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.Interpolate
differentiation:dI(u, v*)/du [uhat] = I(uhat, v*)
(by linearity).replace_derivative_nodes
algorithm for replacing derivative nodes.Update
analysis.py
(cf. firedrakeproject#26)