From: David K. <dav...@ak...> - 2018-08-07 13:54:22
|
On Tue, Aug 7, 2018 at 9:07 AM, Bailey Curzadd <bcu...@gm...> wrote: > Hi there, > > I'm using libMesh to calculate the homogenized properties of > microstructures with cuboid unit cells. To do this, the boundaries of the > unit cell require periodic boundary conditions. As far as I can tell, > though, the PeriodicBoundary class only works with structured meshes, which > isn't really a feasible option for me. Is this really the case, or have I > just missed something in my implementation? > Good question. I don't recall if PeriodicBoundary requires matching meshes or not, so I'll leave this part to someone else to answer definitively. > Currently, I am manually mapping each constrained node on the "far" > boundary to an element/side pair on the "near" boundary using > PointLocatorBase and Elem::side_ptr()->contains_point(). Then, I use the > penalty method to apply a constraint equation with coefficients found using > FE<2,LAGRANGE>::shape(). > > The issue I have at the moment most likely concerns preallocation of the > system matrix. Calls to matrix->add_matrix() are taking a very long time, > since the DofMap would obviously not expect a node on one side of the mesh > to be coupled with the nodes on the opposite side. Is there a convenient > way to make libMesh preallocate extra space beforehand, or does this need > to be done manually? I'm using PETSc, but I'd like the code to stay > solver-independent if possible. > You can augment the sparsity pattern by telling the system which extra dofs to couple. For an example of this see miscellaneous_ex9. Also, note that instead of using a penalty method, you can add dof constraint rows to the system. This is what PeriodicBoundary does under the hood. > I've considered switching to the Lagrange multiplier method using 2 > additional field variables as was suggested for a question I posted earlier > for a different project. However, this would add 2 DOFs to each node, and > I'm not even sure this would circumvent the preallocation problem I have > for the penalty method. Any suggestions concerning the best way to use > libMesh for this problem would be appreciated. > I would not use Lagrange multipliers for this. If PeriodicBoundary supports non-conforming meshes, then that would be the best way. If not, then I'd suggest adding constraint rows yourself. Best, David |