The above error was generated when the function was called with bid=2 and direction=2. I have checked using gmsh gui that the boundary ids have been correctly assigned. What is causing this error? Am I missing a step somewhere?
-----------------------------------------------------------------------------------------
// Simple cube geometry
lc=0.1;
l=1;
// 2D geometry
p1=newp; Point(p1) = {0,0,0,lc};
p2=newp; Point(p2) = {l,0,0,lc};
p3=newp; Point(p3) = {l,l,0,lc};
p4=newp; Point(p4) = {0,l,0,lc};
l1=newl; Line(l1) = {1,2};
l2=newl; Line(l2) = {2,3};
l3=newl; Line(l3) = {3,4};
l4=newl; Line(l4) = {4,1};
Transfinite Curve{l1,l2,l3,l4} = 10;
ll1=newll; Curve Loop(ll1) = {l1,l2,l3,l4};
s1=news; Plane Surface(s1) = {ll1};
Transfinite Surface{s1} = {p1,p2,p3,p4};
Recombine Surface{s1};
// 3D extrusion
out[] = Extrude {0,0,l} {
Surface{s1}; Layers{10}; Recombine;
};
// Physical entities
// periodic BCs must have same boundary id
Physical Volume(1) = {out[1]};
Physical Surface(2) = {s1,out[0]}; // z dir faces
Physical Surface(1) = {out[2],out[4]}; // y dir faces
Physical Surface(0) = {out[3],out[5]}; // x dir faces