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

**URL:** https://community.freefem.org/t/how-do-i-evaluate-a-pde-solution-upon-one-of-the-domain-boundaries/2598
**Category:** General Discussion
**Created:** [July 12, 2023, 11:17am UTC](https://community.freefem.org/t/how-do-i-evaluate-a-pde-solution-upon-one-of-the-domain-boundaries/2598 "2023-07-12T11:17:48Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![jna1g18](https://avatars.discourse-cdn.com/v4/letter/j/77aa72/32.png) [@jna1g18](https://community.freefem.org/u/jna1g18)
#### Post date: [July 12, 2023, 11:17am UTC](https://community.freefem.org/t/how-do-i-evaluate-a-pde-solution-upon-one-of-the-domain-boundaries/2598/1 "2023-07-12T11:17:48Z")

</div>

Hi,

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!

James

---

<div class="post-metadata">

### Author: ![cmd](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/cmd/32/67_2.png) [@cmd](https://community.freefem.org/u/cmd)
#### Post date: [July 12, 2023, 12:01pm UTC](https://community.freefem.org/t/how-do-i-evaluate-a-pde-solution-upon-one-of-the-domain-boundaries/2598/2 "2023-07-12T12:01:23Z")

</div>

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

```auto
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;
plot(uBoundary);

```

---

<div class="post-metadata">

### Author: ![jna1g18](https://avatars.discourse-cdn.com/v4/letter/j/77aa72/32.png) [@jna1g18](https://community.freefem.org/u/jna1g18)
#### Post date: [July 12, 2023, 12:38pm UTC](https://community.freefem.org/t/how-do-i-evaluate-a-pde-solution-upon-one-of-the-domain-boundaries/2598/3 "2023-07-12T12:38:34Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![frederichecht](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/frederichecht/32/15_2.png) [@frederichecht](https://community.freefem.org/u/frederichecht)
#### Post date: [July 14, 2023, 9:35am UTC](https://community.freefem.org/t/how-do-i-evaluate-a-pde-solution-upon-one-of-the-domain-boundaries/2598/4 "2023-07-14T09:35:20Z")

</div>

Yes it is simple now

You can build the mesh of the boundary like :

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

```

---

<div class="post-metadata">

### Author: ![jna1g18](https://avatars.discourse-cdn.com/v4/letter/j/77aa72/32.png) [@jna1g18](https://community.freefem.org/u/jna1g18)
#### Post date: [July 17, 2023, 9:11am UTC](https://community.freefem.org/t/how-do-i-evaluate-a-pde-solution-upon-one-of-the-domain-boundaries/2598/5 "2023-07-17T09:11:42Z")

</div>

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!

---

<div class="post-metadata">

### Author: ![frederichecht](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/frederichecht/32/15_2.png) [@frederichecht](https://community.freefem.org/u/frederichecht)
#### Post date: [July 17, 2023, 9:55am UTC](https://community.freefem.org/t/how-do-i-evaluate-a-pde-solution-upon-one-of-the-domain-boundaries/2598/6 "2023-07-17T09:55:21Z")

</div>

remark extract can do only a part of boundary,

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

```

---

<div class="post-metadata">

### Author: ![jna1g18](https://avatars.discourse-cdn.com/v4/letter/j/77aa72/32.png) [@jna1g18](https://community.freefem.org/u/jna1g18)
#### Post date: [July 17, 2023, 10:39am UTC](https://community.freefem.org/t/how-do-i-evaluate-a-pde-solution-upon-one-of-the-domain-boundaries/2598/7 "2023-07-17T10:39:08Z")

</div>

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