current line = 163
Assertion fail : (kkk++ < 10)
line :1141, in file lgfem.cpp
Segmentation fault (core dumped)
If we use the parameterised space (\theta, \phi) to solve PDEs on a sphere, then the boundaries at \phi=0 and \phi=\pi should really be collapsed to single points – we may try various tricks and boundary conditions to, but none of them seems entirely satisfactory.
Anyway, I am trying to implement this using periodic boundary conditions. However, it seems that the maximum number of periodic pairs is 10. Is this really the case in FreeFEM?
int m = 8;
// --------------------------------------------------
// geometry arrays
// --------------------------------------------------
real[int] xxb(m+1), yyb(m+1);
real[int] xxt(m+1), yyt(m+1);
int[int] nbot(m), ntop(m);
real[int] lbot(m), ltop(m);
macro dist(ax,ay,bx,by) sqrt(square(ax-bx)+square(ay-by)) //EOM
// bottom boundary
for(int i=0;i<=m;i++){
xxb[i] = 2pii/m;
yyb[i] = phi1;
}
for(int i=0;i<m;i++){
nbot[i] = 1;
lbot[i] = dist(xxb[i],yyb[i],xxb[i+1],yyb[i+1]);
}
border Bot(t=0,1;i){
x = xxb[i]*(1-t) + xxb[i+1]*t;
y = yyb[i];
label = i+1;
}
// top boundary
for(int i=0;i<=m;i++){
xxt[i] = 2pi(m-i)/m;
yyt[i] = phi2;
}
for(int i=0;i<m;i++){
ntop[i] = 1;
ltop[i] = dist(xxt[i],yyt[i],xxt[i+1],yyt[i+1]);
}
border Top(t=0,1;i){
x = xxt[i]*(1-t) + xxt[i+1]*t;
y = yyt[i];
label = 101 + i;
}
// side boundaries
border cr(t=phi1,phi2){
x = 2*pi;
y = t;
label = 1001;
};
border cl(t=phi2,phi1){
x = 0;
y = t;
label = 1002;
};
// build mesh
mesh Th = buildmesh(Bot(nbot) + cr(m/2) + Top(ntop) + cl(m/2));
plot(Th,wait=1);
// --------------------------------------------------
// periodic parametrisation
// --------------------------------------------------
macro PERIOBOT(k)
[k,abs(x-xxb[k-1])/lbot[k-1]] //EOM
macro PERIOTOP(k)
[100+k,abs(xxt[k-1]-x)/ltop[k-1]] //EOM
macro BOTPAIR(k) PERIOBOT(k-1),PERIOBOT(k) //EOM
macro TOPPAIR(k) PERIOTOP(k-1),PERIOTOP(k) //EOM
// --------------------------------------------------
// periodic list
// --------------------------------------------------
func perio = [
[1001,y],
[1002,y],
BOTPAIR(2), BOTPAIR(3), BOTPAIR(4), BOTPAIR(5), BOTPAIR(6),
BOTPAIR(7), BOTPAIR(8),
TOPPAIR(2), TOPPAIR(3), TOPPAIR(4), TOPPAIR(5), TOPPAIR(6),
TOPPAIR(7), TOPPAIR(8)];
//////////////////////////////////////////////////////////////////////
// Finite element spaces with periodicity
//////////////////////////////////////////////////////////////////////
func Pk=[P1,P1];
fespace Rh(Th, Pk, periodic=perio);
The code looks ugly, but it works up to m=8 at least. The following error appears when set m=9:
current line = 130
Assertion fail : (kkk++ < 10)
line :1141, in file lgfem.cpp
Segmentation fault (core dumped)
Doe someone have a better idea to collapse the degrees of freedom, or general ideas to deal with singular boundaries ? Thank you very much in advance!
By the way, years ago when I worked on a software package called FEPG (Finite Element Programmer Generator), the periodic conditions were just handled simply as constraints. If all constraints are eliminated during the assembly of the global matrix, then periodic conditions can be handled quite conveniently at that stage. However, I don’t think this is the way FreeFEM or most other FEM software packages deal with constraints?
