FEniCS / FEniCS/ufl

Adjoints of coarguments behave inconsistently

Open
#395 0 comments 0 reactions 1 assignee Claimed by @dham View on GitHub
Dominant language
Python
Stars
150
Forks
79
Avg merge
1d 16h
Merged PRs (30d)
10

Description

Consider the following code (Firedrake syntax, but the issue is UFL):
```python3
from firedrake import *
m = UnitIntervalMesh(2)
V = FunctionSpace(m, "CG", 1)
ca = Coargument(V.dual(), 0)
```

`ca` is really the identity operator in $V^{\ast}\rightarrow V^{\ast}$ (equivalently it is a form in $V^{*}\times V \rightarrow R$) and it can arise in adjoint calculations when a variational problem has a pre-assembled cofunction in its RHS. The issue arises when taking the adjoint of `ca`. Note:

```
In [10]: adjoint(ca)
Out[10]: Argument(WithGeometry(FunctionSpace(, FiniteElement('Lagrange', interval, 1), name=None), Mesh(VectorElement(FiniteElement('Lagrange', interval, 1), dim=1), 0)), 0, None)
```

```
In [12]: adjoint(2*ca)
Out[12]: FormSum([2*Argument(WithGeometry(FunctionSpace(, FiniteElement('Lagrange', interval, 1), name=None), Mesh(VectorElement(FiniteElement('Lagrange', interval, 1), dim=1), 0)), 0, None)])
```

In effect, the adjoint of `ca` is treated as an unknown Function in `V` but the adjoint of a scalar multiple of `ca` is treated as a form in $V^{**}\times V^{*}\rightarrow R$ (equivalently an operator in $V\rightarrow V$). These spaces are mathematically isomorphic, but as a matter of type the former is a UFL expression while the latter is a form. When taking the adjoint of a form we expect to get back another form, so the latter would be preferable. This currently causes some special casing in Firedrake.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.