Mesh generation when the number of border portions changes

Hi, folks!

I’m dealing with a very interesting problem in 2D where the geometric domain is given by the union of unit balls. As the center of each unit ball is relocated based on an optimization process, the geometric domain changes from one iteration to another.

Let’s look at the following situation: suppose the domain is formed by 4 balls. At Iteration 1, the union of the balls results in a geometric domain delimited by 6 arcs; whereas at Iteration 2, only 4 arcs are needed to delimit the new geometric domain. See the sketch provided in the pdf file. It’s worth pointing out that I know all the arcs at each iteration, i.e., I know the numbers of arcs and I’m able to parameterize each of them.

The main issue when using buildmesh (in an iterative process) is the need to deliver each portion of the boundary (arc) in a new line of the code, and with a new name. In other words, I do not know how to automate the delivery of a new geometric domain when the number of arcs changes from one iteration to another. How can I do that?

You could use the “multi border” feature and resize the arrays every time the number of borders changes. Search for “mesh building with array of border” in the Documentation.

1 Like

Thanks a lot for your tip! The multi-border scheme is the fitting solution for the case I’m dealing with. I found a clear example in a presentation by Professor Frederic Hecht at the 13th FreeFEM 2021. It’s given on page 42 in the attached pdf file, in case other users need it.

ff-days-13.pdf (3.4 MB)