Confused about the results

Dear all

I have written the results at inlet boundary of label 1 and 2 based on the following two methods:

method (1)
fespace XXXMh(th,[P2,P2,P2,P1]);

     XXXMh [u1x,u1r,u1phi,u1p];         
    XXXMh [v1x,v1r,v1phi,v1p];
      XXXMh [xx, xy, xz, xp] = [x,x,x,x];
      XXXMh [yx, yy, yz, yp] = [y,y,y,y];
       ofstream file8("Boundary2.txt");
       varf vBC1([u1x,u1r,u1phi,u1p], [v1x,v1r,v1phi,v1p])  =
          on(1, u1x = 1)+on(2,u1x = 2); 
real[int] bcLab1vec = vBC1(0,XXXMh,tgv=-1);
    cout << "-----1st Method-----" <<endl;
  for(int i=0; i< bcLab1vec .n; i++) {
             if(abs(bcLab1vec[i]-1)<1e-10||abs(bcLab1vec[i]-2)<1e-10)
              {
                     real xx2=xx[][i], yy2=yx[][i];
                    file8 << xx[][i]<< " " << yx[][i] << " " << Cr(xx2,yy2) <<endl;
                   }
 }

method (2)
int Nbtriangle=th.nbe;
cout << “-----2nd Method-----” <<endl;
for (int k=0; k<Nbtriangle; k++)
{
int L=th.be(k).label;
if (L==1 || L==2)
{
real yy1=th.be(k)[1].y;
real xx1=th.be(k)[1].x;
file1 << xx1 << " " << yy1 << " " << Cr(xx1,yy1)<< endl;
}
}

when I plot the output file in excel there is a difference which confused me.

I don’t know why there is the difference between them and which one is correct? In addition, one of the trends is correct. For example either the top or the lower trend is acceptable and I don’t know why the orange one is periodically goes and back between these two trends?

BR

It is hard to say anything since there is neither a mesh nor a function specified in your example. Maybe you should try out the things you want on a simple square mesh and some simple test solution functions (sin, cos, etc).

However, my guess is that the reason for the difference is in the following line:

real yy1=th.be(k)[1].y;
real xx1=th.be(k)[1].x;

here, th.be(k)[1] is used only, but not th.be(k)[0], therefore half of the boundary points are omitted compared to the other method.

Thank you. The problem is that one of the trends is right. Let’s define it better. I have a square as the follow:

Untitled (1)

It is an optimal control method in which Cr is being updated in every loop. Now I need to export the Cr at boundary but in method 1 which I think all data’s are included one trend is acceptable. As you see in the picture the method 1 is like being periodic and zigzag form but it is not right and the trend must be soft. Don’t know why it happens.

I do no think I completely understand your approach. It might be the case the you need to change your variational formulation in method 1 since the control is in the radial (?) direction:

varf vBC1([u1x,u1r,u1phi,u1p], [v1x,v1r,v1phi,v1p])  =
          on(1, u1r = 1)+on(2,u1r = 2); 
1 Like

Dear aszaboa

Thank you for your responses. I think I found the answer. This happens because in method 1 I used P2 fespace and in method 2 I will export the nodes value which is equal to P1 fespace. when I changed the P2 in method 1 to P1 the results became the same.

BR