This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Mapping between FE-spaces and variable transformation for trial functions

+2 votes

I want to solve a (distributed) control problem, that is find an $u \in U$, such that a costfunctional $\mathcal J(y(u),u)$ becomes minimal, where $y$ and $u$ are connected via a PDE:
$$
-\Delta y(x) + y(x) = (bu)(x), \quad \text{for } x \in \Omega.
$$

Let $\Omega=[-1,1]$ be the computational domain and $\Omega_c = [0,0.5]$ be the domain where the control acts.

I assume the control in $U = L^2(0,1)$. Then the input operator $b\colon U \to L^2(-1,1)$, that maps a $u$ control into the right hand side of the equation, can be defined as
$$
(bu)(x) = \begin{cases} u(2x), \text{ if } x\in \Omega_c=[0,0.5]
\\ 0, \quad \quad \text{ elsewhere } \end{cases}
$$

The associated form will then look like
$$
(bu,v) = \int_{\Omega_c} u(\theta x) v(x) \text{d}x,
$$
where $\theta=1/2$ is an affine linear mapping, that adjusts the domain of $u$ to $\Omega_c$.

Is there a built-in functionality for this in fenics?

This will require a (linear) mapping b between the function spaces, so that one can define the product

   B = v*b(w_u)*dx(1)

where v is a test function (for $y$) on $\Omega$, dx(1) is the measure for $\Omega_c$, and w_u is the testfunction for the input space.

asked Jun 16, 2013 by Jan FEniCS User (8,290 points)
retagged Sep 20, 2013 by Jan

Can you make a notation more clear? What is $y$? What is unknown function? $u$ or v?

Thanks for your time. I was somewhat sloppy in the explanation. Edited! And I had an error in the end. $v$ is the test function the equation $\Delta y + ...$ is tested with. $u$ can be seen as an unknown. Thus $w_u$ is a trial function to express $u$.

1 Answer

+1 vote
 
Best answer

You can define b(u) by Expression

class b(Expression):
    def __init__(self, u):
         self.u = u
    def eval(self, values, x):
         self.u.eval(values, 0.5*x)

and then do fixed-point iteration.

answered Jun 16, 2013 by Jan Blechta FEniCS Expert (51,420 points)
selected Nov 20, 2013 by Jan

I don't see, how this will work on testfunctions. I will try it tomorrow and let you know....

It won't. I thought that you need to calculate

$$\int b(u) v \; \mathrm{d}x $$

with $u$ solution and $v$ test function. Then

u = Function(V)
b = b(u)
v = TestFunction(V)
L = b*v*dx
while norm(u-u0) < eps:
    solve(F==L, u)
    u0.assign(u)

would calculate your $b$ transformation from old solution and with iterating
u may converge to solution.

I don't see a way how transformation $b$ could be directly implemented in FEniCS
as it is non-local. You could only fiddle directly with matrix entries.

I see, it looks like I have to manually define the right hand side vector b_w = b(u_w) for every input basis function u_w and then compute the 'columns' of the form via

v = TestFunction(V) 
B_1 = v*b_1*dx(1) 
...

I will let you know, how this works out.

...