Running failure of an additive Schwarz method in two overlapping non-matching grids

Hi there,
I wrote an additive Schwarz method code to solve a semi-linear elliptic problem. It seems fine but when I come to run it does not work properly. I guess the failure from the function uh that the code seems does not recognize it or something like that. I am looking for someone to adjust it as soon as possible.
Here is the algorithm of additive Schwarz method in the context of two overlapping nonmatching subdomains i=1,2.

-Δu_{i}ⁿ+cu_{i}ⁿ=f(u_{i}ⁿ⁻¹) in Ω_{i}
u_{i}ⁿ=uⁿ⁻¹ on γ_{i}
u_{i}ⁿ=0 on Γ_{i}

uⁿ(x)=maxu_{i}ⁿ(x), x∈Ω.

The freefem code is as follows

Additive Schwarz method for semilinear PDEs.edp (2.6 KB)

You code is wrong because uh is a number not a function

Vh1 uh ; 

and set a each iteration uh ,

the Boundary condition with  max(uold1,uold2); 

So my solution is

Additive Schwarz method for semilinear PDEs.edp (2.6 KB)

This finally solves my problem.
Thanks a lot for your help Dr. Hecht. :clap:

Dr. Hecht
Could I ask you one more question please?
What do i have to do to reduce the number of iterations?
This makes it more reliable.

You get a error because the number of node on central piece in not compatible in angle (not 16)
and in vertical direction !!!
And after be careful on vertical surface mesh , the orientation of the split quad face must be se same, ( this is no easy).

Thank you for your fast reply Dr. Hecht.
However, I am sorry I did not understand your meaning with the saying ‘’ not compatible in angle (not 16)’’. To your information, the discretization of both subdomains is in the context of overlapping non-matching grids. So it is natural that the number of nodes for both subdomains on the intersection area is not the same. Could you explain that much more please? And since you are well-experienced in this field (consider me as your student), I need your solution if possible.

Also, what is the fault regarding the orientation? According to my understanding of the mesh, I applied the same as what is in your FreeFEM documentation in this regard, unless you meant something else.

Your help is appreciated.

See on the graphic you see the point do not coincide on both mesh.