Hello,
I am experimenting with a Freefem script, which demonstrates the composite finite element spaces, as in the example solving Stokes equations given at Composite finite element spaces NEW!.
The script runs properly when the script in “using solve or problem” is used. But when the script in the section “using varf and matrix” is used it gives an error:
Error line number 17, in file stokes-in-diff-meshes.edp, before token =syntax error
current line = 17
Compile error : syntax error
line number :17, =
error Compile error : syntax error
line number :17, =
code = 1 mpirank: 0
I have thought that the error is due to any bad hidden character - however, I edit the text with pure text editor (vim) and it does not look to be the case.
I run Freefem 4.6, installed with FreeFEM_4.6_Ubuntu_withPETSc_amd64.deb in a linux ubuntu machine.
Any help is greatly appreciated.
For convenience I have included the script that I run (copied from Composite finite element spaces NEW!).
Thank you.
- int nn = 30; // number of edges in each direction
- mesh ThP = square(nn,nn,[2pix,2piy],flags=3); // Pressure mesh
- mesh ThU = trunc(ThP,1,split=2); // Velocity mesh
- fespace Uh(ThU,[P1,P1]); // Velocity space
- fespace Ph(ThP,P1); // Pressure space
- macro grad(u) [dx(u),dy(u)] //
- macro Grad(u1,u2) [grad(u1), grad(u2)] //
- macro div(u1,u2) (dx(u1)+dy(u2)) //
- // definition of the boundary condition
- func g1 = sin(x)*cos(y);
- func g2 = -cos(x)*sin(y);
- // definition of the right-hand side
- func f1 = 0;
- func f2 = -4*cos(x)*sin(y);
- Uh [u1,u2],[v1,v2];
- Ph p,q;
- fespace Xh=Uh*Ph;
- varf Stokes (<[u1,u2],[p]>, <[v1,v2],[q]>) = int2d(ThU)((Grad(u1,u2):Grad(v1,v2))) +
- int2d(ThU)(-div(u1,u2)*q -div(v1,v2)*p) +
- int2d(ThP)(-1e-10pq) +
- int2d(ThU)([f1,f2]'*[v1,v2]) +
- on(1,2,3,4, u1=g1, u2=g2);
- matrix M = Stokes(Xh,Xh);
- real[int] b = Stokes(0,Xh);
- real[int] sol = M^-1*b;
- [u1,p] = sol; // dispatch the solution
- plot([u1,u2], cmm=“u”);
- plot(p, cmm=“p”);