# Poisson problem on a manifold without boundary

**URL:** <https://community.freefem.org/t/poisson-problem-on-a-manifold-without-boundary/146>\
**Category:** General Discussion\
**Created:** [October 2, 2019, 11:18am UTC](https://community.freefem.org/t/poisson-problem-on-a-manifold-without-boundary/146 "2019-10-02T11:18:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![GaelleB](https://avatars.discourse-cdn.com/v4/letter/g/34f0e0/32.png) [@GaelleB](https://community.freefem.org/u/GaelleB)\
**Post date:** [October 2, 2019, 11:18am UTC](https://community.freefem.org/t/poisson-problem-on-a-manifold-without-boundary/146/1 "2019-10-02T11:18:37Z")

</div>

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);

---

<div class="post-metadata">

**Author:** ![frederichecht](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/frederichecht/32/15_2.png) [@frederichecht](https://community.freefem.org/u/frederichecht)\
**Post date:** [October 3, 2019, 4:01pm UTC](https://community.freefem.org/t/poisson-problem-on-a-manifold-without-boundary/146/2 "2019-10-03T16:01:43Z")

</div>

normal the compatibility condition is not zero.

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

---

<div class="post-metadata">

**Author:** ![GaelleB](https://avatars.discourse-cdn.com/v4/letter/g/34f0e0/32.png) [@GaelleB](https://community.freefem.org/u/GaelleB)\
**Post date:** [October 4, 2019, 6:26am UTC](https://community.freefem.org/t/poisson-problem-on-a-manifold-without-boundary/146/3 "2019-10-04T06:26:26Z")

</div>

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