# PDE-1 with nonhomogeneous Neumann BCs

**URL:** <https://community.freefem.org/t/pde-1-with-nonhomogeneous-neumann-bcs/2070>\
**Category:** General Discussion\
**Created:** [October 18, 2022, 11:19am UTC](https://community.freefem.org/t/pde-1-with-nonhomogeneous-neumann-bcs/2070 "2022-10-18T11:19:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bukshtu](https://avatars.discourse-cdn.com/v4/letter/b/13edae/32.png) [@bukshtu](https://community.freefem.org/u/bukshtu)\
**Post date:** [October 18, 2022, 11:19am UTC](https://community.freefem.org/t/pde-1-with-nonhomogeneous-neumann-bcs/2070/1 "2022-10-18T11:19:50Z")

</div>

Could you please refer to any examples of solving the first-order PDE with nonhomogeneous Neumann BCs? In the last version of the FF manual, I found a reference to the function int0d, but I don’t have a clue how to correctly incorporate it into the problem description.

Many thanks for your support and dedication to scientific computing,  
Vlad

---

<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 19, 2022, 9:09am UTC](https://community.freefem.org/t/pde-1-with-nonhomogeneous-neumann-bcs/2070/2 "2022-10-19T09:09:58Z")

</div>

I sorry but remember freefem is build of two-order PDE . You can use FreeFEM for first order but you have to choose-se the correct schema.

[LaplacianCurve.edp](https://community.freefem.org/uploads/short-url/ewv0OginCcYC4AWopufu8iWTz3Z.edp) (945 Bytes)

---

<div class="post-metadata">

**Author:** ![bukshtu](https://avatars.discourse-cdn.com/v4/letter/b/13edae/32.png) [@bukshtu](https://community.freefem.org/u/bukshtu)\
**Post date:** [October 25, 2022, 6:36pm UTC](https://community.freefem.org/t/pde-1-with-nonhomogeneous-neumann-bcs/2070/3 "2022-10-25T18:36:21Z")

</div>

Thank you, Prof. Hecht!

Could we solve a simple PDE-1, e.g., \nabla u(x,y) = g(x,y), using FE spaces other than P1 or P2 (here, we see the solution is numerically unstable)? E.g., we’ve found space P1b useful to solve the PDE and interpolate then the solution to the regular P2 or P1 for future use like in the example attached. Could you please recommend any other FE spaces for solving other PDEs of the first order? Thank you.

```auto
mesh Th=square(20,20);
fespace Vh(Th,P1b);
Vh uh,vh;
func g = (2*x-1)*(y^2-y)+(x^2-x)*(2*y-1);
func gg = x*y*(x-1)*(y-1);
problem pde1(uh,vh,solver=GMRES) =
int2d(Th)( ( dx(uh) + dy(uh) )*vh )
- int2d(Th)( g*vh )
+ on(1,2,3,4,uh=0);

pde1;
plot(uh,value=true,fill=true,wait=true,cmm="P1b solution");

fespace Vhh(Th,P2);
Vh uhh;
uhh = uh;
plot(uhh,value=true,fill=true,wait=true,cmm="P2 solution");
uhh = gg;
plot(uhh,value=true,fill=true,wait=true,cmm="True solution in P2");

```

---

<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 26, 2022, 7:25pm UTC](https://community.freefem.org/t/pde-1-with-nonhomogeneous-neumann-bcs/2070/4 "2022-10-26T19:25:38Z")

</div>

I sorry, but I is well know that method given bad result.
