I have an optimal control problem where the L2 control can only take 2 values.
However, I’d like to penalize excessive value jumps. Therefore, I’d like to use something like
(u - u.Other())*dx(skeleton =True )
in the cost functional. Since u needs to be an L2 gridfunction, this apparently doesn’t work, as .Other() returns “NgException: other mir not set, pls report to developers”.
Where do do you use this expression ?
the ‘other mir’ (the mapped integration points on the neighbour element) must be set by the function evaluating the expression.
It’s easiere if you send a small example triggering the exception.
thank you for your reply. I set it in the evaluation of the cost functional, i. e.
Integrate( (n_ref - n_ref.Other() )**2*dx, mesh)
where n_ref is an L2 GridFunction. I attached a small example (at least till the relevant evaluation of the cost function).
In it, I’d like to have n_ref as a GridFunction, since I need to manipulate it on each element in a later step.