forked from wkliao/S3D-IO
-
Notifications
You must be signed in to change notification settings - Fork 0
/
param_m.f90
95 lines (78 loc) · 3.41 KB
/
param_m.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
!
! Copyright (C) 2013, Northwestern University
! See COPYRIGHT notice in top-level directory.
!
module param_m
implicit none
integer nx_g ! global number of grid points in x-direction
integer ny_g ! global number of grid points in y-direction
integer nz_g ! global number of grid points in z-direction
integer nx ! local number of grid points in x-direction
integer ny ! local number of grid points in y-direction
integer nz ! local number of grid points in z-direction
integer npx ! number of processors in x-direction
integer npy ! number of processors in y-direction
integer npz ! number of processors in z-direction
integer nsc ! number of chemical species (excluding N2)
integer n_spec ! number of chemical species including N2
contains
!----< initialize_param() ---------------------------------------
subroutine initialize_param(myid,gcomm)
! sets various parameters
use mpi
use runtime_m, only: i_time_end, run_title
implicit none
! declarations passed in
integer myid, gcomm
! local declarations
integer err, iflag
i_time_end = 5 ! number of checkpoints (also number of output files)
run_title = 'pressure_wave_test' ! prefix of output file names
! set iflag
iflag=0
if (myid .EQ. 0) then
! error trapping for number of grid points in x-direction
if (mod(nx_g,npx) .NE. 0 ) then
print*, ' Grid Pts in X dimension ', nx_g, &
' are not exactly divisible by ', npx , &
' number of PEs in the X dimension '
iflag=1
endif
! error trapping for number of grid points in x-direction
if (mod(ny_g,npy) .NE. 0 ) then
print*, ' Grid Pts in Y dimension ', ny_g, &
' are not exactly divisible by ', npy , &
' number of PEs in the Y dimension '
iflag=1
endif
! error trapping for number of grid points in x-direction
if (mod(nz_g,npz) .NE. 0 ) then
print*, ' Grid Pts in Z dimension ', nz_g, &
' are not exactly divisible by ', npz , &
' number of PEs in the Z dimension '
iflag=1
endif
! set local number of grid points
nx = nx_g / npx
ny = ny_g / npy
nz = nz_g / npz
! set chemistry parameters based on chemkin initialization
n_spec=11
nsc=n_spec-1 !set number of chemical species for DNS purposes
endif
! check status of error
call MPI_Bcast(iflag,1,MPI_INTEGER,0,gcomm,err)
if (iflag .EQ. 1) then
call MPI_Comm_free(gcomm,err)
call MPI_Finalize(err)
stop
endif
! broadcast local grid parameters
call MPI_Bcast(nx, 1, MPI_INTEGER, 0, gcomm, err)
call MPI_Bcast(ny, 1, MPI_INTEGER, 0, gcomm, err)
call MPI_Bcast(nz, 1, MPI_INTEGER, 0, gcomm, err)
! broadcast chemistry parameters
call MPI_Bcast(nsc , 1, MPI_INTEGER, 0, gcomm, err)
call MPI_Bcast(n_spec, 1, MPI_INTEGER, 0, gcomm, err)
end subroutine initialize_param
end module param_m