# How is Sommerfeld boundary condition applied in this model problem

real k = 10;
int n = 100;
border circle(t = 0, 2pi){x=cos(t); y=sin(t);}
meshL ThL = buildmeshL(circle(n));
ThL = OrientNormal(ThL,unbounded=1);
varf vbem(u,v) = int1dx1d(ThL)(ThL)(BEM(BemKernel(“SL”,k=k),u,v));
fespace Uh(ThL,P1);
HMatrix H = vbem(Uh,Uh);
func uinc = exp(1i
kx);
Uh p, b;
varf vrhs(u,v) = -int1d(ThL)(uinc
v);
b = vrhs(0,Uh);
p = H^-1b[];
varf vpot(u,v) = int1d(ThL)(POT(BemPotential(“SL”,k=k),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”);

I can’t get it to compiles on 4.12 its stumbling at OrientNormal,

``````ff-mpirun -np 1  forumrad.edp -wg
'/usr/bin/mpiexec' --oversubscribe -np 1 /home/ubuntu/dev/freefem/install/bin/FreeFem++-mpi -nw 'forumrad.edp' -wg
-- FreeFem++ v4.12 (Sat 20 May 2023 07:29:03 PM EDT - git no git)
Load: lg_fem lg_mesh lg_mesh3 eigenvalue parallelempi
Init_Bem

2 : real k = 10;
3 : int n = 100;
4 : border circle(t = 0, 2*pi){x=cos(t); y=sin(t);}
5 : meshL ThL = buildmeshL(circle(n));
6 : ThL=OrientNormal The Identifier OrientNormal does not exist

Error line number 6, in file forumrad.edp, before  token OrientNormal

``````

https://doc.freefem.org/documentation/BEM.html

yes we have to load msh3 that is missing if you add msh3 and run it in mpi it will work fine .My doubt is how is Sommerfeld boundary condition applied here. Do you know how to make a dynamic mesh in freefem?

Thanks.
Directly relevant to your question sources of information include the documentation,
the BEM source code, and dumping the matrix and RHS that BEM generates.

I haven’t actually used it myself but was going to dig into it some time anyway.
The documentation claims this
for single layer,
https://doc.freefem.org/documentation/BEM.html#bemintrobio

I had to make several changes to the code including adding “complex” and the
browser mangles asterisks and quotes. It compiles but I don’t have enough memory
for np=200 and 50 didn’t converge.