Boundary Edge extremities

Hello all,

I would like to know how to have access to edge extremities (x1,y1) and (x2,y2) when we calculate for example:

 int1d(ThK)(u*((x - x1)*(x2 - x1) + (y - y1)*(y2 - y1))/( (x2 - x1)^2 + (y2 – y1)^2 ))

The problem reads how to find the two vertices of the current edge.

Thank you in advance for your help,

Best regards,

Loïc,

Idea,

  1. ( (x2 - x1)^2 + (y2 – y1)^2 )) = lenEdge^2
  2. (x-x1)/(x2-x1) == (y-y1)/(y2=y1) == barycentric coordinate en edge…
load "Element_PkEdge"
mesh Th=square(2,1);
func Tg = [ -N.y,N.x];//  Tangente to edge 
macro grad(u) [dx(u),dy(u)]//
fespace Wh(Th,P1edge);
Wh b,bb;
//  int_E (b) = 0.5 ; on each e edge
//   (grad(b).T) =  1 ; on each e edge T the tangent to E 
verbosity = 10;
solve ComputeB(b,bb) = intalledges(Th,qforder=1)(b*bb+grad(b)'*grad(bb)) -  intalledges(Th,qforder=1)(0.5*bb+Tg'*grad(bb));
plot(b,wait=1); 

b give le barycentric on edge if I a make no mistake.

Hello @frederichecht ,

Thank you for you answer,
Your method seems to work in this case, but I don’t understand what “ComputeB(b,bb)”
does. Could you give me more insights about this calculation ?

In more general case, if I do not consider the barycentric coordinate on edge, but I consider

int1d(ThK)(u*P(x,y, [x1,y1], [x2, y2]))

where P is a polynomial which depends on the edge extremities [x1,y1], [x2, y2]). Do you have an idea how to have access at this extremities ? Or may be it will be possible to compute P in the say way that in the method you have proposed.

Best regards,

Loïc,

The method compute a barycentric coordinate on the edge
so b(x,y) is a such that X = b(X)*X2 + (1-b(X))*X1
so you can easily make the change of variable with a other polynom.

Otherwise you can use Pkedge with k = 0 to 5 to set a polynom on each edge

the degre of freedom are the Quadrature point of the Gauss Legendre formulae on [0,1] with k point

see Gauss–Legendre quadrature - Wikipedia

Thank you for your clear explanation @frederichecht. It is exactely what I was looking for.

However, I just don’t understand where the formula:

intalledges(Th,qforder=1)(b*bb+grad(b)'*grad(bb)) -  intalledges(Th,qforder=1)(0.5*bb+Tg'*grad(bb))

comes from. Could you explain it briefly ?

Best regards,

Loïc,

This simple the barycentric coordinate verif

b( middle) = 0.5
and grad(b) . T = 1

qforder = 1 => one quadrature point at middle of E
=> OK

int_E (b*bb+ grad(b)grad(bb) - =int_E(0.5bb + T’*grad(bb))

because grad(b)) is tangent to the edge E.

Thank you,
I understand now,

Best regards,

Loïc,