Error in compilator

load “msh3”

load “bem”

real k = 10;

int n = 100;

border circle(t = 0, 2*pi){x=cos(t); y=sin(t);}

meshL ThL = buildmeshL(circle(n));

ThL = OrientNormal(ThL,unbounded=1);

BemKernel Ker(“SL”, k=2*pi);

varf vbem(u,v) = int1dx1d(ThL)(ThL)(BEM(ker,u,v));

fespace Uh(ThL,P1);

HMatrix H = vbem(Uh,Uh);

func uinc = exp(1ikx);

Uh p, b;

varf vrhs(u,v) = -int1d(ThL)(uinc*v);

b = vrhs(0,Uh);

p = H^-1*b;

BemPotential Pot(“SL”, k=2*pi);

varf vpot(u,v) = int1d(ThL)(POT(Pot,u,v));

int np = 200;

int R = 4;

border b1(t=-R, R){x=t; y=-R;}

border b2(t=-R, R){x=R; y=t;}

border b3(t=-R, R){x=-t; y=R;}

border b4(t=-R, R){x=-R; y=-t;}

mesh ThOut = buildmesh(b1(np)+b2(np)+b3(np)+b4(np)+circle(-n));

fespace UhOut(ThOut,P1);

HMatrix HP = vpot(Uh,UhOut);

UhOut u, utot;

u = HP*p;

utot = u + uinc;

plot(utot,fill=1,value=1,cmm=“u_total”);

Error
– FreeFem++ v4.6 (Fri, Apr 03, 2020 2:08:08 PM - git v4.6)
Load: lg_fem lg_mesh lg_mesh3 eigenvalue
1 : load “msh3”(load: loadLibary C:\Program Files (x86)\FreeFem++\.\msh3 = 0)
2 : load “bem”(load: loadLibary C:\Program Files (x86)\FreeFem++\.\bem = 0)
3 : real k = 10;
4 : int n = 100;
5 : border circle(t = 0, 2pi){x=cos(t); y=sin(t);}
6 : meshL ThL = buildmeshL(circle(n));
7 : ThL = OrientNormal(ThL,unbounded=1);
8 : BemKernel Ker(“SL”, k=2
pi)
Error line number 8, in file C:\Users\jawahar ali\OneDrive\Desktop\freefemm\bdm.edp, before token )
They are used Named parameter
current line = 8
Compile error : They are used Named parameter
line number :8, )
error Compile error : They are used Named parameter
line number :8, )
code = 1 mpirank: 0

your FreeFEM version (4.6) is too old and does not support Boundary Element formulations. Consider upgrading FreeFEM to v4.13 (v4.12 will do too, binaries are here Release FreeFEM v4.12 · FreeFem/FreeFem-sources · GitHub)

**Not compiling with new version also **
– FreeFem++ v4.12 (Wed Feb 15 11:36:54 CET 2023 - git v4.12-27-g58d32866)
file : C:\Users\jawahar ali\OneDrive\Desktop\freefemm\bdm.edp
Load: lg_fem lg_mesh lg_mesh3 eigenvalue
1 : load “msh3”(load: loadLibary C:\Program Files (x86)\FreeFem++\.\msh3 = 0)
2 : load “bem”(load: loadLibary C:\Program Files (x86)\FreeFem++\.\bem = 0)
Init_Bem

3 : real k = 10;
4 : int n = 100;
5 : border circle(t = 0, 2*pi){x=cos(t); y=sin(t);}
6 : meshL ThL = buildmeshL(circle(n));
7 : ThL = OrientNormal(ThL,unbounded=1);
8 : BemKernel Ker("SL", k=2*pi)
9 : varf

Error line number 9, in file C:\Users\jawahar ali\OneDrive\Desktop\freefemm\bdm.edp, before token varf
syntax error
current line = 8
Compile error : syntax error
line number :9, varf
error Compile error : syntax error
line number :9, varf
code = 1 mpirank: 0
try getConsole C:\Users\jawahar ali\OneDrive\Desktop\freefemm\bdm.edp
save log in : ‘C:\Users\jawahar ali\OneDrive\Desktop\freefemm\bdm.log’
wait enter ?

missing semicolon line 8 ?

i copy pasted the example in documentation on BEM

You chose the file “C:\Users\jawahar ali\OneDrive\Desktop\freefemm\try.edp”
– FreeFem++ v4.12 (Wed Feb 15 11:36:54 CET 2023 - git v4.12-27-g58d32866)
file : C:\Users\jawahar ali\OneDrive\Desktop\freefemm\try.edp
Load: lg_fem lg_mesh lg_mesh3 eigenvalue
1 : load “bem”(load: loadLibary C:\Program Files (x86)\FreeFem++\.\bem = 0)
Init_Bem

2 : load "msh3"(load: loadLibary C:\Program Files (x86)\FreeFem++\\.\msh3 = 0)
3 : real k = 10;
4 : int n = 100;
5 : border circle(t = 0, 2*pi){x=cos(t); y=sin(t);}
6 : meshL ThL = buildmeshL(circle(n));
7 : ThL = OrientNormal(ThL,unbounded=1);
8 : varf vbem(u,v) = int1dx1d(ThL)(ThL)(BEM(BemKernel("SL",k=k),u,v));
9 : fespace Uh(ThL,P1);

10 : HMatrix H = vbem(Uh,Uh);
11 : func uinc = exp(1ikx);
12 : Uh p, b;
13 : varf vrhs(u,v) = -int1d(ThL)(uincv);
14 : b[] = vrhs(0,Uh);
15 : p[] = H^-1
b;
16 : varf vpot(u,v) = int1d(ThL)(POT(BemPotential(“SL”,k=k),u,v));
17 : int np = 200;
18 : int R = 4;
19 : border b1(t=-R, R){x=t; y=-R;}
20 : border b2(t=-R, R){x=R; y=t;}
21 : border b3(t=-R, R){x=-t; y=R;}
22 : border b4(t=-R, R){x=-R; y=-t;}
23 : mesh ThOut = buildmesh(b1(np)+b2(np)+b3(np)+b4(np)+circle(-n));
24 : fespace UhOut(ThOut,P1);
25 : HMatrix HP = vpot(Uh,UhOut);
26 : UhOut u, utot;
27 : u = HP*p;
28 : utot = u + uinc;
29 : plot(utot,fill=1,value=1,cmm=“u_total”); sizestack + 1024 =2256 ( 1232 )

– FESpace: Nb of Nodes 100 Nb of DoF 100
Attempting to use an MPI routine before initializing MPI
try getConsole C:\Users\jawahar ali\OneDrive\Desktop\freefemm\try.edp
save log in : ‘C:\Users\jawahar ali\OneDrive\Desktop\freefemm\try.log’
wait enter ?

You need to run FreeFEM in parallel, i.e. with FreeFem++-mpi or ff-mpirun, as FreeFEM uses the parallel library htool under the hood for BEM

– FreeFem++ v4.12 (Wed Feb 15 11:36:54 CET 2023 - git v4.12-27-g58d32866)
file : .\mesh.edp
Load: lg_fem lg_mesh lg_mesh3 eigenvalue parallelempi
1 :
2 : load “bem”(load: loadLibary C:\Program Files (x86)\FreeFem++\.\bem = 0)
Init_Bem

3 : load "msh3"(load: loadLibary C:\Program Files (x86)\FreeFem++\\.\msh3 = 0)
4 : real k = 10;
5 : int n = 100;
6 : border circle(t = 0, 2*pi){x=cos(t); y=sin(t);}
7 : meshL ThL = buildmeshL(circle(n));
8 : ThL = OrientNormal(ThL,unbounded=1);
9 : varf vbem(u,v) = int1dx1d(ThL)(ThL)(BEM(BemKernel("SL",k=k),u,v));

10 : fespace Uh(ThL,P1);
11 : HMatrix H = vbem(Uh,Uh);
12 : func uinc = exp(1ikx);
13 : Uh p, b;
14 : varf vrhs(u,v) = -int1d(ThL)(uincv);
15 : b[] = vrhs(0,Uh);
16 : p[] = H^-1
b;
17 : varf vpot(u,v) = int1d(ThL)(POT(BemPotential(“SL”,k=k),u,v));
18 : int np = 200;
19 : int R = 4;
20 : border b1(t=-R, R){x=t; y=-R;}
21 : border b2(t=-R, R){x=R; y=t;}
22 : border b3(t=-R, R){x=-t; y=R;}
23 : border b4(t=-R, R){x=-R; y=-t;}
24 : mesh ThOut = buildmesh(b1(np)+b2(np)+b3(np)+b4(np)+circle(-n));
25 : fespace UhOut(ThOut,P1);
26 : HMatrix HP = vpot(Uh,UhOut);
27 : UhOut u, utot;
28 : u = HP*p;
29 : utot = u + uinc;
30 : plot(utot,fill=1,value=1,cmm=“u_total”); sizestack + 1024 =2256 ( 1232 )

– FESpace: Nb of Nodes 100 Nb of DoF 100
** fgmres has converged in 26 iterations The relative residual is 8.9438e-07 Cl: 0.618035
– mesh: Nb of Triangles = 63398, Nb of Vertices 32149
Plot:: Sorry no ps version for this type of plot 11
times: compile 0.172s, execution 2.632s, mpirank:0
######## We forget of deleting 57 Nb pointer, 0Bytes , mpirank 0, memory leak =0
CodeAlloc : nb ptr 4524, size :590968 mpirank: 0
Ok: Normal End

It works, but with parallel FreeFEM you need to add the command line flag ‘-wg’ (with graphics) to see plots

1 Like

Thanks you for the help I am really grateful and your lecture on BEM also helpful while learning as there are very little recourses in web.