# Order of time convergence

**URL:** <https://community.freefem.org/t/order-of-time-convergence/1434>\
**Category:** General Discussion\
**Created:** [January 15, 2022, 5:25am UTC](https://community.freefem.org/t/order-of-time-convergence/1434 "2022-01-15T05:25:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Qianrui](https://avatars.discourse-cdn.com/v4/letter/q/9fc348/32.png) [@Qianrui](https://community.freefem.org/u/Qianrui)\
**Post date:** [January 15, 2022, 5:25am UTC](https://community.freefem.org/t/order-of-time-convergence/1434/1 "2022-01-15T05:25:59Z")

</div>

The procedure of time convergence order is as follows, but this procedure is not wrong, the final calculation can not reach the theoretical second order, only the first order, why?  
real lambda=0.5;  
real Tf=0.5;  
real t0=0;  
load “MUMPS\_seq”  
int m1=16,n1=16;  
ofstream error(“time4096,P2,01.13,”+omega+","+lambda+","+Tf+","+m1+","+n1+".txt");  
int MM=4;  
real[int] b(MM);  
b(0)=8;b(1)=16;b(2)=32;b(3)=4096;  
mesh Th1=square(m1,n1,[-8+16_x,-8+16_y]);  
fespace Xhf(Th1,P2);  
Xhf[int] fepsai2(MM),fedxpsai2(MM),fedypsai2(MM);  
for(int mm=1;mm\<=MM;mm++)  
{  
real dt=Tf/b(mm-1);  
Xhf psai2,u;  
Xhf psai0=(exp(-2_x^2-2_y^2))_(x+1i_y)/(x^2+y^2+1);  
Xhf psait0=1i_psai0;  
Xhf psai1=psai0+dt_psait0;  
for(real t=0+dt\*2;t\<=Tf;t+=dt)  
{

```
 problem kg2(psai2,u,solver=sparsesolver,master=-1)=int2d(Th1)(psai2*u/(dt^2))-int2d(Th1)(2*psai1*u/(dt^2))+int2d(Th1)(psai0*u/(dt^2))
                 +int2d(Th1)(0.5*dx(psai2)*dx(u)+0.5*dy(psai2)*dy(u))+int2d(Th1)(0.5*dx(psai0)*dx(u)+0.5*dy(psai0)*dy(u))
                +int2d(Th1)(0.5*psai2*u)+int2d(Th1)(0.5*psai0*u)
                +int2d(Th1)(0.5*0*psai2*u)+int2d(Th1)(0.5*0*psai0*u)
                +int2d(Th1)(lambda*psai1*conj(psai1)*psai1*u)+on(1,2,3,4,psai2=0); 
 kg2;     
psai0=psai1;
psai1=psai2;

```

}  
fepsai2[mm-1]=psai2;  
fedxpsai2[mm-1]=dx(psai2);  
fedypsai2[mm-1]=dy(psai2);  
}  
real[int] L2error(MM-1),H1error(MM-1);  
for(int i=0;i\<MM-1;i++){  
L2error[i]=sqrt(int2d(Th1)(abs(fepsai2[i]-fepsai2[MM-1])^2));  
H1error[i]=sqrt(int2d(Th1)(abs(fepsai2[i]-fepsai2[MM-1])^2+abs(fedxpsai2[i]-fedxpsai2[MM-1])^2+abs(fedypsai2[i]-fedypsai2[MM-1])^2));  
error\<\<" L2error"\<\<L2error[i]\<\<“H1error”\<\<H1error[i]\<\<endl;  
}  
real[int] CL2error(MM-2),CH1error(MM-2);  
for(int n=0;n\<MM-2;n++){  
CL2error[n]=log(L2error[n]/L2error[n+1])/log(2.);  
CH1error[n]=log(H1error[n]/H1error[n+1])/log(2.);  
error\<\<" CL2"\<\<CL2error[n]\<\<“CH1”\<\< CH1error[n]\<\<endl;  
}

---

<div class="post-metadata">

**Author:** ![learning](https://avatars.discourse-cdn.com/v4/letter/l/5daacb/32.png) [@learning](https://community.freefem.org/u/learning)\
**Post date:** [March 30, 2022, 9:20am UTC](https://community.freefem.org/t/order-of-time-convergence/1434/2 "2022-03-30T09:20:26Z")

</div>

Continuing the discussion from [Order of time convergence](https://community.freefem.org/t/order-of-time-convergence/1434):

Hello, Wei! I have the similar question.When I do the the procedure of time convergence order,the results of the numerical experiments are higher than the theorical convergence order. I wonder if you could tell me your solution to this problem. Thanks very much.
