Replies: 2 comments 1 reply
-
By ghost elements, you mean you merely want the boundary elements to be geometrically present, and you don't need to retain any algebraic information on them? The mesh API is the correct one for that, but if you really do need algebraic information too then But the most likely mistake to make (one which required changes in even our example codes) is hinted at by an imprecision in your language: even with a GhostingFunctor, ghost elements can never be added. They can only be prevented from being removed when the mesh goes distributed, or transferred along with the local elements they're tied to when the mesh gets redistributed. In our examples where we originally would attach periodic boundary conditions to a system after it's mesh had already been prepared for use, for example, it was too late - the periodic pairs of elements had already been decoupled and the remote ones deleted on every processor and so by the time the PBCs were added they couldn't be recovered. In your case, if you were to write a ghosting functor that loops over all elements looking for boundary elements to retain, but you only attached it after the mesh has been distributed, it would never see any of the already-deleted boundary elements and so would never be able to report that they shouldn't have been deleted. You'd have to either add the ghosting functor before the mesh is ever prepared, or reserialize the mesh temporarily after adding it but before relying on it. If neither of those are the source of the error ... nothing else comes to mind immediately. I'd love to see an example in that case. |
Beta Was this translation helpful? Give feedback.
-
Roy, Thanks, as always, for the thorough response. I do think I am missing something fundamental, or my C++ inexperience is getting the best of me. First to your question....
Correct. I only need the geometric information. I am attaching the GhostingFunctor before I read the mesh from file, which I think is early enough. I have attached an example (using libMesh 1.6.2) where I read a mesh three times.
For each, I write out the number of ghost elements on each processor, and all cases are identical. I have attached the code (file extension changed to allow upload), and the output on four processors is: Case 0: No GhostingFunctor Processor, # ghost elements Case 1: MyGhostingFunctor_1 Processor, # added ghost elements Processor, # ghost elements Case 2: MyGhostingFunctor_2 Processor, # added ghost elements Processor, # ghost elements Perhaps my check for the number of ghost elements is erroneous? std::distance(mesh.ghost_elements_begin(),mesh.ghost_elements_end()) Also notice that the GhostingFunctor operator() gets called twice per processor during the read: once with the proper processor id and the second time with processor id = 4294967295. This makes me think I have some bad C++. I apologize if this is user incompetence. Thanks, Adam |
Beta Was this translation helpful? Give feedback.
-
Hello,
Does anyone in the community have a simple example of using a GhostingFunctor to add ghost elements for a DistributedMesh? I can't seem to get it working. I essentially want to add all boundary elements as ghost elements on every processor. Miscellaneous example 9 (https://github.com/libMesh/libmesh/tree/master/examples/miscellaneous/miscellaneous_ex9) uses a GhostingFunctor, but it attaches to the DofMap as a coupling functor. I want to utilize DistributedMesh::add_ghosting_functor(), which I think is the preferred approach over DistributedMesh::add_extra_ghost_elem().
As an alternative, I could comment up a simple example that I think is not working for me, if that would be useful.
Thanks to anyone who can point me in the right direction.
Adam
Beta Was this translation helpful? Give feedback.
All reactions