# Solve a PDE on boundary

**URL:** <https://community.freefem.org/t/solve-a-pde-on-boundary/2743>\
**Category:** General Discussion\
**Created:** [October 8, 2023, 7:28am UTC](https://community.freefem.org/t/solve-a-pde-on-boundary/2743 "2023-10-08T07:28:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![zese](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/zese/32/917_2.png) [@zese](https://community.freefem.org/u/zese)\
**Post date:** [October 8, 2023, 7:28am UTC](https://community.freefem.org/t/solve-a-pde-on-boundary/2743/1 "2023-10-08T07:28:09Z")

</div>

Dear all,

I have a 2D axisymmetric mesh on which I am solving the optimality system. Now to update the control variable on a boundary I need to solve a PDE with some conditions. I dont know how to do that while I am on 2D mesh. on the weak form formula below I know S but I want g.

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/2X/6/66ef9a4ed0a537f85f0a1dbf7d4eac27e7f7f0cf.png)

---

<div class="post-metadata">

**Author:** ![marchywka](https://avatars.discourse-cdn.com/v4/letter/m/ee59a6/32.png) [@marchywka](https://community.freefem.org/u/marchywka)\
**Post date:** [October 8, 2023, 5:06pm UTC](https://community.freefem.org/t/solve-a-pde-on-boundary/2743/2 "2023-10-08T17:06:41Z")

</div>

g, S, and nu are vectors and the gradient is in the direction of S?  
I guess personally I would just do it all in cartesian coords like  
any other problem. You have just two unknowns g.x and g.y right?  
Probably just search the documentation for the “varf” examples  
although “solve” and “problem” examples may be easier the varf may be more useful for now.  
You can make a varf with the 2 components of g and nu as parameters and  
it just uses S in the varf body. To get the value zero on boundary something like  
“on” which should be in most of the varf examples. Using varf you can  
extract the matrix and rhs and then dump them to see if they make sense.

---

<div class="post-metadata">

**Author:** ![zese](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/zese/32/917_2.png) [@zese](https://community.freefem.org/u/zese)\
**Post date:** [October 9, 2023, 5:42am UTC](https://community.freefem.org/t/solve-a-pde-on-boundary/2743/3 "2023-10-09T05:42:02Z")

</div>

> [@marchywka](#):
>
> o get the value zero on boundary something like  
> “on” which should be in most of the varf examples. Using varf you can  
> extract the matrix and rhs and then dump them to see if they make sense.

Thanks for your answer. S and g are vectors but nu and alpha and beta are constants.  
I know I should solve it but I have to solve it on line not 2D mesh. I dont know how to do that. I have my system of equation on 2d surface below but this integral is on the inlet boundary.

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/2X/8/81ef805c632a0604953f62fb1808e6623055d64e.png)

---

<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:** [October 9, 2023, 8:06am UTC](https://community.freefem.org/t/solve-a-pde-on-boundary/2743/4 "2023-10-09T08:06:14Z")

</div>

I thick, you can see example :

[https://www.ljll.math.upmc.fr/hecht/ftp/ff++/2019-Kenitra/Cours-Kenitra-2019.pdf](https://www.ljll.math.upmc.fr/hecht/ftp/ff++/2019-Kenitra/Cours-Kenitra-2019.pdf)

page 161 (Ground water) it is no axis but you have 2 Boundary condition on top border.

and the associated examples is:

[https://www.ljll.math.upmc.fr/hecht/ftp/ff++/2019-Kenitra/edp/freeboundary.edp](https://www.ljll.math.upmc.fr/hecht/ftp/ff++/2019-Kenitra/edp/freeboundary.edp)
