# How to compute and display the "maximum norm error"?

**URL:** <https://community.freefem.org/t/how-to-compute-and-display-the-maximum-norm-error/1625>\
**Category:** FreeFEM installation\
**Created:** [March 25, 2022, 9:36am UTC](https://community.freefem.org/t/how-to-compute-and-display-the-maximum-norm-error/1625 "2022-03-25T09:36:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![AbuAzzan](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/abuazzan/32/1645_2.png) [@AbuAzzan](https://community.freefem.org/u/AbuAzzan)\
**Post date:** [March 25, 2022, 9:36am UTC](https://community.freefem.org/t/how-to-compute-and-display-the-maximum-norm-error/1625/1 "2022-03-25T09:36:30Z")

</div>

Hi there.  
I am applying a Schwarz alternating method code to a nonlinear elliptic PDE by splitting its domain into two subdomains.  
I am facing a problem of computing the maximum norm error of the approximated solution between two consecutive iterations in each of the two subproblems. Here is the code part I am wrong in.  
for (i=0; i\<=20; i++){   
f1=uold1/(1+0.25_uold1^2);  
solve Schw1(uh1, vh1)  
=int2d(Th1)(dx(uh1)dx(vh1)+dy(uh1)dy(vh1)) //bilinear term  
+int2d(Th1)(cuh1vh1)  
+int2d(Th1)(f1_vh1) //right hand side (nonlinear term )  
+on(1,3,4, uh1=g)+on(2, uh1=uold2); //external+internal boundaries   
diff1[i]=abs(uh1-uold1); My problem seems to be here  
norm1[i]=diff1[i].max;

```
f2=uold2/(1+0.25*uold2^2);
solve Schw2(uh2, vh2)
      =int2d(Th2)(dx(uh2)*dx(vh2)+dy(uh2)*dy(vh2)) //bilinear term
	   +int2d(Th2)(c*uh2*vh2)
	   +int2d(Th2)(f2*vh2) //right hand side (nonlinear term) 
	   +on(1,2,3, uh2=g)+on(4, uh2=uh1); //external+internal boundaries
diff2[i]=abs(uh2-uold2);
    norm2[i]=diff2[i].max;	  

uold1=uh1;
uold2=uh2;
Globalnorm=max(norm1[i], norm2[i]);
if (Globalnorm<0.00001) break;

```

};   
cout\<\<“Error on subdomain 1 at iteration”\<\<"("\<\<i\<\<") ="\<\<diff1[i]\<\<endl;  
cout\<\<“Error on subdomain 2 at iteration”\<\<"("\<\<i\<\<") ="\<\<diff2[i]\<\<endl;

I think that my problem seems to start from here for both subdomains  
diff1[i]=abs(uh1-uold1);  
norm1[i]=diff1[i].max;  
Can someone check whether the way the maximum error is true or not.  
Thank you so much.
