Error with the Freefem script; composite finite element spaces

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.

  1. int nn = 30; // number of edges in each direction
  2. mesh ThP = square(nn,nn,[2pix,2piy],flags=3); // Pressure mesh
  3. mesh ThU = trunc(ThP,1,split=2); // Velocity mesh
  4. fespace Uh(ThU,[P1,P1]); // Velocity space
  5. fespace Ph(ThP,P1); // Pressure space
  6. macro grad(u) [dx(u),dy(u)] //
  7. macro Grad(u1,u2) [grad(u1), grad(u2)] //
  8. macro div(u1,u2) (dx(u1)+dy(u2)) //
  9. // definition of the boundary condition
  10. func g1 = sin(x)*cos(y);
  11. func g2 = -cos(x)*sin(y);
  12. // definition of the right-hand side
  13. func f1 = 0;
  14. func f2 = -4*cos(x)*sin(y);
  15. Uh [u1,u2],[v1,v2];
  16. Ph p,q;
  17. fespace Xh=Uh*Ph;
  18. varf Stokes (<[u1,u2],[p]>, <[v1,v2],[q]>) = int2d(ThU)((Grad(u1,u2):Grad(v1,v2))) +
  19. int2d(ThU)(-div(u1,u2)*q -div(v1,v2)*p) +
  20. int2d(ThP)(-1e-10pq) +
  21. int2d(ThU)([f1,f2]'*[v1,v2]) +
  22. on(1,2,3,4, u1=g1, u2=g2);
  23. matrix M = Stokes(Xh,Xh);
  24. real[int] b = Stokes(0,Xh);
  25. real[int] sol = M^-1*b;
  26. [u1,p] = sol; // dispatch the solution
  27. plot([u1,u2], cmm=“u”);
  28. plot(p, cmm=“p”);

You need a newer FreeFEM version.

Thank you for the suggestion.

The latest deb package installing the version 4.6 - which does not support composite FEs, I tried to compile the source following the instructions in Installation guide. Unfortunately, errors occur during the installation. For example:

  • the step ./3rdparty/getall -a fails with many errors; one of them like
    Error download pkg/patch.tar.gz
    Error download pkg/arpack96.tar.gz
    Download 2 times failed from http://pkgs.freefem.org/patch.tar.gz of patch.tar.gz
    Try (2 times) other site: http://104.46.50.187/pkg/patch.tar.gz

  • the following step make -j1 fails also, with one of errors like
    HTTP request sent, awaiting response… HTTP request sent, awaiting response… 404 Not Found
    404 Not Found
    2024-10-10 09:58:18 ERROR 404: Not Found.
    2024-10-10 09:58:18 ERROR 404: Not Found.

I am following the installation guide. I do not have errors when I installed required packages, but only when I configure/install freefem.

Thank you for any help.

Switch to the develop branch instead of using the master branch.

I think you need to try from

Installing the deb binary from github solves the issue.

Thank you to both of you for the help.