-
Notifications
You must be signed in to change notification settings - Fork 1
/
Flood_Irrig.FOR
275 lines (234 loc) · 8.56 KB
/
Flood_Irrig.FOR
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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
C=======================================================================
C FLOOD_IRRIG, Subroutine
C
C Determines irrigation - works with paddy flooding
C-----------------------------------------------------------------------
C Revision history
C
C 1. Written
C 2. Header revision and minor changes P.W.W. 8-7-93
C 05/29/2002 CHP Rewrote for modular CSM model
C 09/05/2003 CHP Added option for reported irrigation in DAP
! 01/22/2010 CHP remove water table management from here - not just
! for flooded fields.
C=======================================================================
SUBROUTINE FLOOD_IRRIG (DYNAMIC,
& BUND, COND, CONDAT, IBDAT, IIRRCV, IIRRI, !Input
& IPDAT, IPERC, NBUND, NCOND, NPERC, !Input
& PUDDLED, RAIN, SOILPROP, SW, YRDOY, YRPLT, !Input
& FLOODWAT, !I/O
& DEPIR) !Output
USE ModuleDefs
USE FloodModule
IMPLICIT NONE
SAVE
CHARACTER*1 IIRRI
INTEGER DYNAMIC, J, YRDOY, YRPLT
REAL DEPIR,TDSW,RAIN
INTEGER INCDAT, NBUND, NCOND, NLAYR, NPERC
INTEGER IBDAT(NAPPL), BUNDDAT(NAPPL), IIRRCV(NAPPL)
INTEGER CONDAT(NAPPL), IRRDAT(NAPPL)
INTEGER IPDAT(NAPPL), PERCDAT(NAPPL)
REAL ABUND, APWAT, EF
REAL FLOOD, INFILT, PERC, PERMW, PUDPERC
REAL BUND(NAPPL), COND(NAPPL), IPERC(NAPPL)
REAL, DIMENSION(NL) :: DLAYR, SAT, SW
LOGICAL BUNDED, PUDDLED, CONVERTED !, PERMF
TYPE (FloodWatType) FLOODWAT
TYPE (SOILTYPE) SOILPROP
SAT = SOILPROP % SAT
DLAYR = SOILPROP % DLAYR
NLAYR = SOILPROP % NLAYR
INFILT= FLOODWAT % INFILT
EF = FLOODWAT % EF
FLOOD = FLOODWAT % FLOOD
!***********************************************************************
!***********************************************************************
! Seasonal initialization - run once per season
!***********************************************************************
IF (DYNAMIC .EQ. SEASINIT) THEN
C-----------------------------------------------------------------------
BUNDED = .FALSE.
APWAT = 0.0
ABUND = 0.0
PERC = 0.0
PERMW = 0.0
PUDPERC = 0.0
CONVERTED = .FALSE.
!***********************************************************************
!***********************************************************************
! DAILY RATE CALCULATIONS
!***********************************************************************
ELSEIF (DYNAMIC .EQ. RATE) THEN
C-----------------------------------------------------------------------
! If irrigation events are reported as DAP, convert to YYYYDDD
! Only need to do once after YRPLT has been set.
IF (.NOT. CONVERTED) THEN
IF (YRPLT .GT. 0 .AND. YRPLT .LT. 9999999) THEN
!Convert percolation dates
DO J = 1, NPERC
IF (IIRRI .EQ. 'D') THEN
PERCDAT(J) = INCDAT(YRPLT,IPDAT(J))
ELSE
PERCDAT(J) = IPDAT(J)
ENDIF
ENDDO
!Convert bund height dates
DO J = 1, NBUND
IF (IIRRI .EQ. 'D') THEN
BUNDDAT(J) = INCDAT(YRPLT, IBDAT(J))
ELSE
BUNDDAT(J) = IBDAT(J)
ENDIF
ENDDO
!Convert irrigation dates
DO J = 1, NCOND
IF (IIRRI .EQ. 'D') THEN
IRRDAT(J) = INCDAT(YRPLT, CONDAT(J))
ELSE
IRRDAT(J) = CONDAT(J)
ENDIF
ENDDO
! !Convert water table dates
! DO K = 1, NTBL
! IF (IIRRI .EQ. 'D') THEN
! WTDAT(J) = INCDAT(YRPLT, JULWTB(K))
! ELSE
! WTDAT(J) = JULWTB(K)
! ENDIF
! ENDDO
CONVERTED = .TRUE.
ENDIF
ENDIF
!Get daily percolation rate
DO J = 1, NPERC
IF (YRDOY .EQ. PERCDAT(J)) THEN
PERC = IPERC(J)
ENDIF
END DO
IF (FLOOD .GT. 0.0) THEN
PUDPERC = PERC*10.0
IF (FLOOD .LT. PUDPERC) THEN
PUDPERC = FLOOD
ENDIF
ELSE
PUDPERC = 0.0
ENDIF
! Identify the irrigation code (IIRR) & bund height (ABUND)
DO J = 1, NBUND
IF (YRDOY .EQ. BUNDDAT(J)) THEN
PERMW = 0.0
ABUND = BUND(J)
IF (ABUND .GT. 0.0) THEN
BUNDED = .TRUE.
ELSE
BUNDED = .FALSE.
ENDIF
ENDIF
END DO
IF (NCOND .GT. 0) THEN
! Identify irrigation events for today
DO J = 1, NCOND
IF (YRDOY .EQ. IRRDAT(J)) THEN
PERMW = 0.0
!--------------------------------------------------
SELECT CASE (IIRRCV(J))
!--------------------------------------------------
CASE (6)
!Single irrigation to specified flood depth (mm)
!COND(J) represents final flood depth at end of day
CALL SW_DEF(DLAYR, NLAYR, SW, SAT, TDSW)
DEPIR = COND(J) + TDSW - FLOOD - RAIN
!Add drainage
IF (PUDDLED) THEN
DEPIR = DEPIR + PUDPERC !today's
ELSE
DEPIR = DEPIR + INFILT !yesterday's
ENDIF
!Add in yesterday's values of flood evaporation
DEPIR = DEPIR + EF
!--------------------------------------------------
CASE (1:5)
! Field schedule for irrigation
DEPIR = COND(J)
!--------------------------------------------------
CASE (11)
!Irrigation to permanent or constant flood depth
IF (COND(J) .GT. 0.0) THEN
!Set permanent flood depth to COND(J)
PERMW = COND(J)
ELSE
PERMW = 0.0
ENDIF
END SELECT
!--------------------------------------------------
ENDIF
END DO
ENDIF
! Every day check for permanent water level
IF (PERMW. GT. 0.0) THEN
CALL SW_DEF(DLAYR, NLAYR, SW, SAT, TDSW)
DEPIR = PERMW + TDSW - FLOOD - RAIN
!Add drainage
IF (PUDDLED) THEN
DEPIR = DEPIR + PUDPERC !today's
ELSE
DEPIR = DEPIR + INFILT !yesterday's
ENDIF
!Add in yesterday's values of flood evaporation
DEPIR = DEPIR + EF
END IF
! 1/23/2010 CHP move water table entries to IRRIG
! IF (NTBL .GT. 0) THEN
! DO K = 1, NTBL
! IF (YRDOY .EQ. WTDAT(J)) THEN
! APWAT = PWAT(K)
! ENDIF
! END DO
!
!! Don't change SW here - calculate an irrigation depth to add.
! IF (APWAT .GT. 0.0) THEN
! CUMDEP = 0.0
! DO L = 1, NLAYR
! IF (CUMDEP .GE. APWAT) THEN
! DEPIR = DEPIR + SAT(L) - SW(L) !CHP - CHECK!
!! SW(L) = SAT(L)
! ENDIF
! CUMDEP = CUMDEP + DLAYR(L)
! END DO
! ENDIF
! ENDIF
DEPIR = MAX(0.0, DEPIR)
!***********************************************************************
ENDIF
!***********************************************************************
!***********************************************************************
! END OF DYNAMIC IF CONSTRUCT
!***********************************************************************
FLOODWAT % BUNDED = BUNDED
FLOODWAT % ABUND = ABUND !mm
FLOODWAT % PUDPERC = PUDPERC
FLOODWAT % PERC = PERC
RETURN
END SUBROUTINE FLOOD_IRRIG
C=======================================================================
C SW_DEF, Subroutine
C
C Calculates soil water deficit.
C-----------------------------------------------------------------------
C Revision history
C 04/18/2002 CHP Written.
C=======================================================================
SUBROUTINE SW_DEF(DLAYR, NLAYR, SW, SAT, TDSW)
Use ModuleDefs
Implicit None
INTEGER L, NLAYR
REAL TDSW
REAL, DIMENSION(NL) :: DLAYR, SAT, SW
TDSW = 0.0
DO L = 1, NLAYR
TDSW = TDSW + (SAT(L) - SW(L)) * DLAYR(L) * 10. !(in mm)
END DO
RETURN
END SUBROUTINE SW_DEF
C=======================================================================