source: CIVL/mods/dev.civl.abc/examples/fortran/flash/heat_min/heat_min.F90

main
Last change on this file was aad342c, checked in by Stephen Siegel <siegel@…>, 3 years ago

Performing huge refactor to incorporate ABC, GMC, and SARL into CIVL repo and use Java modules.

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5664 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 2.3 KB
Line 
1#ifndef NBLK
2#define NBLK 10
3#endif
4
5subroutine HeatMin(io_meshMe)
6
7#include "Flash.h"
8#include "constants.h"
9
10 implicit none
11
12 integer :: mblk = MAXBLOCKS
13
14 real :: data(1,NXB,NYB,NZB,NBLK)
15
16 integer :: gr_globalNumBlocks, gr_globalOffset
17 integer :: gr_nToLeft(0:NPROC)
18 integer :: io_meshNumProcs, io_meshMe
19 integer :: localNumBlocks, localOffset
20 integer :: alnblocks, xx, yy, procBlocks
21
22 integer :: nxb, nyb, nzb
23 integer :: unk(1,NXB,NYB,NZB,MAXBLOCKS)
24
25
26 gr_globalNumBlocks = NBLOCK
27 io_meshNumProcs = NPROC
28
29!!!! src: source/IO/IOMain/hdf5/parallel/PM/io_readData.F90 #196--284
30
31 ! compute the approximate number of blocks per processor
32 alnblocks = gr_globalNumBlocks/io_meshNumProcs + 1
33
34!$ CIVL $assume(alnblocks <= mblk)
35
36 ! figure out the excess blocks
37 yy = (io_meshNumProcs*alnblocks) - gr_globalNumBlocks
38 xx = io_meshNumProcs - yy
39
40 ! loop over all the processor numbers and figure out how many blocks are
41 ! stored to the left of the processor -- this is a little tricky
42
43 gr_nToLeft(0) = 0
44
45 do i = 0, io_meshNumProcs - 2
46 if (i .LT. xx) then
47 procBlocks = alnblocks
48 else
49 procBlocks = alnblocks - 1
50 endif
51
52 if (alnblocks .EQ. 0) then
53 if (i .LT. gr_globalNumBlocks) then
54 procBlocks = 1
55 else
56 procBlocks = 0
57 end if
58 end if
59
60 ! we have the number of blocks on proc i, the number of blocks on i+1 is
61 ! the number of blocks on i + the number of blocks left of i
62 if (i .EQ. 0) then
63 gr_nToLeft(i+1) = procBlocks
64 else
65 gr_nToLeft(i+1) = procBlocks + gr_nToLeft(i)
66 endif
67 enddo
68
69 ! figure out how many blocks are on the current proc.
70 if (io_meshMe < xx) then
71 localNumBlocks = alnblocks
72 else
73 localNumBlocks = alnblocks - 1
74 endif
75
76 if (alnblocks .EQ. 0) then
77 if (io_meshMe < gr_globalNumBlocks) then
78 localNumBlocks = 1
79 else
80 localNumBlocks = 0
81 end if
82 end if
83
84 ! compute the offset into the dataspace in the HDF5 file
85 gr_globalOffset = gr_nToLeft(io_meshMe)
86
87 localOffset = gr_globalOffset
88
89!!!! Simulation H5Sselect_hyperslab in mode H5S_SELECT_SET
90 do iblk=1,nxb
91 do
92 end do
93 unk(1,:,:,:,1:1+localNumBlocks) = data(1,:,:,:,localOffset:localOffset+localNumBlocks)
94
95end subroutine
Note: See TracBrowser for help on using the repository browser.