Help with creating a baffle

I want to introduce a flat plate without thickness into a grid, essentially means inserting a line or surface that fluid cannot cross.This is akin to defining a boundary condition. The sketch is below.

The red line is the baffle. How can I create this baffle?

Add an inner boundary to your mesh. The idea is like this:

real Rout  = 5.0;
int Npts = 40; int NptsIn=20;
border circle1(t=0,2*pi){x=Rout*cos(t); y=Rout*sin(t); label=0;};
border inner(t=0,1){x=0.5*Rout*(t-0.5); y=0.0; label=1;};
mesh Th=buildmesh(circle1(Npts)+inner(NptsIn)) ;
plot(Th,wait=true); //to see the mesh
1 Like

Thank you for your answer. I ran your program successfully. But something wrong happened with my code.

real xinlet = -40;
real xoutlet = 80;
real yside = 40;
real length=5;    
real width=1;    
real n=.5;                 
border cylinder1(t=0,1){ x=-2.5+length*t;y=-0.5;label=2;}
border cylinder2(t=0,1){ x=-2.5+length*t;y=0.5;label=2;}
border cylinder3(t=0,1){ x=-2.5;y=-0.5+width*t;label=2;}
border cylinder4(t=0,1){ x=2.5;y=-0.5+width*t;label=2;}
border inlet(t=-1,1){ x=xinlet;y=yside*t;label=1;}
border baffle(t=0,1){ x=-2.5;y=0.1*t;label=2;}
border outlet(t=-1,1){ x=xoutlet;y=yside*t;label=3;}
border latsup(t=0,1){ x=xoutlet-(xoutlet-xinlet)*t;y=yside;label=3;} 
border latbot(t=0,1){ x=xoutlet-(xoutlet-xinlet)*t;y=-yside;label=3;}
mesh th=buildmesh(inlet(-2*yside*n)+outlet(2*yside*n)+latsup((xoutlet-xinlet)*n)+latbot(-(xoutlet-xinlet)*n)+cylinder1(-50)+cylinder2(50)+cylinder3(10)+cylinder4(-10)+baffle(10));

The error message is below

Missing edge 24 v0 =  0[-2.5,0] v1= 1[-2.5,0.1] 0 0x0
 There are 1 lost edges 
 The boundary is crossing maybe! 
 Fatal error in the mesh generator 10
  current line = 11
Meshing error: Bamg
 number : 10, 
 catch Err bamg 
Meshing error: Bamg
 number : 10, 
 err code 5 ,  mpirank 0

your baffle overlaps with the boundary cylinder3. Maybe this:

border baffle(t=0,1){ x=-2.5+dd;y=0.1*t+0.5;label=2;}

Also, to help you design meshes, you can plot your boundaries, for example like this:

plot( cylinder1(50) + cylinder2(-50) + cylinder3(-10) +cylinder4(10)
+baffle(10) );

then you easily see the problems

1 Like

It ran successfully. I make a stupid mistake. Thank you for your prompt reply. :smiling_face_with_three_hearts: