Dear all.

I have a quick question about calculating the energy or other functions in FreeFEM++.

I already obtained proper solutions (e.g., finite elements in space) using FreeFEM++. For instance, let’s assume that we calculate the electric field distribution in space, and we want to know the energy of this static electric field.

As we know, the energy from the static electric field can be written as;

\begin{equation} \epsilon = \int \vec{E}\cdot\vec{E} dV \end{equation}

For simplicity, I omit the coefficient. So we already obtained the electric field distributions. In this case, how can we write the code for calculating the above energy in FreeFEM++? If it is possible, could you write simple code for the above expression in FreeFEM++?

Sincerely