/usr/share/doc/freefem++/examples/examples++-chapt3/test1.edp is in freefem++-doc 3.19.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | //Tutorial file test1.pde
// YOUR FIRST PROGRAM
border C(t=0,2*pi){x=cos(t); y=sin(t);} // the boundary
mesh Th = buildmesh (C(50)); // of the domain and its mesh
fespace Vh(Th,P1); // Finite Element of degree 2 defined here for Vh
Vh u,v; // defines u and v as piecewise-P2 continuous functions
func f= x*y; // definition of an algebraic function
real cpu = clock();
solve Poisson(u,v,solver=LU) = // defines and solves the PDE
int2d(Th)( dx(u)*dx(v) + dy(u)*dy(v)) // bilinear part
- int2d(Th)( f*v) // right hand side
+ on(C,u=0) ; // Dirichlet boundary condition
plot(u,wait=1);
cout << " CPU time = " << clock()-cpu << endl;
// ENDS HERE
// FOR THE PRO: The same done with total control over the algebra
varf a(u,v) = int2d(Th)( dx(u)*dx(v) + dy(u)*dy(v))+ on(C,u=0) ;
matrix A=a(Vh,Vh); // stiffness matrix, see (\ref{eqn:Stiffness0})
varf b(u,v) = int2d(Th)( u*v ) ;
matrix B=b(Vh,Vh);
Vh F=f;
v[] = B*F[];
u[]=A^-1*v[];
plot(u,wait=1);
|