On Wed, 26 Aug 2015, namu patel wrote:

> I am working on a problem that entails updating the nodal coordinates of
> the mesh at every timestep (and is performed before the beginning of the
> problem solve). If I'm not mistaken, when running the simulation in
> parallel each processor owns a subset of the mesh nodes and no one node is
> shared amongst multiple processors. Other processors do, however, have
> information of the bordering subdomain nodes that are associated with the
> element DOFs that they own. Thus, if I update the position of the nodes by
> iterating over the local nodes, then this requires synchronization amongst
> processors to update the shared DOFs. How can I achieve this
> synchronization for the "ghost" DOFs? If this entails an entire mesh
> redistribution or some other expensive operation, then would it possibly be
> more efficient to iterate over all nodes (not only local) to avoid this
> costly step?

If you're using a SerialMesh, and updating based on some
already-serialized information, then it's probably most efficient to
iterate over all nodes.

If you're using a ParallelMesh then iterating over all nodes is
impossible; if your update is expensive or is based on something distributed
like solution values then iterating over all nodes is inefficient.  In either
case you'll want to sync the ghost and remote nodes' new locations.  There's an
example in our Laplace smoother code:

// Now the nodes which are ghosts on this processor may have been moved on
// the processors which own them.  So we need to synchronize with our neighbors
// and get the most up-to-date positions for the ghosts.
SyncNodalPositions sync_object(_mesh);
Parallel::sync_dofobject_data_by_id
   (_mesh.comm(), _mesh.nodes_begin(), _mesh.nodes_end(), sync_object);

> Lastly, is updating only the coordinates of the nodes sufficient or are
> there any other things that I should be weary of? In the code, anywhere
> where calculations are done on the element, the reinit function is called
> and the call is placed after the accessor function calls. This should take
> care of everything, right?

As long as you call reinit() after the update you should be fine, right.  There
are more complicated functions for synchronizing more data in parallel, but if
nodal coordinates are the only things you're modifying then I think the above
code should be sufficient for you.
---
Roy

------------------------------------------------------------------------------
_______________________________________________
Libmesh-users mailing list
Libmesh-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libmesh-users

Reply via email to