1 MODULE module_irrigation
4 SUBROUTINE irrigation_on(julian_in,irr_start_julianday,irr_end_julianday,irr_on,xtime,gmt,irr_start_hour,end_hour)
6 REAL, INTENT(IN) :: julian_in, xtime, gmt
7 INTEGER, INTENT(IN) :: irr_start_julianday, irr_end_julianday, irr_start_hour, end_hour
8 INTEGER :: irr_on_time, irr_on_day, tloc, xt24
9 INTEGER, INTENT(OUT):: irr_on
16 tloc=floor(gmt+xt24/60.)
17 if(tloc.lt.0) tloc=tloc+24
19 IF(irr_start_julianday .lt. irr_end_julianday) THEN
20 IF((julian_in.GE.irr_start_julianday .AND. julian_in.LT.irr_end_julianday)) THEN
24 IF(.NOT. (julian_in.GE.irr_start_julianday .AND. julian_in.LT.irr_end_julianday)) THEN
29 IF(irr_start_hour .lt. end_hour) THEN
30 IF((tloc.GE.irr_start_hour .AND. tloc.LT.end_hour)) THEN
34 IF(.NOT. (tloc.GE.irr_start_hour .AND. tloc.LT.end_hour)) THEN
38 IF (irr_on_time.EQ.1 .and. irr_on_day.EQ.1) irr_on = 1
41 END SUBROUTINE irrigation_on
43 SUBROUTINE irr_calc_phase(irr_ph,phase,irr_rand_field_val,i,j,IRRIGATION,irr_freq)
45 INTEGER :: irr_ph,irr_freq
46 REAL, INTENT(OUT) :: phase
47 REAL, OPTIONAL:: IRRIGATION
48 INTEGER, OPTIONAL :: i,j
50 INTEGER, INTENT(INOUT) :: irr_rand_field_val
51 IF(irr_ph .EQ. 1)phase=modulo(int(i*j*IRRIGATION),irr_freq)
52 IF(irr_ph .EQ. 0)phase=0
53 IF(irr_ph .EQ. 2)phase=irr_rand_field_val
55 END SUBROUTINE irr_calc_phase
58 SUBROUTINE drip_irrigation( julian_in &
59 & ,irrigation,sf_surf_irr_scheme, irr_daily_amount &
60 & ,irr_start_hour,irr_num_hours,irr_start_julianday &
61 & ,irr_end_julianday,irr_freq,irr_ph &
62 & ,i,j,RAINBL,IRRIGATION_CHANNEL,gmt,xtime,dt,irr_rand_field_val )
66 INTEGER :: j,i,tloc, jmonth,timing,end_hour,irr_day, sf_surf_irr_scheme,irr_start_hour,irr_num_hours,irr_start_julianday,irr_end_julianday,irr_freq,irr_ph,irr_on
67 REAL :: constants_irrigation,phase
68 REAL, INTENT(INOUT) :: IRRIGATION_CHANNEL
69 REAL, INTENT(INOUT) :: RAINBL
70 REAL, INTENT(IN):: IRRIGATION
71 REAL:: irr_daily_amount
72 REAL, INTENT(IN) :: julian_in
73 INTEGER, INTENT(INOUT) :: irr_rand_field_val
75 IF(RAINBL.LE.0.01 .AND. IRRIGATION.GE.0.001) THEN
76 end_hour=irr_start_hour+irr_num_hours
77 if(end_hour.gt.23) end_hour=end_hour-24
78 constants_irrigation=irr_freq*irr_daily_amount*0.000277778*0.01/irr_num_hours ! hours in second:1/3600=0.000277778
80 timing=modulo((int(julian_in)-irr_start_julianday),irr_freq)
81 CALL irr_calc_phase(irr_ph,phase,irr_rand_field_val,i,j,IRRIGATION,irr_freq)
82 CALL irrigation_on(julian_in,irr_start_julianday,irr_end_julianday,irr_on,xtime,gmt,irr_start_hour,end_hour)
85 IF ( irr_on.EQ.1 .AND. timing.EQ.0. ) THEN
87 RAINBL =RAINBL +dt*IRRIGATION*constants_irrigation
90 IF(timing.EQ.int(phase)) THEN
91 RAINBL =RAINBL +dt*IRRIGATION*constants_irrigation
99 END SUBROUTINE drip_irrigation
103 SUBROUTINE channel_irrigation( julian_in & !ARI
104 & ,irrigation,sf_surf_irr_scheme, irr_daily_amount & !ARI
105 & ,irr_start_hour,irr_num_hours,irr_start_julianday & !ARI
106 & ,irr_end_julianday,irr_freq,irr_ph &
107 & ,i,j,RAINBL,IRRIGATION_CHANNEL,gmt,xtime,dt,irr_rand_field_val )
111 INTEGER :: j,i,tloc, jmonth,timing,end_hour, irr_on, irr_day, sf_surf_irr_scheme,irr_start_hour,irr_num_hours,irr_start_julianday,irr_end_julianday,irr_freq,irr_ph
112 REAL :: constants_irrigation,phase
113 REAL, INTENT(INOUT) :: IRRIGATION_CHANNEL
114 REAL, INTENT(INOUT) :: RAINBL
115 REAL, INTENT(IN):: IRRIGATION
116 REAL:: irr_daily_amount
117 REAL, INTENT(IN) :: julian_in
118 INTEGER, INTENT(INOUT) :: irr_rand_field_val
119 IRRIGATION_CHANNEL=0.
120 IF(RAINBL.LE.0.01 .AND. IRRIGATION.GE.0.001) THEN
121 end_hour=irr_start_hour+irr_num_hours
122 if(end_hour.gt.23) end_hour=end_hour-24
123 constants_irrigation=irr_freq*irr_daily_amount*0.000277778*0.01/irr_num_hours ! hours in second:1/3600=0.000277778
125 timing=modulo((int(julian_in)-irr_start_julianday),irr_freq)
126 CALL irr_calc_phase(irr_ph,phase,irr_rand_field_val,i,j,IRRIGATION,irr_freq)
127 CALL irrigation_on(julian_in,irr_start_julianday,irr_end_julianday,irr_on,xtime,gmt,irr_start_hour,end_hour)
128 IRRIGATION_CHANNEL=0.
129 IF ( irr_on.eq.1 .AND. timing.EQ.0. ) THEN
131 IRRIGATION_CHANNEL=dt*IRRIGATION*constants_irrigation
133 IF(timing.EQ.int(phase)) THEN
134 IRRIGATION_CHANNEL=dt*IRRIGATION*constants_irrigation
136 IRRIGATION_CHANNEL=0.
140 IRRIGATION_CHANNEL=0.
144 END SUBROUTINE channel_irrigation
147 SUBROUTINE sprinkler_irrigation( julian_in &
148 & ,irrigation, irr_daily_amount,rho,dz8w &
149 & ,irr_start_hour,irr_num_hours,irr_start_julianday,irr_end_julianday &
150 & ,irr_freq,irr_ph,qr_curr &
151 & ,gmt,xtime,dt,irr_rand_field_val &
152 & ,ids,ide, jds,jde & ! domain dims
153 & ,ims,ime, jms,jme, kms,kme & ! memory dims
154 & ,its,ite, jts,jte ) ! tile dims
158 INTEGER, INTENT(IN ) :: ids,ide, jds,jde, &
159 ims,ime, jms,jme, kms,kme, &
162 REAL, DIMENSION( ims:ime , jms:jme ), INTENT(IN),OPTIONAL:: irrigation !ARI
163 REAL, INTENT(IN):: irr_daily_amount, xtime, gmt, julian_in
164 INTEGER, INTENT(IN ),OPTIONAL:: irr_start_hour, irr_num_hours,irr_start_julianday,irr_freq,irr_ph,irr_end_julianday
165 INTEGER :: end_hour,a,b,irr_day,timing,irr_on
166 REAL :: constants_irrigation,tloc,irr_start,phase
167 INTEGER, DIMENSION( ims:ime , jms:jme ), INTENT(INOUT):: irr_rand_field_val
168 REAL, DIMENSION( ims:ime , kms:kme , jms:jme ), &
172 REAL, DIMENSION( ims:ime , kms:kme , jms:jme ), &
175 REAL, INTENT(IN ) :: dt
176 end_hour=irr_start_hour+irr_num_hours
177 if(end_hour.gt.23) end_hour=end_hour-24
178 CALL irrigation_on(julian_in,irr_start_julianday,irr_end_julianday,irr_on,xtime,gmt,irr_start_hour,end_hour)
181 timing=modulo((int(julian_in)),irr_freq)
185 constants_irrigation=irr_freq*irr_daily_amount/(irr_num_hours*3600*rho(a,kms,b)*dz8w(a,kms,b)*100)
186 IF (irrigation(a,b).GE.0.1 .AND. irr_on.eq.1 ) THEN
187 CALL irr_calc_phase(irr_ph,phase,irr_rand_field_val(a,b),a,b,irrigation(a,b),irr_freq)
189 qr_curr(a,kms,b)=qr_curr(a,kms,b)+irrigation(a,b)*constants_irrigation*dt
191 IF(timing.EQ.int(phase)) THEN
192 qr_curr(a,kms,b)=qr_curr(a,kms,b)+irrigation(a,b)*constants_irrigation*dt
201 END SUBROUTINE sprinkler_irrigation
202 END MODULE module_irrigation