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