PDE-1 with nonhomogeneous Neumann BCs

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

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 (945 Bytes)

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.

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");

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