[FLASH-USERS] sum variable across different processors
Ernesto Zurbriggen
ezurbriggen at unc.edu.ar
Mon Jun 7 10:06:48 EDT 2021
Hi Maksim!
Maybe the more appropriate and easier place to sum over all cells is in the
Simulation_adjustEvolution routine.
This is a stub routine (see the user manal sec. 4.2.1) called by default
every cycle (you will be able to sum over
cells in each time step). There you will find the number of blocks blkcnt.
So you should have a copy of this
routine in your problem directory with a piece of code of the type:
do n=1,blkcnt
blockId = blockList(n)
call Grid_getBlkPtr(blockId,S,CENTER)
call Grid_getBlkIndexLimits(blockID,blk,blkGC)
call Grid_getCellCoords(IAXIS,blockId,CENTER,.false.,xCoord,sizeX)
call Grid_getCellCoords(JAXIS,blockId,CENTER,.false.,yCoord,sizeY)
do k=kb,ke
do j=jb,je
do i=ib,ie
...
...
...
enddo i
enddo j
enddo k
enddo
Best!
Ernesto.
El dom, 6 jun 2021 a las 11:51, Maksim Kozlov (<maksim.kozlov at nu.edu.kz>)
escribió:
> Dear Flash users,
> How can I sum variable across all blocks , not just blocks calculated by
> one processor?
> I am trying to do the following
> I need to sum some variable calculated inside Simulation_initBlock over
> several blocks. So in "gr_expandDomain" I added
> srce_volume=0
> do i = 1, count
> ...
> call Simulation_initBlock (blkList(i),tvolume)
> srce_volume=srce_volume+tvolume
> end do
> to use srce_volume in different subroutines I added
> real, save :: srce_volume
> to Simulation_data
> and
> use Simulation_data, ONLY : srce_volume
> in all subroutines where I need it
> but what happens is that all blocks are divided between different
> processors so srce_volume is summed only over blocks of one processor
> instead of adding it for all blocks.
> Thank you very much!
> Maksim Kozlov
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://flash.rochester.edu/pipermail/flash-users/attachments/20210607/11c8cda4/attachment-0001.htm>
More information about the flash-users
mailing list