The outer loop iterates over all radial cells i = is_global, ie_global. If the MPI task contains cells in that shell, it adds to shellmass. Otherwise, shellmass remains zero.
A call to allreduce_mpi sums up contributions to that shell from all MPI tasks. MPI tasks which do not contain that shell contribute zero. Then shellmass is added to the array mc.
This makes the masscoordinate function MPI safe.
The outer loop iterates over all radial cells
i = is_global, ie_global
. If the MPI task contains cells in that shell, it adds toshellmass
. Otherwise,shellmass
remains zero.A call to
allreduce_mpi
sums up contributions to that shell from all MPI tasks. MPI tasks which do not contain that shell contribute zero. Thenshellmass
is added to the arraymc
.