forked from DwyaneChou/BPEM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontrol.f90
190 lines (161 loc) · 6.25 KB
/
control.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
module control
implicit none
character slash
!da_get_unit
integer,parameter:: unit_start=1000
integer,parameter:: unit_end=3000
logical:: unit_used(unit_start:unit_end)=.false.
!namelist
!&system_setting
character*7 system_type !Choose from 'Windows' or 'Linux'
integer max_openmp_threads
namelist /system_setting/ system_type,max_openmp_threads
real run_hours,history_interval
namelist /time_control/ run_hours,history_interval
!&files
character*500 input_data_path ,&
output_data_path
namelist /files/ input_data_path ,&
output_data_path
!&domains
integer:: s_we=1,&
s_sn=1,&
e_we ,&
e_sn
!&dynamic
integer :: integration_option = 1
integer :: time_integration_order = 3
integer :: diff_order = 8
real :: spec_exp = 0.3333333333333333
namelist /dynamics/ integration_option,time_integration_order,diff_order,spec_exp
real time_step
namelist /domains/ time_step
!output
integer output_time_num
real history_interval_seconds
character*33 XTIME_units
!integration
type domain
integer x_grd_num,y_grd_num ,&
x_grd_num_u,y_grd_num_u ,&
x_grd_num_v,y_grd_num_v
integer map_proj,bdy_width,bdy_time_num,bdy_tend_time_num
real integerated_step_num,interval_seconds,dx,cen_lat,cen_lon,truelat1,truelat2,stand_lon
character,allocatable:: times(:,:),bdy_times(:,:)
integer start_year ,&
start_month ,&
start_day ,&
start_hour ,&
start_minute ,&
start_second ,&
end_year ,&
end_month ,&
end_day ,&
end_hour ,&
end_minute ,&
end_second ,&
spec_zone ,&
relax_zone
real,allocatable:: z(:,:,:) ,&
u(:,:,:) ,&
v(:,:,:) ,&
ua(:,:) ,&
ub(:,:) ,&
uc(:,:) ,&
va(:,:) ,&
vb(:,:) ,&
vc(:,:) ,&
za(:,:) ,&
zb(:,:) ,&
zc(:,:) ,&
mapfac_m(:,:) ,&
mapfac_c(:,:) ,&
mapfac_u(:,:) ,&
mapfac_v(:,:) ,&
f_m(:,:) ,&
f_c(:,:) ,&
f_u(:,:) ,&
f_v(:,:) ,&
XTIME(:) ,&
XLAT_M(:,:) ,&
XLONG_M(:,:) ,&
XLAT_C(:,:) ,&
XLONG_C(:,:) ,&
XLAT_U(:,:) ,&
XLONG_U(:,:) ,&
XLAT_V(:,:) ,&
XLONG_V(:,:) ,&
Z_BYS(:,:,:) ,&
Z_BYE(:,:,:) ,&
Z_BXS(:,:,:) ,&
Z_BXE(:,:,:) ,&
U_BYS(:,:,:) ,&
U_BYE(:,:,:) ,&
U_BXS(:,:,:) ,&
U_BXE(:,:,:) ,&
V_BYS(:,:,:) ,&
V_BYE(:,:,:) ,&
V_BXS(:,:,:) ,&
V_BXE(:,:,:) ,&
Z_BTYS(:,:,:) ,&
Z_BTYE(:,:,:) ,&
Z_BTXS(:,:,:) ,&
Z_BTXE(:,:,:) ,&
U_BTYS(:,:,:) ,&
U_BTYE(:,:,:) ,&
U_BTXS(:,:,:) ,&
U_BTXE(:,:,:) ,&
V_BTYS(:,:,:) ,&
V_BTYE(:,:,:) ,&
V_BTXS(:,:,:) ,&
V_BTXE(:,:,:) ,&
F1(:) ,&
F2(:) ,&
K(:)
endtype
type(domain):: grid
!Boundary
real:: filling_value=-999999999.99d0
!Timer
real :: time_divide_value
contains
subroutine da_get_unit(unit)
implicit none
integer, intent(out) :: unit
integer :: i
unit = -1
do i = unit_start, unit_end
if (.NOT. unit_used(i)) then
unit=i
unit_used(i) = .true.
exit
end if
end do
if (unit == -1) then
write(*,*)"No free units"
end if
end subroutine da_get_unit
subroutine read_namelist
implicit none
integer unit
call da_get_unit(unit)
open(unit,file='namelist.input',status='old')
read(unit,nml=system_setting)
read(unit,nml=time_control)
read(unit,nml=files)
read(unit,nml=domains)
read(unit,nml=dynamics)
close(unit)
end subroutine read_namelist
subroutine choose_slash
!This subroutine must be used after using read_namelist
implicit none
if(trim(adjustl(system_type))=='Windows'.or.trim(adjustl(system_type))=='windows')then
slash='\'
time_divide_value=10000.
elseif(trim(adjustl(system_type))=='Linux'.or.trim(adjustl(system_type))=='linux')then
slash='/'
time_divide_value=1000.
endif
end subroutine choose_slash
end module control