Unset error in while condition

Dear Freefem community,
I am trying to solve a scheme with steady nse and my stopping condition for the loop depends on the error between successful iterations. This works quite well when considered l2 norm like below:

u01=0;u02=0;p0=0;

iterror=EXP+1;
real cpu1=clock();
while(iterror>EXP)
{
AH;
iterror=sqrt(int2d(Th)((u01-u1)^2+(u02-u2)^2));
number=number+1;
cout<<“iteration=”<<number<<endl;
u01=u1; u02=u2;p0=p;
}

Bu if I want to use l_infinity norm instead of l2 norm, I got errors like unset. How do I define l infinity norm for “iterror” similar to above sense?

Thanks in advance for ideas

You need to use the vectors associated with the FE spaces I think:

Vh u1_err, u2err;
u1err[] = u01[]-u1[];
u2err[] = u02[]-u2[];
real linfErro = max(u1err[].linfty,u2err[].linfty);
1 Like

Thanks for the suggestion