Poisson problem on a manifold without boundary

Hello,

I want to solve a classical Poisson problem on the standard torus :
-\Delta \psi = \phi

Then I added some periodic conditions and adapted the mesh with the corresponding metric. It looks that the results are not good at all because psi goes to infinity even when I had a stabilization term. I tried to use a lot of solver, also the Congugate Gradient. Do you know how can I have good numerical results ?

Regards,

Here the code :

///////////////////////////////////////////
//Domain construction//////////////////////
///////////////////////////////////////////

border d1(t=0,2 * pi){x=0; y=2 * pi-t; label=1;};
border d2(t=0,2 * pi){x=2 * pi-t; y=2 * pi; label=2;};
border d3(t=0,2 * pi){x=2 * pi; y=t; label=3;};
border d4(t=0,2 * pi){x=t; y=0; label=4;};

int n=20;
real vv=40;

mesh Th=buildmesh(d1(n)+d4(n)+d3(n)+d2(n)); //Triangulation without adaptation

//Adaptation with the riemannian metric G=(Df)^T Df
func g11=1;
func g12=0;
func g22=(2+cos(x))^2;

Th= adaptmesh(Th,g11 * vv,g12 * vv,g22 * vv,IsMetric=1,nbvx=200000,err=0.001,periodic=[[1,y],[3,y],[2,x],[4,x]]); //New triangulation

/////////////////////////////////////
//Initialisation ////////////////////
/////////////////////////////////////

fespace Xh(Th,P2,periodic=[[1,y],[3,y],[2,x],[4,x]]);

func g11inv=1;
func g12inv=0;
func g22inv=1./(2+cos(x))^2;
func detg=(2+cos(x))^2;

////////////////////////////////////
//Solve the problem ////////////////
////////////////////////////////////

Xh phi=cos(x),w,psi;

solve NSpsi(psi,w,solver=Cholesky)=int2d(Th)( sqrt(detg) * (
dx(psi) * dx(w) + g22inv * dy(psi) * dy(w) + 1e-8 * psi * w
))
-int2d(Th)( sqrt(detg) * (
phi * w
))
;

plot(psi,wait=1,value=1);

normal the compatibility condition is not zero.

int2d(Th)(sqrt(detg) * (phi )) = 19.7392

Thanks a lot. I don’t know why I didn’t check this before