How to mesh an interior rectangle?

Hello,
You must not double the lines. You can make your middle horizontal line with three pieces, and then the three remaining sides of A are three other pieces.
Then you build the mesh as in the example of
https://doc.freefem.org/documentation/mesh-generation.html
code before figure 58.
The mesh will automatically have three regions. In order to get the region numbers,
You take the coordinate of a point (x_1,y_1) and then int n1=Th(x_1, y_1).region
gives you the region number (which (x_1,y_1) belongs to).
You can then create your variational formulation over this region by involving
int2d(Th,n1)(...)
You do similarly with the two other regions.

1 Like