# Custom operators on test and trial functions

300
views
1
13 months ago by
I have a variational problem of the form

$a(u,v) = \int_\Omega H(u)\cdot H(v)\,dx = \int_\Omega F\cdot H(v)\,dx = L(v)$
where $H(v)$ is the solution operator for another PDE depending linearly on $v$.

Thus $a(u,v)$ is bilinear and $L(v)$  is linear, as one would want.

Is there a way to set this up for solving using FEniCS?
I already have a solver for $H$ setup and tried to simply construct the variational form using a setup like this

V = FunctionSpace(...)
u = TrialFunction(V)
v = TestFunction(V)

F = Expression(...)

a = H(u)*H(v)*dx
L = F*H(v)*dx

w = Function(V)
solve(a == L, w)
​
but did not work. I suppose the UFL-model is not fond of getting non-standard functions like $H$ involved with the test and trial functions?

Edit: So I may have oversimplified the problem. $H$ isn't directly a solution operator for a PDE, but rather involves one, like this:
$H(u) = F_1\cdot u + F_2\cdot(\nabla F_3,\nabla U(u))$
where $F_i$ are all spatial functions and $U(u)$ is a PDE solution operator for a PDE with solution linearly depending on $u$. Also, $a$ has a regularization induced term as well $F_4\nabla u\nabla v$

3
13 months ago by
You can probably do this with a mixed method.  Think of your problem as a minimization, namely u minimizes
$\frac12\int_\Omega |H(u)|^2 \,dx - \int_\Omega F\cdot H(u)\,dx$
Now reformulate as minimizing
$\frac12\int |w|^2 dx - \int F\cdot w\, dx$
subject to the constraint that $K w = u$, where $K$ is the inverse operator to $H$ (i.e., $w=H(u)$ means that $Kw = u$.  Impose the constraint via a Lagrange multiplier $p$, so the variational problems is to find a saddle point for
$\frac12\int |w|^2 dx - \int F\cdot w\, dx + \int (Kw - u)\cdot p\,dx.$
This then leads to a weak formulation in the usual way, with three trial functions, w, u, and p, and three corresponding test functions.  The solution operator $H$ does not enter the formulation, only the differential operator $K$ for which you can use usual UFL operators.  If $K$ is a second order elliptic operator, you will probably integrate by parts in evaluating terms like $\int Kw\cdot p\,dx$, as usual.

The tricky part, as with all mixed methods, is choosing a stable choice of finite element spaces for the three different variables.

Thank you for this. Seeing your reply makes me realize that I may have rephrased my original problem in a too simple form. I think what you are suggesting could probably still work, but it becomes more messy in my original problem. I'm in a hurry now, but I will add a few more details to my original question later (hopefully tonight).
written 13 months ago by Bjørn Jensen