// Program for solving Poisson problem with homogeneous boundary conditions int Nbnodes=10; // number of nodes in x and y direction mesh Th=square(Nbnodes,Nbnodes,[x,y]); // uniform mesh of the domain func f=1.0; // right-hand side term fespace Vh(Th,P1); // FE space (Lagrange P1) defined on Th Vh uh,vh; // functions of the FE space problem Poisson(uh,vh,solver=LU)= // Definition of the variational problem int2d(Th)(dx(uh)*dx(vh)+dy(uh)*dy(vh)) // bilinear form -int2d(Th)(f*vh) // linear form +on(1,2,3,4,uh=0); // Dirichlet boundary conditions plot(Th,wait=1); // draw mesh Poisson; // Numerical solution plot(uh,wait=1); // Plot the solution