This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Periodic Boundary Condition

0 votes

I am new to FEniCS, and can't quite seem to understand how to create periodic boundary conditions. How do I approach creating a periodic boundary condition that is a 250 x 250 x 250 cube (containing a few objects inside, i.e.: sphere, cylinder, etc)?

asked Mar 10, 2017 by nicsn FEniCS Novice (150 points)

1 Answer

+2 votes

There is a demo here for a 2D square where the left and right boundaries are periodic. You only have to define a function space that is constrained by a periodic boundary condition, which in turn is defined by a mapping between boundaries that are related by periodicity.
Here is an example where this is done for 3D and more than one periodic boundary.

answered Mar 10, 2017 by dajuno FEniCS User (4,140 points)

Thanks! Is there any way to see this on a graph?

What do you mean, a periodic solution or an illustration of a periodic domain?

An illustration of the periodic domain, for instance, a 2D square or 3D cube (one instance of it).

Well, the 2D example is just a unit square with Dirichlet BCs on the top and bottom boundaries and periodicity on the left and right boundaries. For the 3D case it is explained in the accepted answer. If you have difficulties with the concept of periodic boundary conditions you should read about them first, e.g. on wikipedia.

Imagine that if, for instance, you are solving a transport equation in a 2D square domain with periodic BCs on the left & right boundaries, these boundaries are glued together, and your domain is like a cylinder (torus if all boundaries are periodic). Everything that leaves on the right enters on the left and vice versa. So you just "map" the coordinates of the left boundary to the coordinates of the right boundary.

...