Hello,
You have to define a multi-border as in Input Border Data from an External File in FreeFEM++ - #3 by fb77
The principle is to define
border a(t=0.,1.;i){ x=(1.-t)*bdrydatx(i)+t*bdrydatx(i+1); y=(1.-t)*bdrydaty(i)+t*bdrydaty(i+1);label=1;}
In this definition, i
stands for an integer varying from 0
to n-1
, where n
is to be given when you plot or build the mesh by calling a()
.
Then you write
mesh Th=buildmesh(a(discr));
where discr
is an array containing the number of segments that you want when you split each border element.
Then the above n
is the length of discr
.
Example (here n=3
):
real[int] bdrydatx=[1,3,2,1];
real[int] bdrydaty=[0,1,4,0];
int[int] discr=[1,2,2];
border a(t=0.,1.;i){ x=(1.-t)*bdrydatx(i)+t*bdrydatx(i+1); y=(1.-t)*bdrydaty(i)+t*bdrydaty(i+1);label=1;}
mesh Th=buildmesh(a(discr));
plot(Th);
It gives
The lower border is split in 1 piece, the two other borders are split in 2 pieces because
discr=[1,2,2]
.You can use several multi-borders of this type in a command like
mesh Th=buildmesh(a1(discr1)+a2(discr2));