Solving Non-homogeneous Neumann BVP

Dear experts,
Can you guide me how to implement this in FreeFem++ ?

Many many thanks in advance.

The compatibility condition is

\int_\Omega e^{x+y} + \int_{\partial \Omega} 1/2 e^{x+y} = 0

first find \Omega
after the it is trivial to solve problem with FreeFM.

I am proceeding as below:

Am I heading towards the right direction?

No the formulation is :

macro grad(u) [dx(u),dy(u)]//

real cc = 0.1,err,eps = 1e-6 ;
err = int2d(Th)(f) + int1d(Th)(g) ;
cout << " err = " << err << endl; 
asser(err < 1e-8) ; // compatiblity condition 
solve hw2(u,v) = int2d(Th) (grad(u)'*grad(v)+ eps*u*v) 
  - int1d(Th)(g*v) - int2d(Th)(v*f);

and here the err = 9.34155 => no solution

Thank you so much. It totally makes sense now as the compatibility is not holding true. But is there anyway to adjust the boundary conditions so that it will hold true?

They are 2 ways to solve this compatibility problem multi g buy a other constant cc

real cc = 1; 
func f = exp(x+y);
func g = cc*exp(x+y);
cc = int2d(Th)(f)/  int1d(Th)(g);

Other way is find a domain \Omega such \int_\Omega (f)/ \int_{\partial Th}(g)=1

1 Like