How do I evaluate a PDE solution upon one of the domain boundaries?


Is there a way to evaluate a solution of a PDE at one of the domain boundaries? E.g. if u is the solution that I’ve just obtained, is there a simple way to then obtain u(gamma) where gamma is a boundary of the domain on which u is defined? So then u(gamma) should only contain the values of u on gamma.

Hope this is clear, please say if it isn’t and thanks!


If I understand your question correctly, this might be what you’re looking for:

mesh Th = square(10,10);
fespace Xh(Th, P1);
Xh uBoundary, uGlobal = 10;
int BClabel = 1;
varf tgvOnBoundary(UX, VX) = on(BClabel, UX = 1);
real[int] OneOnBoundary = tgvOnBoundary(0, Xh, tgv = 1);
uBoundary[] = uGlobal[].*OneOnBoundary;
1 Like

Hi Chris, thanks for reply!

This certainly looks close to what I need. I may have further questions soon though, if that’s not a problem.

Yes it is simple now

You can build the mesh of the boundary like :

load "msh3"
mesh Th=square(10,10); 
meshL TBh = extract(Th); 
fespace Vh(Th,P2);
Vh u = x*y; 
fespace VBh(TBh,P2);
VBh bu= u; // restiction of u of border ..

Hi Frederic, thanks for your answer! This seems close, although I need the function evaluated at a specific border, rather than the entire boundary. Apologies, I used the word ‘boundary’ in my question when I actually meant to say ‘border’. I believe that Chris’ answer above should work in my code though!

remark extract can do only a part of boundary,

int[int] ll=[1,2];
meshL TBh = extract(Th,label=ll); // extract only border with label 1 and 2. 

Ah brilliant. This could be very useful to me! Many thanks.