Hello,
Currently, cylinders has no origin input, but I’ve just opened a pull request to add one: Add origin input to cyliders by mscroggs · Pull Request #147 · bempp/bempp-cl · GitHub.
More generally, if you want to use a shape that isn’t provided in the shapes module, you can write a import the function __generate_grid_from_gmsh_string
and pass a gmsh string into this. For example, the following example will make a mesh just like bempp.api.shapes.cylinders
, but you could edit the gmsh string to adjust the mesh. (I made this example by adding a print inside the cylinders function)
from bempp.api.shapes import __generate_grid_from_gmsh_string
geo = """
cl = 1.0;
z = 1.0;
Point(1) = {0.0, 0.0, 0.0, cl};
Point(2) = {0.5,0.0,0.0,cl};
Point(3) = {0.0,0.5,0.0,cl};
Point(4) = {-0.5,0.0,0.0,cl};
Point(5) = {0.0,-0.5,0.0,cl};
Circle(1) = {2, 1, 3};
Circle(2) = {3, 1, 4};
Circle(3) = {4, 1, 5};
Circle(4) = {5, 1, 2};
Line Loop(11) = {3, 4, 1, 2};
Plane Surface(21) = {11};
Point(6) = {1.0,0.0,0.0,cl};
Point(7) = {0.0,1.0,0.0,cl};
Point(8) = {-1.0,0.0,0.0,cl};
Point(9) = {0.0,-1.0,0.0,cl};
Circle(5) = {6, 1, 7};
Circle(6) = {7, 1, 8};
Circle(7) = {8, 1, 9};
Circle(8) = {9, 1, 6};
Line Loop(12) = {7, 8, 5, 6};
Plane Surface(24) = {12, -11};
Point(10) = {1.5,0.0,0.0,cl};
Point(11) = {0.0,1.5,0.0,cl};
Point(12) = {-1.5,0.0,0.0,cl};
Point(13) = {0.0,-1.5,0.0,cl};
Circle(9) = {10, 1, 11};
Circle(10) = {11, 1, 12};
Circle(11) = {12, 1, 13};
Circle(12) = {13, 1, 10};
Line Loop(13) = {11, 12, 9, 10};
Plane Surface(27) = {13, -12};
Point(14) = {1.7,0.0,0.0,cl};
Point(15) = {0.0,1.7,0.0,cl};
Point(16) = {-1.7,0.0,0.0,cl};
Point(17) = {0.0,-1.7,0.0,cl};
Circle(13) = {14, 1, 15};
Circle(14) = {15, 1, 16};
Circle(15) = {16, 1, 17};
Circle(16) = {17, 1, 14};
Line Loop(14) = {15, 16, 13, 14};
Plane Surface(30) = {14, -13};
out[] = Extrude {0,0,z} {Surface{21}; Layers{cl};};
Reverse Surface{21};
Physical Surface(10) = {21, out[0]};
Physical Surface(21) = {out[2], out[3], out[4], out[5]};
out[] = Extrude {0,0,z} {Surface{24}; Layers{cl};};
Reverse Surface{24};
Physical Surface(20) = {24, out[0]};
Physical Surface(32) = {out[2], out[3], out[4], out[5]};
out[] = Extrude {0,0,z} {Surface{27}; Layers{cl};};
Reverse Surface{27};
Physical Surface(30) = {27, out[0]};
Physical Surface(43) = {out[2], out[3], out[4], out[5]};
out[] = Extrude {0,0,z} {Surface{30}; Layers{cl};};
Reverse Surface{30};
Physical Surface(40) = {30, out[0],out[2], out[3], out[4], out[5]};
b() = Boundary{Volume{1};};
b() = Boundary{Volume{2};};
b() = Boundary{Volume{3};};
b() = Boundary{Volume{4};};
Mesh.Algorithm = 3;
"""
grid = __generate_grid_from_gmsh_string(geo)