[FLASH-USERS] sum over all blocks
Ryan Farber
rjfarber at umich.edu
Tue Jun 8 16:49:12 EDT 2021
Hi Maksim,
Something along the lines of
call MPI_ALLREDUCE(local_total_mass_of_blocks, global_total_mass_of_blocks,
1, FLASH_REAL, MPI_SUM, dr_globalComm, ierror)
preceded by computing the local_total_mass_of_blocks on each processor (via
loop or Fortran intrinsic "sum" along with proper array indexing) should do
the trick for what you want.
Don't forget
#include "Flash_mpi.h"
and other variable declarations, etc.
Best,
--------
Ryan
On Tue, Jun 8, 2021 at 2:58 AM Maksim Kozlov <maksim.kozlov at nu.edu.kz>
wrote:
> Dear flash users,
> I need to sum some variable over all blocks of the computational domain.
> Blocks of the computational domain are divided between different processors
> for parallel computations. Variables blockCount in
> Simulation_adjustEvolution or count in gr_expandDomain take into account
> only blocks processed by one processor not all blocks in the computational
> domain. Cycles in these subroutines run only through blocks of one
> processor. I would really appreciate it if somebody gives me an idea on how
> I can run through all blocks of the computational domain to calculate the
> sum of some variable over all blocks (for example total volume of blocks or
> total mass of blocks).
> Thank you very much!
> Maksim Kozlov
>
>
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> Без
> вирусов. www.avast.com
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
> <#m_-5902009028444939821_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://flash.rochester.edu/pipermail/flash-users/attachments/20210608/c5e6a3dd/attachment-0001.htm>
More information about the flash-users
mailing list