# Error with the Freefem script; composite finite element spaces

**URL:** <https://community.freefem.org/t/error-with-the-freefem-script-composite-finite-element-spaces/3541>\
**Category:** General Discussion\
**Created:** [October 9, 2024, 5:39pm UTC](https://community.freefem.org/t/error-with-the-freefem-script-composite-finite-element-spaces/3541 "2024-10-09T17:39:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![pi.3.141etc](https://avatars.discourse-cdn.com/v4/letter/p/ac8455/32.png) [@pi.3.141etc](https://community.freefem.org/u/pi.3.141etc)\
**Post date:** [October 9, 2024, 5:39pm UTC](https://community.freefem.org/t/error-with-the-freefem-script-composite-finite-element-spaces/3541/1 "2024-10-09T17:39:52Z")

</div>

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!](https://doc.freefem.org/documentation/composite.html).

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!](https://doc.freefem.org/documentation/composite.html)).

Thank you.

1. int nn = 30; // number of edges in each direction
2. mesh ThP = square(nn,nn,[2_pi_x,2_pi_y],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-10_p_q) +
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”);

---

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [October 10, 2024, 6:35am UTC](https://community.freefem.org/t/error-with-the-freefem-script-composite-finite-element-spaces/3541/2 "2024-10-10T06:35:35Z")

</div>

You need a newer FreeFEM version.

---

<div class="post-metadata">

**Author:** ![pi.3.141etc](https://avatars.discourse-cdn.com/v4/letter/p/ac8455/32.png) [@pi.3.141etc](https://community.freefem.org/u/pi.3.141etc)\
**Post date:** [October 10, 2024, 2:46pm UTC](https://community.freefem.org/t/error-with-the-freefem-script-composite-finite-element-spaces/3541/3 "2024-10-10T14:46:07Z")

</div>

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](https://doc.freefem.org/introduction/installation.html)**. 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](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](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.

---

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [October 10, 2024, 2:59pm UTC](https://community.freefem.org/t/error-with-the-freefem-script-composite-finite-element-spaces/3541/4 "2024-10-10T14:59:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![fb77](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/fb77/32/3796_2.png) [@fb77](https://community.freefem.org/u/fb77)\
**Post date:** [October 10, 2024, 3:47pm UTC](https://community.freefem.org/t/error-with-the-freefem-script-composite-finite-element-spaces/3541/5 "2024-10-10T15:47:51Z")

</div>

I think you need to try from

> **[Release FreeFEM v4.14 · FreeFem/FreeFem-sources](https://github.com/FreeFem/FreeFem-sources/releases/tag/v4.14)**
>
> \[4.14\] (develop version 6/7/24)
> For download of binaries (Linux, Mac and Windows) scroll down a little bit to Assets
> Added
> 
> Finite element BDM2 and BDM2ortho in test, Bug in BDM2ortho corrected the...

---

<div class="post-metadata">

**Author:** ![pi.3.141etc](https://avatars.discourse-cdn.com/v4/letter/p/ac8455/32.png) [@pi.3.141etc](https://community.freefem.org/u/pi.3.141etc)\
**Post date:** [October 10, 2024, 5:33pm UTC](https://community.freefem.org/t/error-with-the-freefem-script-composite-finite-element-spaces/3541/6 "2024-10-10T17:33:17Z")

</div>

Installing the deb binary from github solves the issue.

Thank you to both of you for the help.
