# A problem about adaptation

**URL:** <https://community.freefem.org/t/a-problem-about-adaptation/532>\
**Category:** General Discussion\
**Created:** [August 6, 2020, 4:20am UTC](https://community.freefem.org/t/a-problem-about-adaptation/532 "2020-08-06T04:20:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hai](https://avatars.discourse-cdn.com/v4/letter/h/d9b06d/32.png) [@hai](https://community.freefem.org/u/hai)\
**Post date:** [August 6, 2020, 4:20am UTC](https://community.freefem.org/t/a-problem-about-adaptation/532/1 "2020-08-06T04:20:49Z")

</div>

Dear all  
Recently I want to use an adaptive mesh to solve the equations to compare with the finite element results we have done before. However, there is a problem with adapation mesh.The plot adaptation mesh code is as follows.

int sN=5,emx=2,enx;  
ofstream error(“error.txt”);

error\<\<“Refined meshes”\<\<endl;  
error\<\<"nx = “\<\<enx\<\<”; mx = "\<\<emx\<\<endl;  
error\<\<endl;

error\<\<“Errors under different norms”\<\<endl;  
real[int] ErrL2(sN),ErrH1(sN),ErrH(sN),ConRateL2(sN-1),ConRateH1(sN-1),ConRateH(sN-1);  
real[int] Mnx(sN),Mmx(sN);

for(int i=0; i\<sN; i++)  
{   
enx=5\*emx;  
Mnx(i) = enx;  
Mmx(i) = emx;

cout\<\<"enx = “\<\<enx\<\<”; emx = "\<\<emx\<\<endl;   
mesh Th=square(enx,emx,[x0+(x1-x0)\*x,y0+(y1-y0)\*y]);

fespace Vh1(Th,P1);  
fespace Vh2(Th,HCT);

Vh1 zeta1, zeta2, eta1, eta2;  
Vh2 [zeta3,zeta3x,zeta3y], [eta3,eta3x,eta3y];  
Vh1 zeta0h1=0, zeta0h2=0,zeta00h1=0, zeta00h2=0, zeta1h1, zeta1h2,f00,f11,f0,f1,f2,zeta11h1=0,zeta11h2=0;  
Vh2 [zeta0h3,zeta0h3x,zeta0h3y]=[0,0,0],[zeta00h3,zeta00h3x,zeta00h3y]=[0,0,0], [zeta1h3,zeta1h3x,zeta1h3y], [zeta11h3,zeta11h3x,zeta11h3y]=[0,0,0];  
Vh1 euX,euY,euZ;

Vh1 bm11=-h/(a_y_sqrt(a^2+h^2));  
Vh1 bm22=0;  
Vh1 bm12=0;  
Vh1 bm21=0;

//time-depend flexural model-Newmark Schems

```
   solve flexural([zeta1,zeta2,zeta3,zeta3x,zeta3y],[eta1,eta2,eta3,eta3x,eta3y])=
 int2d(Th)(ab(zeta1,zeta2,zeta3,eta1,eta2,eta3)*sqrt(aa))
- int2d(Th)(p3*eta3*sqrt(aa)) 
+ on(2,zeta1=0,zeta2=0,zeta3=0,zeta3x=0,zeta3y=0);

```

for (int j=0;j\<3;j++)  
{  
real erro=0.001;  
flexural;  
Th=adaptmesh(Th,zeta1,err=erro);  
plot(Th);  
erro= erro/2;  
} ;

emx = 2\*emx;  
}

we obtained the adaptation mesh based on the initial finite element mesh 10_2 20_4,40_8,80_16 and 160\*32 ,respectively. But the adaptation mesh seems not to be effected by the five initial finite element meshes. The adaptation mesh figures lists as follows:

 ![mesh](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/1X/0330ef5b661ccab68065c99a8a6cb1cf580b5e28.gif)  
Is there something I am missing about this?  
Thank you so much for your help in advance, and have a good day!
