How to compute int_\Omega \nabla u *v

I need to compute some integrals as u’v in V.F. How do I compute this kind of integrals in Fenics?

When you say u' do you mean \nabla u? And if so, is your problem a 1D, 2D or 3D problem?

In variational forms, all integrals are scalar values, I.e. you cannot compute \int_\Omega \nabla I v \mathrm{d}x If the problem is not is 1D.

If the problem is 1D, u'(x)=u.dx(0) in ufl syntax.

1 Like

Thanks for the answer.
suppose that I want to solve
u’’ - 2u’+u = exp(x)
by Fenics. In V.F an integral appear as
\int_0^1 u’v dx
I need to know how to compute this integral in Fenics

Have you tried:
u.dx(0) * v * dx


Thanks. It worked. much appreciated.