Mesh a basic structure frame

Dear all,
I’d like to mesh a basic structure frame like a picture in the link below.


This is my code.

// Mesh
border a(t=5,10) { x=t; y=10 ;label=98;}; // topbeam 98
border b(t=0,5) { x=t; y=t+5 ;label=84;}; // 84
border c(t=10,0) { x=t; y=5 ;label=456;}; // 456
border d(t=5,10) { x=t; y=t-5;label=62;}; // 62
border e(t=10,0) { x=5; y=t;label=258;}; // 258
border f(t=0,5) { x=t; y=10;label=87;}; // topbeam 87
border g(t=0,10) { x=0; y=t;label=741;}; // leftbeam 741
border h(t=10,0) { x=t; y=t;label=159;}; // 159
border i(t=0,10) { x=10; y=t;label=963;}; // rightbeam 963
border j(t=0,10) { x=t; y=0;label=321;}; // bottombeam 321
mesh Th = buildmesh(j(10)+i(10)+h(10)+g(10)+f(5)+e(10)+d(5)+c(10)+b(5)+a(10));
plot(Th,wait=true,ps=“final-report-meshTest.eps”);

and then, I have this error

Error in the definition of subdomain 0 boundary border 10/10: wrong direction 0 1
Error in the definition of subdomain 5 boundary border 5/10: wrong direction 40 1
Error in the definition of subdomain 6 boundary border 4/10: wrong direction 45 1
Fatal error in the mesh generator 777
current line = 11
Meshing error: Bamg
number : 777,
catch Err bamg
Meshing error: Bamg
number : 777,
err code 5 , mpirank 0

Is there anyone can give me some advise?
Thanks for your help.

Best regards.

If I were you, I’d use a square(2, 2), then ThTab[i] = trunc(Th, condition on x and y, label = something) + call the change function to set a specific region for each triangle. Then, you can glue all ThTab[i] together, and call trunc(ThGlued, 1, split = 10) to refine the mesh.

1 Like