I am trying to integrate over a portion of my domain’s boundary but I am facing some weird results. To sum up, let’s say that my domain is [0,1]^2, and that I want to integrate over the part (y=0, x \in [0.25, 0.75]). Here is my code :
int N = 100;
mesh Th=square(N, N, [x,y]);
fespace Vh(Th,P1);
Vh u;
border bottom(t=0, 1) {x =t; y = 0; label = 1;}
cout << “test :” << int1d(Th, 1)(u) << endl;
The associated output is 1 (as expected)…
Now, if I turn the line 5. into
5’. border bottom(t=0.25, 0.75) {x =t; y = 0; label = 1;}
or
5’'. border bottom(t=0, 1) {x =0.25+0.5*t; y = 0; label = 1;}
Then the output remains 1 instead of 0.5 (which is the expected output).
I don’t get it. How can I compute the integral over (x\in[0.25, 0.75], y=0) then. I try defining the whole boundary as suggested in the docs you are referring to (see below), but it did not work either.
Here is the code :