-
Notifications
You must be signed in to change notification settings - Fork 0
/
header.f90
68 lines (47 loc) · 1.88 KB
/
header.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
!
! Copyright (C) 2013, Northwestern University
! See COPYRIGHT notice in top-level directory.
!
module header
implicit none
integer num_io, ncells
integer(KIND=8) grid_points(3) ! global array size
integer, allocatable :: cell_coord (:,:), &
cell_low (:,:), &
cell_high (:,:), &
cell_size (:,:)
! cell_coord (3,ncells), cell_low (3,ncells), &
! cell_high (3,ncells), cell_size(3,ncells), &
! start (3,ncells), end (3,ncells)
integer(KIND=8) IMAX, JMAX, KMAX
double precision, allocatable :: u(:, :, :, :, :)
! u(5, -2:IMAX+1, -2:JMAX+1, -2:KMAX+1, ncells)
integer rank, nprocs, root, niter, info_used
character(len=128) dir_path
contains
!----< allocate_variables >--------------------------------------
subroutine allocate_variables
use mpi
implicit none
info_used = MPI_INFO_NULL
IMAX = (grid_points(1)/ncells) + 1
JMAX = (grid_points(2)/ncells) + 1
KMAX = (grid_points(3)/ncells) + 1
allocate(cell_coord(3,ncells))
allocate( cell_low(3,ncells))
allocate( cell_high(3,ncells))
allocate( cell_size(3,ncells))
allocate(u(5, -2:IMAX+1, -2:JMAX+1, -2:KMAX+1, ncells))
! initialize contents of variable u
call RANDOM_NUMBER(u(1:5,-2:IMAX+1,-2:JMAX+1,-2:KMAX+1,1:ncells))
end subroutine allocate_variables
!----< deallocate_variables >------------------------------------
subroutine deallocate_variables
implicit none
deallocate(u)
deallocate(cell_coord)
deallocate( cell_low)
deallocate( cell_high)
deallocate( cell_size)
end subroutine deallocate_variables
end module header