1 | SUBROUTINE SFLUXV(DTAUV,TAUV,TAUCUMV,RSFV,DWNV,WBARV,COSBV, |
---|
2 | * UBAR0,STEL,NFLUXTOPV,FLUXTOPVDN, |
---|
3 | * NFLUXOUTV_nu,NFLUXGNDV_nu, |
---|
4 | * FMNETV,FLUXUPV,FLUXDNV,FZEROV,taugsurf) |
---|
5 | |
---|
6 | use radinc_h |
---|
7 | use radcommon_h, only: tlimit, gweight |
---|
8 | |
---|
9 | implicit none |
---|
10 | |
---|
11 | real*8 FMNETV(L_NLAYRAD) |
---|
12 | real*8 TAUCUMV(L_LEVELS,L_NSPECTV,L_NGAUSS) |
---|
13 | real*8 TAUV(L_NLEVRAD,L_NSPECTV,L_NGAUSS) |
---|
14 | real*8 DTAUV(L_NLAYRAD,L_NSPECTV,L_NGAUSS), DWNV(L_NSPECTV) |
---|
15 | real*8 FMUPV(L_NLAYRAD), FMDV(L_NLAYRAD) |
---|
16 | real*8 COSBV(L_NLAYRAD,L_NSPECTV,L_NGAUSS) |
---|
17 | real*8 WBARV(L_NLAYRAD,L_NSPECTV,L_NGAUSS) |
---|
18 | real*8 STEL(L_NSPECTV) |
---|
19 | real*8 FLUXUPV(L_NLAYRAD), FLUXDNV(L_NLAYRAD) |
---|
20 | real*8 NFLUXTOPV, FLUXUP, FLUXDN,FLUXTOPVDN |
---|
21 | real*8 NFLUXOUTV_nu(L_NSPECTV) |
---|
22 | real*8 NFLUXGNDV_nu(L_NSPECTV) |
---|
23 | |
---|
24 | integer L, NG, NW, NG1,k |
---|
25 | real*8 ubar0, f0pi, btop, bsurf, taumax, eterm |
---|
26 | real*8 rsfv(L_NSPECTV) ! Spectral dependency added by MT2015. |
---|
27 | real*8 FZEROV(L_NSPECTV) |
---|
28 | |
---|
29 | real*8 DIFFV, DIFFVT |
---|
30 | real*8 taugsurf(L_NSPECTV,L_NGAUSS-1), fzero |
---|
31 | |
---|
32 | C======================================================================C |
---|
33 | |
---|
34 | TAUMAX = L_TAUMAX |
---|
35 | |
---|
36 | C ZERO THE NET FLUXES |
---|
37 | |
---|
38 | NFLUXTOPV = 0.0 |
---|
39 | FLUXTOPVDN = 0.0 |
---|
40 | |
---|
41 | DO NW=1,L_NSPECTV |
---|
42 | NFLUXOUTV_nu(NW)=0.0 |
---|
43 | NFLUXGNDV_nu(NW)=0.0 |
---|
44 | END DO |
---|
45 | |
---|
46 | DO L=1,L_NLAYRAD |
---|
47 | FMNETV(L) = 0.0 |
---|
48 | FLUXUPV(L) = 0.0 |
---|
49 | FLUXDNV(L) = 0.0 |
---|
50 | END DO |
---|
51 | |
---|
52 | DIFFVT = 0.0 |
---|
53 | |
---|
54 | C WE NOW ENTER A MAJOR LOOP OVER SPECTRAL INTERVALS IN THE VISIBLE |
---|
55 | C TO CALCULATE THE NET FLUX IN EACH SPECTRAL INTERVAL |
---|
56 | |
---|
57 | DO 500 NW=1,L_NSPECTV |
---|
58 | |
---|
59 | F0PI = STEL(NW) |
---|
60 | |
---|
61 | FZERO = FZEROV(NW) |
---|
62 | IF(FZERO.ge.0.99) goto 40 |
---|
63 | DO NG=1,L_NGAUSS-1 |
---|
64 | |
---|
65 | if(TAUGSURF(NW,NG) .lt. TLIMIT) then |
---|
66 | |
---|
67 | fzero = fzero + (1.0-FZEROV(NW))*GWEIGHT(NG) |
---|
68 | |
---|
69 | goto 30 |
---|
70 | end if |
---|
71 | |
---|
72 | C SET UP THE UPPER AND LOWER BOUNDARY CONDITIONS ON THE VISIBLE |
---|
73 | |
---|
74 | BTOP = 0.0 |
---|
75 | !BSURF = 0./0. ! why was this here? |
---|
76 | BSURF = 0. |
---|
77 | C LOOP OVER THE NTERMS BEGINNING HERE |
---|
78 | |
---|
79 | |
---|
80 | ! FACTOR = 1.0D0 - WDEL(1)*CDEL(1)**2 |
---|
81 | ! TAU(1) = TDEL(1)*FACTOR |
---|
82 | |
---|
83 | ETERM = MIN(TAUV(L_NLEVRAD,NW,NG),TAUMAX) |
---|
84 | if (abs(ubar0).gt.1e-2) then |
---|
85 | BSURF = RSFV(NW)*UBAR0*STEL(NW)*EXP(-ETERM/UBAR0) |
---|
86 | else |
---|
87 | BSURF = 0. |
---|
88 | endif |
---|
89 | |
---|
90 | C WE CAN NOW SOLVE FOR THE COEFFICIENTS OF THE TWO STREAM |
---|
91 | C CALL A SUBROUTINE THAT SOLVES FOR THE FLUX TERMS |
---|
92 | C WITHIN EACH INTERVAL AT THE MIDPOINT WAVENUMBER |
---|
93 | C |
---|
94 | C FUW AND FDW ARE WORKING FLUX ARRAYS THAT WILL BE USED TO |
---|
95 | C RETURN FLUXES FOR A GIVEN NT |
---|
96 | |
---|
97 | |
---|
98 | CALL GFLUXV(DTAUV(1,NW,NG),TAUV(1,NW,NG),TAUCUMV(1,NW,NG), |
---|
99 | * WBARV(1,NW,NG),COSBV(1,NW,NG),UBAR0,F0PI,RSFV(NW), |
---|
100 | * BTOP,BSURF,FMUPV,FMDV,DIFFV,FLUXUP,FLUXDN) |
---|
101 | |
---|
102 | C NOW CALCULATE THE CUMULATIVE VISIBLE NET FLUX |
---|
103 | |
---|
104 | NFLUXTOPV = NFLUXTOPV+(FLUXUP-FLUXDN)*GWEIGHT(NG)* |
---|
105 | * (1.0-FZEROV(NW)) |
---|
106 | FLUXTOPVDN = FLUXTOPVDN+FLUXDN*GWEIGHT(NG)* |
---|
107 | * (1.0-FZEROV(NW)) |
---|
108 | DO L=1,L_NLAYRAD |
---|
109 | FMNETV(L)=FMNETV(L)+( FMUPV(L)-FMDV(L) )* |
---|
110 | * GWEIGHT(NG)*(1.0-FZEROV(NW)) |
---|
111 | FLUXUPV(L) = FLUXUPV(L) + FMUPV(L)*GWEIGHT(NG)* |
---|
112 | * (1.0-FZEROV(NW)) |
---|
113 | FLUXDNV(L) = FLUXDNV(L) + FMDV(L)*GWEIGHT(NG)* |
---|
114 | * (1.0-FZEROV(NW)) |
---|
115 | END DO |
---|
116 | |
---|
117 | c band-resolved flux leaving TOA (RDW) |
---|
118 | NFLUXOUTV_nu(NW) = NFLUXOUTV_nu(NW) |
---|
119 | * +FLUXUP*GWEIGHT(NG)*(1.0-FZEROV(NW)) |
---|
120 | |
---|
121 | c band-resolved flux at ground (RDW) |
---|
122 | NFLUXGNDV_nu(NW) = NFLUXGNDV_nu(NW) |
---|
123 | * +FMDV(L_NLAYRAD)*GWEIGHT(NG)*(1.0-FZEROV(NW)) |
---|
124 | |
---|
125 | |
---|
126 | C THE DIFFUSE COMPONENT OF THE DOWNWARD STELLAR FLUX |
---|
127 | |
---|
128 | DIFFVT = DIFFVT + DIFFV*GWEIGHT(NG)*(1.0-FZEROV(NW)) |
---|
129 | |
---|
130 | 30 CONTINUE |
---|
131 | |
---|
132 | END DO ! the Gauss loop |
---|
133 | |
---|
134 | 40 continue |
---|
135 | C Special 17th Gauss point |
---|
136 | |
---|
137 | NG = L_NGAUSS |
---|
138 | |
---|
139 | C SET UP THE UPPER AND LOWER BOUNDARY CONDITIONS ON THE VISIBLE |
---|
140 | |
---|
141 | BTOP = 0.0 |
---|
142 | |
---|
143 | C LOOP OVER THE NTERMS BEGINNING HERE |
---|
144 | |
---|
145 | ETERM = MIN(TAUV(L_NLEVRAD,NW,NG),TAUMAX) |
---|
146 | if (abs(ubar0).gt.1e-2) then |
---|
147 | BSURF = RSFV(NW)*UBAR0*STEL(NW)*EXP(-ETERM/UBAR0) |
---|
148 | else |
---|
149 | BSURF = 0. |
---|
150 | endif |
---|
151 | |
---|
152 | |
---|
153 | C WE CAN NOW SOLVE FOR THE COEFFICIENTS OF THE TWO STREAM |
---|
154 | C CALL A SUBROUTINE THAT SOLVES FOR THE FLUX TERMS |
---|
155 | C WITHIN EACH INTERVAL AT THE MIDPOINT WAVENUMBER |
---|
156 | C |
---|
157 | C FUW AND FDW ARE WORKING FLUX ARRAYS THAT WILL BE USED TO |
---|
158 | C RETURN FLUXES FOR A GIVEN NT |
---|
159 | |
---|
160 | CALL GFLUXV(DTAUV(1,NW,NG),TAUV(1,NW,NG),TAUCUMV(1,NW,NG), |
---|
161 | * WBARV(1,NW,NG),COSBV(1,NW,NG),UBAR0,F0PI,RSFV(NW), |
---|
162 | * BTOP,BSURF,FMUPV,FMDV,DIFFV,FLUXUP,FLUXDN) |
---|
163 | |
---|
164 | |
---|
165 | C NOW CALCULATE THE CUMULATIVE VISIBLE NET FLUX |
---|
166 | |
---|
167 | NFLUXTOPV = NFLUXTOPV+(FLUXUP-FLUXDN)*FZERO |
---|
168 | FLUXTOPVDN = FLUXTOPVDN+FLUXDN*FZERO |
---|
169 | DO L=1,L_NLAYRAD |
---|
170 | FMNETV(L)=FMNETV(L)+( FMUPV(L)-FMDV(L) )*FZERO |
---|
171 | FLUXUPV(L) = FLUXUPV(L) + FMUPV(L)*FZERO |
---|
172 | FLUXDNV(L) = FLUXDNV(L) + FMDV(L)*FZERO |
---|
173 | END DO |
---|
174 | |
---|
175 | c band-resolved flux leaving TOA (RDW) |
---|
176 | NFLUXOUTV_nu(NW) = NFLUXOUTV_nu(NW) |
---|
177 | * +FLUXUP*FZERO |
---|
178 | |
---|
179 | c band-resolved flux at ground (RDW) |
---|
180 | NFLUXGNDV_nu(NW) = NFLUXGNDV_nu(NW)+FMDV(L_NLAYRAD)*FZERO |
---|
181 | |
---|
182 | |
---|
183 | C THE DIFFUSE COMPONENT OF THE DOWNWARD STELLAR FLUX |
---|
184 | |
---|
185 | DIFFVT = DIFFVT + DIFFV*FZERO |
---|
186 | |
---|
187 | |
---|
188 | 500 CONTINUE |
---|
189 | |
---|
190 | |
---|
191 | C *** END OF MAJOR SPECTRAL INTERVAL LOOP IN THE VISIBLE***** |
---|
192 | |
---|
193 | |
---|
194 | RETURN |
---|
195 | END |
---|