From: Roy S. <roy...@ic...> - 2007-06-01 01:44:54
|
I've just added support for using DofMap constraints to impose periodic boundary conditions. There's been some interest in this on the mailing lists in the past, so if anyone would like to test it out: Download the latest CVS. (Or just "cvs update" an existing tree and possibly "make distclean" to be safe) Run "./configure --enable-everything" (or just "--enable-periodic" along with whatever other options you need), and recompile. Create a mesh with boundary ids corresponding to each side of the periodic boundary. The coarse mesh needs to be conforming across the boundary. Add code like the following (which works with build_square's boundary ids on a square of width W, height H) before equation_systems.init(): PeriodicBoundary p1, p2; p1.myboundary = 0; // Bottom p1.pairedboundary = 2; // Top p1.translation_vector = RealVectorValue(0, H); p2.myboundary = 3; // Left p2.pairedboundary = 1; // Right p2.translation_vector = RealVectorValue(W, 0); mysystem.get_dof_map().add_periodic_boundary(p1); mysystem.get_dof_map().add_periodic_boundary(p2); In theory, this feature should work even with non-straight boundaries, periodic boundaries that meet at corners, adaptive refinement (except that level-1 rules aren't yet enforced between boundaries), C0 and C1 elements, etc. In practice, I've only tested it on one application on a uniform square grid, and it'll probably break if you look at it funny. Send any bug reports to libmesh-devel. API suggestions are appreciated too. I've currently got the PeriodicBoundaries defined in the DofMap, but one could argue that it should be a property of a Mesh or that it should be per-variable. --- Roy |