-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDrip_Irrig.FOR
228 lines (189 loc) · 8.25 KB
/
Drip_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
!=======================================================================
! Drip_IRRIG, Subroutine
!
! Determines drip irrigation - works with MGAR water balance routine
!-----------------------------------------------------------------------
! Revision history
!
! 09/04/2008 CHP Written
! 07/27/2010 CHP Drip irrigation emitter can be offset from centerline.
! 03/30/2011 CHP Add Automatic Management for IIRRI
!=======================================================================
SUBROUTINE Drip_IRRIG (CONTROL,
& AUTO, IRRAPL,
& DripDat, DripDur, DripInt, DripNum, DripOfset, !Input
& DripRate, DripSpc, DripStart, EFFIRR, IIRRI, !Input
& MEHYD, NDRIP, YRDOY, YRPLT, !Input
& DEPIR) !Output
USE ModuleDefs
USE ModuleData
IMPLICIT NONE
SAVE
CHARACTER*1 IIRRI, MEHYD
CHARACTER*7, PARAMETER :: ERRKEY = 'DRIPIRR'
INTEGER DAP, DYNAMIC, I
INTEGER NDRIP, TIMDIF, YRDOY, YRPLT
INTEGER, DIMENSION(NAPPL) :: DripDat, DripNum
REAL DEPIR, DripSpc, DripOfset, EFFIRR, IrrRate, ROWSPC_CM, SPD
REAL, DIMENSION(NAPPL) :: DripInt, DripRate, DripDur, DripStart
REAL IRRAPL
CHARACTER*6 SECTION
INTEGER ERR, FOUND, LINC, LNUM, LUNIO
LOGICAL AUTO
TYPE (DripIrrType) DripIrrig
TYPE (ControlType) CONTROL
DYNAMIC = CONTROL % DYNAMIC
!***********************************************************************
!***********************************************************************
! Seasonal initialization - run once per season
!***********************************************************************
IF (DYNAMIC .EQ. RUNINIT .OR. DYNAMIC .EQ. SEASINIT) THEN
C-----------------------------------------------------------------------
DripIrrig % DripRate = 0.0
DripIrrig % DripNum = 0
DripIrrig % DripStart = 0.0
DripIrrig % DripDur = 0.0
DripIrrig % DripInt = 0.0
DripIrrig % DripSpc = DripSpc
DripIrrig % NDrip = NDrip
DripIrrig % DripOfset = DripOfset
CALL PUT(DripIrrig)
IrrRate = 0.0
DEPIR = 0.0
IF (INDEX('GC',MEHYD) < 1 .OR. NDRIP < 1) RETURN
!-----------------------------------------------------------------------
! Get row spacing from FILEIO
LUNIO = CONTROL % LUNIO
OPEN (LUNIO, FILE = CONTROL%FILEIO,STATUS = 'OLD',IOSTAT=ERR)
IF (ERR .NE. 0) CALL ERROR(ERRKEY,ERR,CONTROL%FILEIO,0)
LNUM = 0
SECTION = '*PLANT'
CALL FIND(LUNIO, SECTION, LINC, FOUND) ; LNUM = LNUM + LINC
IF (FOUND == 0) THEN
CALL ERROR(SECTION, 42, CONTROL%FILEIO, LNUM)
ELSE
READ(LUNIO,'(42X,F6.0,12X,F6.0)',IOSTAT=ERR)ROWSPC_CM
LNUM = LNUM + 1
IF (ERR .NE. 0) CALL ERROR(ERRKEY,ERR,CONTROL%FILEIO,LNUM)
ENDIF
!***********************************************************************
!***********************************************************************
! DAILY RATE CALCULATIONS
!***********************************************************************
ELSEIF (DYNAMIC .EQ. RATE) THEN
DAP = MAX(0,TIMDIF(YRPLT,YRDOY))
IF (AUTO) THEN
DripIrrig % DripRate = DripRate(NDRIP) * EFFIRR
DripIrrig % DripStart = DripStart(NDRIP)
DripIrrig % DripInt = DripInt(NDRIP)
IF (IRRAPL > 1.E-6) THEN
! Calculate drip duration based on known quantity and drip rate
DripIrrig % DripDur =
& IRRAPL / DripRate(NDRIP) * DripSpc * ROWSPC_CM / 10. / 3600.
! hr mm/d cm/emitter * cm
! -- = ------------- * ---------------
! d cm3/s-emitter mm/cm * s/hr
IrrRate = IRRAPL
DripIrrig % IrrRate = IRRAPL
DripIrrig % DripNum = 1
ELSE
DripIrrig % IrrRate = 0.0
DripIrrig % DripNum = 0
DripIrrig % DripDur = 0.0
IrrRate = 0.0
ENDIF
ELSE
!-----------------------------------------------------------------------
!** IIRRI = R - As Reported in FIELD SCHEDULE. If day of irrigation then.
!** IIRRI = D - As Reported in FIELD SCHEDULE, days after planting
!** IIRRI = P - As Reported through last reported day (YYYYDDD), then automatic
! to re-fill profile (as in option A)
!** IIRRI = W - As Reported through last reported day (YYYYDDD), then automatic
! adding AIRAMT each time
!-----------------------------------------------------------------------
DO I = 1, NDRIP
IF ((INDEX('RPW',IIRRI) > 0 .AND. DripDat(I) .EQ. YRDOY) .OR.
& (INDEX('D',IIRRI) > 0 .AND. DripDat(I) .EQ. DAP)) THEN
! New drip irrigation schedule today
DripIrrig % DripRate = DripRate(I) * EFFIRR
DripIrrig % DripNum = DripNum(I)
DripIrrig % DripStart = DripStart(I)
DripIrrig % DripDur = DripDur(I)
DripIrrig % DripInt = DripInt(I)
SPD = DripNum(I) * DripDur(I) * 3600.
! s/d = #/day * hr * s/hr
IrrRate = DripRate(I) / (DripSpc * ROWSPC_CM) * 10. * SPD
! cm3/s emitter mm s
! mm/d = ------- / ------- * -- * -
! emitter cm * cm cm d
DripIrrig % IrrRate = IrrRate
EXIT
ENDIF
ENDDO
ENDIF
! Drip irrigation schedule maintained until new schedule specified
DEPIR = MAX(0.0, IrrRate)
!***********************************************************************
ENDIF
!***********************************************************************
!***********************************************************************
! END OF DYNAMIC IF CONSTRUCT
!***********************************************************************
CALL PUT(DripIrrig)
RETURN
END SUBROUTINE Drip_IRRIG
!=======================================================================
C=======================================================================
C SWDEFICIT_bed, Subroutine
C Determines soil water deficit for automatic irrigation requirments
! for bedded system
C-----------------------------------------------------------------------
SUBROUTINE SWDEFICIT_bed(
& DSOIL, DLAYR, DUL, LL, NLAYR, SW, !Input
& ATHETA, SWDEF) !Output
USE ModuleDefs
USE Cells_2D
IMPLICIT NONE
INTENT(IN) DSOIL, DLAYR, DUL, LL, NLAYR, SW
INTENT(OUT) ATHETA, SWDEF
INTEGER L, NLAYR
REAL, DIMENSION(NL) :: DLAYR, DUL, LL, SW
REAL ATHETA, DEPMAX, DSOIL, SWDEF, TSWTOP, WET1, XDEP, XDEPL
REAL MULT, MULT_bed
IF (BedDimension % RaisedBed) THEN
! If raised bed, then volume of water deficit is smaller due to
! presence of furrow.
MULT_bed = BedDimension % BEDWD / BedDimension % ROWSPC_cm
WET1 = 0.0
DEPMAX = 0.0
TSWTOP = 0.0
DEPMAX = 0.0
DO L = 1,NLAYR
IF (DEPMAX .LT. DSOIL) THEN
XDEPL = DEPMAX
DEPMAX = DEPMAX + DLAYR(L)
IF (DEPMAX .GT. DSOIL) THEN
XDEP = (DSOIL - XDEPL)
ELSE
XDEP = DLAYR(L)
ENDIF
IF (L < BedDimension % FurRow1) THEN
MULT = MULT_bed
ELSE
MULT = 1.0
ENDIF
WET1 = WET1 + (DUL(L) - LL(L)) * XDEP * MULT
TSWTOP = TSWTOP + (SW(L) - LL(L)) * XDEP * MULT
ENDIF
ENDDO
ATHETA = TSWTOP / WET1
SWDEF = MAX(0.0,(WET1 - TSWTOP))
ELSE
! If no raised bed, just call the original routine.
CALL SWDEFICIT(
& DSOIL, DLAYR, DUL, LL, NLAYR, SW, !Input
& ATHETA, SWDEF) !Output
ENDIF
RETURN
END SUBROUTINE SWDEFICIT_bed
C=======================================================================