# Unset error in while condition

**URL:** <https://community.freefem.org/t/unset-error-in-while-condition/2020>\
**Category:** General Discussion\
**Created:** [September 20, 2022, 5:56pm UTC](https://community.freefem.org/t/unset-error-in-while-condition/2020 "2022-09-20T17:56:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ulrichger](https://avatars.discourse-cdn.com/v4/letter/u/7ea924/32.png) [@ulrichger](https://community.freefem.org/u/ulrichger)\
**Post date:** [September 20, 2022, 5:56pm UTC](https://community.freefem.org/t/unset-error-in-while-condition/2020/1 "2022-09-20T17:56:52Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![aszaboa](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/aszaboa/32/2918_2.png) [@aszaboa](https://community.freefem.org/u/aszaboa)\
**Post date:** [September 29, 2022, 11:29am UTC](https://community.freefem.org/t/unset-error-in-while-condition/2020/2 "2022-09-29T11:29:41Z")

</div>

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

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

```

---

<div class="post-metadata">

**Author:** ![ulrichger](https://avatars.discourse-cdn.com/v4/letter/u/7ea924/32.png) [@ulrichger](https://community.freefem.org/u/ulrichger)\
**Post date:** [October 18, 2022, 11:01am UTC](https://community.freefem.org/t/unset-error-in-while-condition/2020/3 "2022-10-18T11:01:41Z")

</div>

Thanks for the suggestion
