Integrating a function

Hello everyone,
I am using FEniCS for the first time, and I need some help for a simple question. In order to determine a coefficient, I need to integrate on the unit square the solution of a Poisson equation I have just solved.
Is there a function already created in FEniCS or how could I implement it?

Thank you all for your help,

assemble is the function you are looking for. For a scalar poisson equation, assuming u is your dolfin function, this would amount to

assemble(u*dx)
1 Like

Thanks a lot! This is exactly what I needed.
Do you know what method the function assemble uses to compute the integrals ?

A fundamental component of FE implementation is numerical integration by quadrature. It’s covered in many introductory texts, e.g. the Hughes book.

1 Like