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

How to compute u - \Delta f = 0 for a given f?

0 votes

Hello,

I am given the equation: find $u$ which fulfills for a given $f$:

$$ u-\Delta f = 0 $$

On the boundary, we have homogeneous Neumann conditions. So, in my ufl I write:

P1 = FiniteElement("Lagrange", triangle, 1)
u = TrialFunction(P1)
u_t = TestFunction(P1)
f = Coefficient(P1)
a = u*u_t*dx
L = f*u_t*dx
forms = [a,L]

Then, in my c++ code, I write:

Form_a a(V,V);
Form_L L(V);
L.set_coefficient("f",f);
solve(a == L, *u)

where $f$ and $u$ are of type

std::shared_ptr<dolfin::Function>

Unfortunately, this does not work. Can anyone find a mistake or has a simpler solution?
I would be grateful for any help.
frieder

asked Jun 27, 2017 by frieder FEniCS Novice (340 points)
edited Jun 27, 2017 by frieder

What is f? Why don't you just calculate its laplacian if your equation is that simple?

1 Answer

0 votes

Hi miguelito,
thanks for your comment. The function f is a dolfin::Function which I get during my computations. So it is not given analytically and I cannot compute its laplacian analytically.

answered Jun 29, 2017 by frieder FEniCS Novice (340 points)
...