Hi community
My problem is to find the extreme values of the difference between two consecutive iterations u^{n+1}_{ih_i} and u^{n}_{ih_i} of a Schwarz algorithm. For a certain purpose, this is done by excluding the values of internal border segments 1 and 4 on both subdomains, respectively. I am facing a problem on how to define the border segments and how to subtract the solution vectors on the internal border nodes from the solution vectors on the remaining subdomains regions. Could I have any help on that?
Thanks a lot.
If you your finite element V_h if Lagrange type then the value of dot is a value of your unknown a dog point point.
Vh u, up; // $u^{n+1}$, $u^{n}$
... computation .of u and up
real[int] diff= u[]-up[];
diff= abs(diff);
int idof = maxi(diff); // get index of Max value
Thank you, dear Hecht, for your fast reply.
However, it is not exactly what I need. I found the maximum values of the difference between two consecutive iterations of a Schwarz algorithm through the process
What I need is the following, according to my code:
How to exclude the nodes values vectors uh11 and uh22 of internal border segment no.2 of the first subdomain and internal border segment no.4 of the second subdomain from all the two solution values vectors uh1 and uh2?
,then
How to subtract the solution vectors on the internal border nodes from the solution vectors on the remaining sub-domains regions?
,and lastly
Find the maximum and minimum values (maxdif1, mindif1, maxdif2, mindif2) of the difference between two consecutive iterations on both subdomains.
I hope it is clear now and you correct me with my code.
Thanks
varf vBC(u,v) = on(1,u=1); // the boundary where you have Boundary condition
real[int] bc=vBC(0,Vh,tgv=1);; // build a vector with 0 internal and 1 on BC node
diff1 = abs(uh1-uold1);
norm1=diff1.max;
diff2 = abs(uh2-uold2)
diff2 .*= bc;;// remove internal node !!!
norm2=diff2.max;
Thank you again for your appreciated and helpful answer, Dr. Hecht.
I successfully printed out the differences vectors: diff1=abs(uh1-uold1) and diff2=abs(uh2-uold2) on the internal boundary conditions as follows:
int j;
varf vBC1(uh1, vh1) = on(2, uh1 = 2.); // variational formulation to set the solution values at label no. 2
real[int] bc1vec = vBC1(0,Vh1,tgv=1); // build a vector with 0 internal and 1 on boundary condition nodes at label no. 2
for(j=0; j< bc1vec.n; j++) {
real xv1= Th1(j).x , yv1= Th1(j).y;
if(abs(bc1vec[j]-2)<1e-10)
cout << " At "<< j << " : " << xv1 << " , " << yv1 << " , " << diff1[j] << endl;
diff11=diff1[j];
};
varf vDA2(uh2, vh2) = on(4, uh2 = 4.); // variational formulation to set the solution values at label no. 4
real[int] da2vec = vDA2(0,Vh2,tgv=1); // build a vector with 0 internal and 1 on boundary condition nodes at label no. 4
for(int j=0; j< da2vec.n; j++) {
real xv2= Th2(j).x , yv2= Th2(j).y;
if(abs(da2vec[j]-4)<1e-10)
cout << " At "<< j << " : " << xv2 << " , " << yv2 << " , " << diff2[j] << endl;
diff22=diff2[j];
};
Now, I only need to get diff1 and diff2 on all internal and remaining boundary nodes of both subdomains as one more step. My failure attempt to do that is as follows:
dif1.=diff1-diff11;
dif2.=diff2-diff22;
I think the failure reason is attributed to mismatched dimensions. Can you kindly help me to do this mission, please?
With thanks.