-
Notifications
You must be signed in to change notification settings - Fork 1
/
FLOODI.FOR
131 lines (106 loc) · 4.09 KB
/
FLOODI.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
C=======================================================================
C FLOODI, Subroutine, U. Singh
C Determines floodwater initialization - called first day of new
C flood event.
C-----------------------------------------------------------------------
C REVISION HISTORY
C US Written
C 03/29/2002 CHP modular format
C=======================================================================
SUBROUTINE FLOODI (
& BD1, FLOODWAT, OXMIN3, OXMIN4, SNH4, !Input
& SNO3, SOILPROP, SW1, UREA, YRDOY, YRDRY, !Input
& DailyCalc, DLTUREA, DLTSNH4, DLTSNO3, DLTFUREA,!I/O
& DLTFNO3, DLTFNH4, IBP, !I/O
& ALGACT, AKILL, ALGFIX, DLTOXU, DLTOXH4, DLTOXN3,!Output
& FNI, IMMOBIL, OXLT) !Output
!-----------------------------------------------------------------------
USE ModuleDefs
USE FloodModule
IMPLICIT NONE
SAVE
REAL BD1, FAC1
REAL FLOOD, SW1
REAL ALGACT
REAL FNI, PERC
REAL OXFAC, OXLT, OXMIN3, OXMIN4
REAL ALGFIX
INTEGER IHDAY, IBP
INTEGER YRDOY, YRDRY
LOGICAL AKILL, DailyCalc, IMMOBIL
REAL, DIMENSION(NL) :: DLAYR, OC, SNH4, SNO3, UREA
REAL FOCI, SURCEC
REAL TMPFUREA, TMPFNO3, TMPFNH4
REAL DLTUREA(NL), DLTSNO3(NL), DLTSNH4(NL)
REAL DLTFUREA, DLTFNO3, DLTFNH4
REAL TMPUREA, TMPNO3, TMPNH4
REAL TMPOXU, TMPOXH4, TMPOXN3
REAL DLTOXU, DLTOXH4, DLTOXN3
TYPE (SoilType) SOILPROP
TYPE (FloodWatType) FLOODWAT
SURCEC= SOILPROP % CEC(1)
DLAYR = SOILPROP % DLAYR
OC = SOILPROP % OC
PERC = FLOODWAT % PERC
FLOOD = FLOODWAT % FLOOD
!-----------------------------------------------------------------------
FAC1 = 1.0 / (BD1 * 1.E-01 * DLAYR(1))
OXLT = 0.078+(0.94*PERC)-0.03*OC(1)-0.14*PERC*OC(1)
IF (OXLT .LE. 0.0) THEN
OXLT = 0.01
ENDIF
OXFAC = 1.0/(BD1*OXLT*1.0E-01)
IMMOBIL = .FALSE.
AKILL = .FALSE.
ALGFIX = 0.0
! Defaults to daily output
DailyCalc = .TRUE.
! Initialize Algal Activity
FOCI = OC(1) / 3.0
FOCI = AMIN1 (FOCI, 1.0)
ALGACT = AMIN1 (0.2, FOCI)
FNI = 0.1
! Initial Buffer Power
IBP = 0
! Flood variables (kg/ha)
TMPFUREA = DLTFUREA
TMPFNO3 = DLTFNO3
TMPFNH4 = DLTFNH4
! Layer 1 variables (kg/ha)
TMPUREA = UREA(1) + DLTUREA(1)
TMPNO3 = SNO3(1) + DLTSNO3(1)
TMPNH4 = SNH4(1) + DLTSNH4(1)
! Oxidation layer variables (kg/ha)
! check this - don't these have a value under dry conditions? CHP
TMPOXU = TMPUREA * FAC1 / OXFAC
TMPOXH4 = TMPNO3 * FAC1 / OXFAC
TMPOXN3 = TMPNH4 * FAC1 / OXFAC
IF (DailyCalc) THEN
IHDAY = 1
ELSE
IHDAY = 12
ENDIF
CALL EQUIL2 (
& BD1, SURCEC, DLAYR, FLOOD, IHDAY, 1, !Input
& OXLT, OXMIN3, OXMIN4, SW1, YRDOY, YRDRY, !Input
& IBP, TMPFUREA, TMPOXU, TMPUREA) !I/O
CALL EQUIL2 (
& BD1, SURCEC, DLAYR, FLOOD, IHDAY, 2, !Input
& OXLT, OXMIN3, OXMIN4, SW1, YRDOY, YRDRY, !Input
& IBP, TMPFNO3, TMPOXN3, TMPNO3) !I/O
CALL EQUIL2 (
& BD1, SURCEC, DLAYR, FLOOD, IHDAY, 3, !Input
& OXLT, OXMIN3, OXMIN4, SW1, YRDOY, YRDRY, !Input
& IBP, TMPFNH4, TMPOXH4, TMPNH4) !I/O
! Changes to urea, NO3 and NH4 due to flood initialization processes
DLTUREA(1) = MAX(0.0, TMPUREA) - UREA(1)
DLTSNO3(1) = MAX(0.0, TMPNO3) - SNO3(1)
DLTSNH4(1) = MAX(0.0, TMPNH4) - SNH4(1)
DLTFUREA = MAX(0.0, TMPFUREA)
DLTFNO3 = MAX(0.0, TMPFNO3)
DLTFNH4 = MAX(0.0, TMPFNH4)
DLTOXU = MAX(0.0, TMPOXU)
DLTOXH4 = MAX(0.0, TMPOXH4)
DLTOXN3 = MAX(0.0, TMPOXN3)
RETURN
END SUBROUTINE FLOODI