forked from MESH-Team/MESH_CNT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
arrays_module.f90
222 lines (159 loc) · 8.68 KB
/
arrays_module.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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
module arrays_module
implicit none
save
real, allocatable :: area(:), bo(:,:) !, y(:, :), q(:, :)
!real, allocatable :: areap(:), qp(:), z(:), dqp(:)
real, allocatable :: av11(:), av12(:), av21(:), av22(:)
real, allocatable :: ci1(:), ci2(:)!, dqc(:), dap(:), dac(:)
real, allocatable :: aso(:,:), f1(:), f2(:), depth(:)
real, allocatable :: g11inv(:), g12inv(:), g21inv(:), g22inv(:)
real, allocatable :: b11(:), b12(:), b21(:), b22(:)
real, allocatable :: eps2(:), eps4(:), d1(:), d2(:), u(:), c(:)
real, allocatable :: co(:), gso(:,:), dbdx(:,:)!,sk(:)
real, allocatable :: dx(:,:), froud(:), courant(:)
real, allocatable :: dt(:)
!**arrays for branching channel application
integer, allocatable :: ndep(:), uslinks(:,:), dslink(:), instrdflag(:,:), nx1(:)
!real, allocatable :: y(:, :, :), q(:, :, :), qlat(:,:,:), bo(:, :), traps(:,:) !,area(:,:), areafnal(:,:,:),
real, allocatable :: areap(:, :), qp(:, :, :), z(:, :), sk(:, :) ! change 20210628
real, allocatable :: dqp(:,:), dap(:,:), dqc(:,:), dac(:,:)
real, allocatable :: celerity(:,:),velocity(:,:), diffusivity(:,:), diffusivity2(:), celerity2(:)
real, allocatable :: eei(:), ffi(:), exi(:), fxi(:), qpx(:,:), qcx(:)
real, allocatable :: USBoundary(:,:,:), DSBoundary(:,:,:)
integer, allocatable :: upBoundTableEntry(:), downBoundTableEntry(:) !, normalDepth(:,:)
! change for unsteady flow
real, allocatable :: pere(:,:),dpda(:)
real, allocatable :: oldQ(:,:), newQ(:,:,:), oldArea(:,:), newArea(:,:), oldY(:,:), newY(:,:), normalDepthAtNodes(:,:) ! change 20210628
real, allocatable :: added_Q(:,:,:) ! change 20210713
integer, allocatable :: ityp(:), latFlowLocations(:,:), dataInEachLatFlow(:,:), latFlowType(:,:), latFlowXsecs(:,:)
real, allocatable :: lateralFlowTable(:,:,:,:), lateralFlow(:,:,:)
! for additional lateral flow of the structures
integer, allocatable :: latFlowLocations2(:,:), dataInEachLatFlow2(:,:), latFlowType2(:,:), latFlowXsecs2(:,:), noLatFlow2(:)
real, allocatable :: lateralFlowTable2(:,:,:,:), lateralFlow2(:,:)
real, allocatable :: dimensionless_Cr(:,:), dimensionless_Fo(:,:), dimensionless_Fi(:,:)
real, allocatable :: dimensionless_Di(:,:), dimensionless_Fc(:,:), dimensionless_D(:,:)
real, allocatable :: ini_y(:), ini_q(:)
real, allocatable :: ini_q_repeat(:,:), ini_E(:,:), ini_F(:,:)
integer, allocatable :: Q_sk_tableEntry(:,:), noLatFlow(:), noQSKtable(:)
real, allocatable :: eachQSKtableNodeRange(:,:,:), Q_sk_Table(:,:,:,:)
real, allocatable :: lowerLimitCount(:), higherLimitCount(:), volRemain(:,:)
character(len=128), allocatable :: downstream_path(:), xSection_path(:), manning_strickler_path(:), upstream_path(:),dx_path(:)
character(len=128), allocatable :: QSKtablePath(:), lateralFlow_path(:), lateralFlow_path2(:)
character(len=128), allocatable :: bankLocation_path(:)
real, allocatable :: leftBank(:,:), rightBank(:,:), skLeft(:,:), skMain(:,:), skRight(:,:)
integer, allocatable :: currentROutingDiffusive(:), notSwitchRouting(:)
real :: minDx, maxCelerity,maxCelDx
integer, allocatable :: currentRoutingNormal(:,:), routingNotChanged(:,:)
contains
! Allocate storage for all of the arrays in this module based on the number
! of time steps and spatial points
subroutine setup_arrays(num_time, num_points, maxTableEntry1, maxTableEntry2, totalLatFlow, totalQSKtable, totalChannels)
implicit none
! Input
integer, intent(in) :: num_time, num_points, maxTableEntry1, maxTableEntry2, totalLatFlow, totalQSKtable, totalChannels
allocate(area(num_points))
! change for unsteady flow
allocate(bo(num_points,totalChannels))
allocate(pere(num_points,totalChannels))
allocate(dpda(num_points))
!allocate(normalDepth(totalChannels)) !! this parameter indicates which channel will have full diffusive or partial diffusive routing.
allocate(normalDepthAtNodes(num_points,totalChannels))
normalDepthAtNodes = 0.
allocate(areap(num_points,totalChannels))
allocate(qp(num_points,num_time,totalChannels))
allocate(ini_q_repeat(num_points,totalChannels))
allocate(ini_E(num_points,totalChannels))
allocate(ini_F(num_points,totalChannels))
allocate(z(num_points,totalChannels))
z=0. ! initialization
allocate(av11(num_points))
allocate(av12(num_points))
allocate(av21(num_points))
allocate(av22(num_points))
allocate(dqp(num_points,totalChannels))
allocate(dqc(num_points,totalChannels))
allocate(dap(num_points,totalChannels))
allocate(dac(num_points,totalChannels))
allocate(ci1(num_points))
allocate(ci2(num_points))
allocate(aso(num_points,totalChannels))
aso = 0.
allocate(depth(num_points))
allocate(f1(num_points))
allocate(f2(num_points))
allocate(g11inv(num_points))
allocate(g12inv(num_points))
allocate(g21inv(num_points))
allocate(g22inv(num_points))
allocate(b11(num_points))
allocate(b12(num_points))
allocate(b21(num_points))
allocate(b22(num_points))
allocate(eps2(num_points))
allocate(eps4(num_points))
allocate(d1(num_points))
allocate(d2(num_points))
allocate(u(num_points))
allocate(c(num_points))
allocate(sk(num_points,totalChannels))
allocate(leftBank(num_points,totalChannels))
allocate(rightBank(num_points,totalChannels))
allocate(skLeft(num_points,totalChannels))
allocate(skMain(num_points,totalChannels))
allocate(skRight(num_points,totalChannels))
allocate(co(num_points))
allocate(gso(num_points,totalChannels))
gso = 0.
allocate(dbdx(num_points,totalChannels))
dbdx = 0.
allocate(dt(num_points))
allocate(ityp(num_points))
allocate(dx(num_points-1,totalChannels))
allocate(volRemain(num_points-1,totalChannels))
allocate(froud(num_points))
allocate(Q_sk_Table(2, maxTableEntry1, totalQSKtable,totalChannels))
allocate(Q_sk_tableEntry(totalQSKtable,totalChannels))
allocate(USBoundary(2, maxTableEntry2,totalChannels))
allocate(DSBoundary(2, maxTableEntry2,totalChannels))
allocate(ndep(totalChannels))
allocate(dslink(totalChannels))
!allocate(uslinks(num_points,totalChannels))
allocate(instrdflag(totalChannels,2))
allocate(courant(num_points-1))
allocate(oldQ(num_points, totalChannels))
allocate(newQ(num_points, num_time, totalChannels)) ! change 20210628
allocate(added_Q(num_points, num_time, totalChannels)) ! change 20210713
allocate(oldArea(num_points, totalChannels))
allocate(newArea(num_points, totalChannels))
allocate(oldY(num_points, totalChannels))
allocate(newY(num_points, totalChannels))
oldQ = -999; oldY = -999; newQ = -999; newY = -999
allocate(lateralFlowTable(2, maxTableEntry2, totalLatFlow, totalChannels))
allocate(dataInEachLatFlow(totalLatFlow, totalChannels))
!allocate(lateralFlow(num_points, totalChannels)) ! change 20210311
allocate(lateralFlow(num_points, num_time, totalChannels)) ! change 20210707
allocate(celerity(num_points, totalChannels))
allocate(velocity(num_points, totalChannels))
allocate(diffusivity(num_points, totalChannels))
allocate(celerity2(num_points))
allocate(diffusivity2(num_points))
allocate(eei(num_points))
allocate(ffi(num_points))
allocate(exi(num_points))
allocate(fxi(num_points))
allocate(qpx(num_points, totalChannels))
allocate(qcx(num_points))
allocate(dimensionless_Cr(num_points-1,totalChannels))
allocate(dimensionless_Fo(num_points-1,totalChannels))
allocate(dimensionless_Fi(num_points-1,totalChannels))
allocate(dimensionless_Di(num_points-1,totalChannels))
allocate(dimensionless_Fc(num_points-1,totalChannels))
allocate(dimensionless_D(num_points-1,totalChannels))
dimensionless_Cr = -999; dimensionless_Fo = -999; dimensionless_Fi = -999
dimensionless_Di = -999; dimensionless_Fc = -999; dimensionless_D = -999
allocate(lowerLimitCount(totalChannels))
allocate(higherLimitCount(totalChannels))
allocate(currentRoutingNormal(num_points-1,totalChannels))
allocate(routingNotChanged(num_points-1,totalChannels))
end subroutine setup_arrays
end module arrays_module