I have a few general questions on how to set up periodic boundary conditions. (I hope it is ok to post these together in a single question in this forum; otherwise I'm happy to ask them separately.)
Let's assume I have a rectangular domain represented by an irregular mesh and I'd like to apply PBCs in x-direction, i.e. identify the left and right sides of the domain. However, due to the irregularity of the mesh there is no exact correspondence between the vertices on the left boundary and those on the right boundary. From looking at the Poisson demo with PBCs this does not seem to matter. However, the answer to this question seems to imply that such a correspondence must exist. So my first question is: do I need to take care that mesh vertices on the periodic boundaries match up? Or is dolfin clever enough to deal with general meshes?
Secondly, which cases does the map()
method of my PeriodicBoundary
class need to cover? In particular, for which vertices will it be called? I would have thought that it is only called for the vertices on the boundary that are to be identified with the other side (e.g. the vertices on the right bounday in the rectangular domain). However, adding print statements to my map() function shows that it is called for many more vertices, including ones that lie inside the domain. So my second question is: what should those points be mapped to? In the answer to this question there are two examples, where the first one shows a mapping to some invalid values (here: -1000) whereas the second one doesn't even cover that case. So I'm a bit confused what needs to be mapped and where. Any clarification would be much appreciated. Many thanks!