Rand hand side of variational form

Hello everybody!

I have a question concerning my variational formulation.

It is

\int_{\Omega} \gamma ­|\nabla \phi |^2 = I_2 \frac{1}{|\Gamma_1|} \int_{\Gamma_1} \phi .

This should indicate that the charge is evenly distributed on the edge. But how should I compute this???

It should be something like
g = Expression(" 1/??? * x4") where x4 is my current.
I would be really glad if somebody could help me with this.

Thank you.

Greetings

Hi,

as you have to integrate this expression over \Gamma_1 I assume that you have this boundary marked (and for convenience I also assume that the corresponding measure is ds(1) ).
You can now compute the length / surface area of \Gamma_1 by

area_gamma1 = assemble(1*ds(1))

and use this in the expression.
Just a remark: If you actually also use \Phi as described in you post, this would not be a right-hand side, but also part of the bilinear form of the problem.

Great. Thank you! This is what i was looking for.