1 | SUBROUTINE SFLUXI(PLEV,TLEV,DTAUI,TAUCUMI,UBARI,RSFI,WNOI,DWNI, |
---|
2 | * COSBI,WBARI,GWEIGHT,NFLUXTOPI,NFLUXTOPI_nu, |
---|
3 | * FMNETI,fluxupi,fluxdni,fluxupi_nu, |
---|
4 | * FZEROI,TAUGSURF) |
---|
5 | |
---|
6 | use radinc_h |
---|
7 | use radcommon_h, only: planckir, tlimit |
---|
8 | |
---|
9 | implicit none |
---|
10 | |
---|
11 | #include "comcstfi.h" |
---|
12 | |
---|
13 | integer NLEVRAD, L, NW, NG, NTS, NTT |
---|
14 | |
---|
15 | real*8 TLEV(L_LEVELS), PLEV(L_LEVELS) |
---|
16 | real*8 TAUCUMI(L_LEVELS,L_NSPECTI,L_NGAUSS) |
---|
17 | real*8 FMNETI(L_NLAYRAD) |
---|
18 | real*8 WNOI(L_NSPECTI), DWNI(L_NSPECTI) |
---|
19 | real*8 DTAUI(L_NLAYRAD,L_NSPECTI,L_NGAUSS) |
---|
20 | real*8 FMUPI(L_NLEVRAD), FMDI(L_NLEVRAD) |
---|
21 | real*8 COSBI(L_NLAYRAD,L_NSPECTI,L_NGAUSS) |
---|
22 | real*8 WBARI(L_NLAYRAD,L_NSPECTI,L_NGAUSS) |
---|
23 | real*8 GWEIGHT(L_NGAUSS), NFLUXTOPI |
---|
24 | real*8 NFLUXTOPI_nu(L_NSPECTI) |
---|
25 | real*8 fluxupi_nu(L_NLAYRAD,L_NSPECTI) |
---|
26 | real*8 FTOPUP |
---|
27 | |
---|
28 | real*8 UBARI, RSFI, TSURF, BSURF, TTOP, BTOP, TAUTOP |
---|
29 | real*8 PLANCK, PLTOP |
---|
30 | real*8 fluxupi(L_NLAYRAD), fluxdni(L_NLAYRAD) |
---|
31 | real*8 FZEROI(L_NSPECTI) |
---|
32 | real*8 taugsurf(L_NSPECTI,L_NGAUSS-1), fzero |
---|
33 | |
---|
34 | ! real*8 BSURFtest ! by RW for test |
---|
35 | |
---|
36 | real*8 fup_tmp(L_NSPECTI),fdn_tmp(L_NSPECTI) |
---|
37 | |
---|
38 | |
---|
39 | C======================================================================C |
---|
40 | |
---|
41 | NLEVRAD = L_NLEVRAD |
---|
42 | |
---|
43 | |
---|
44 | C ZERO THE NET FLUXES |
---|
45 | |
---|
46 | NFLUXTOPI = 0.0 |
---|
47 | |
---|
48 | DO NW=1,L_NSPECTI |
---|
49 | NFLUXTOPI_nu(NW) = 0.0 |
---|
50 | DO L=1,L_NLAYRAD |
---|
51 | FLUXUPI_nu(L,NW) = 0.0 |
---|
52 | |
---|
53 | fup_tmp(nw)=0.0 |
---|
54 | fdn_tmp(nw)=0.0 |
---|
55 | |
---|
56 | END DO |
---|
57 | END DO |
---|
58 | |
---|
59 | DO L=1,L_NLAYRAD |
---|
60 | FMNETI(L) = 0.0 |
---|
61 | FLUXUPI(L) = 0.0 |
---|
62 | FLUXDNI(L) = 0.0 |
---|
63 | END DO |
---|
64 | |
---|
65 | C WE NOW ENTER A MAJOR LOOP OVER SPECTRAL INTERVALS IN THE INFRARED |
---|
66 | C TO CALCULATE THE NET FLUX IN EACH SPECTRAL INTERVAL |
---|
67 | |
---|
68 | TTOP = TLEV(2) |
---|
69 | TSURF = TLEV(L_LEVELS) |
---|
70 | |
---|
71 | NTS = int(TSURF*10.0D0)-NTstar+1 |
---|
72 | NTT = int(TTOP *10.0D0)-NTstar+1 |
---|
73 | ! NTS = TSURF*10.0D0-499 |
---|
74 | ! NTT = TTOP *10.0D0-499 |
---|
75 | |
---|
76 | ! BSURFtest=0.0 |
---|
77 | |
---|
78 | DO 501 NW=1,L_NSPECTI |
---|
79 | |
---|
80 | C SURFACE EMISSIONS - INDEPENDENT OF GAUSS POINTS |
---|
81 | BSURF = (1.-RSFI)*PLANCKIR(NW,NTS) ! interpolate for accuracy?? |
---|
82 | PLTOP = PLANCKIR(NW,NTT) |
---|
83 | |
---|
84 | C If FZEROI(NW) = 1, then the k-coefficients are zero - skip to the |
---|
85 | C special Gauss point at the end. |
---|
86 | |
---|
87 | FZERO = FZEROI(NW) |
---|
88 | IF(FZERO.ge.0.99) goto 40 |
---|
89 | |
---|
90 | DO NG=1,L_NGAUSS-1 |
---|
91 | |
---|
92 | if(TAUGSURF(NW,NG).lt. TLIMIT) then |
---|
93 | fzero = fzero + (1.0-FZEROI(NW))*GWEIGHT(NG) |
---|
94 | goto 30 |
---|
95 | end if |
---|
96 | |
---|
97 | C SET UP THE UPPER AND LOWER BOUNDARY CONDITIONS ON THE IR |
---|
98 | C CALCULATE THE DOWNWELLING RADIATION AT THE TOP OF THE MODEL |
---|
99 | C OR THE TOP LAYER WILL COOL TO SPACE UNPHYSICALLY |
---|
100 | |
---|
101 | TAUTOP = DTAUI(1,NW,NG)*PLEV(2)/(PLEV(4)-PLEV(2)) |
---|
102 | BTOP = (1.0-EXP(-TAUTOP/UBARI))*PLTOP |
---|
103 | |
---|
104 | C WE CAN NOW SOLVE FOR THE COEFFICIENTS OF THE TWO STREAM |
---|
105 | C CALL A SUBROUTINE THAT SOLVES FOR THE FLUX TERMS |
---|
106 | C WITHIN EACH INTERVAL AT THE MIDPOINT WAVENUMBER |
---|
107 | |
---|
108 | CALL GFLUXI(NLEVRAD,TLEV,NW,DWNI(NW),DTAUI(1,NW,NG), |
---|
109 | * TAUCUMI(1,NW,NG), |
---|
110 | * WBARI(1,NW,NG),COSBI(1,NW,NG),UBARI,RSFI,BTOP, |
---|
111 | * BSURF,FTOPUP,FMUPI,FMDI) |
---|
112 | |
---|
113 | |
---|
114 | |
---|
115 | C NOW CALCULATE THE CUMULATIVE IR NET FLUX |
---|
116 | |
---|
117 | NFLUXTOPI = NFLUXTOPI+FTOPUP*DWNI(NW)*GWEIGHT(NG)* |
---|
118 | * (1.0-FZEROI(NW)) |
---|
119 | |
---|
120 | c and same thing by spectral band... (RDW) |
---|
121 | NFLUXTOPI_nu(NW) = NFLUXTOPI_nu(NW) |
---|
122 | * +FTOPUP*DWNI(NW)*GWEIGHT(NG)*(1.0-FZEROI(NW)) |
---|
123 | |
---|
124 | |
---|
125 | DO L=1,L_NLEVRAD-1 |
---|
126 | |
---|
127 | C CORRECT FOR THE WAVENUMBER INTERVALS |
---|
128 | |
---|
129 | FMNETI(L) = FMNETI(L)+(FMUPI(L)-FMDI(L))*DWNI(NW)* |
---|
130 | * GWEIGHT(NG)*(1.0-FZEROI(NW)) |
---|
131 | FLUXUPI(L) = FLUXUPI(L) + FMUPI(L)*DWNI(NW)*GWEIGHT(NG)* |
---|
132 | * (1.0-FZEROI(NW)) |
---|
133 | FLUXDNI(L) = FLUXDNI(L) + FMDI(L)*DWNI(NW)*GWEIGHT(NG)* |
---|
134 | * (1.0-FZEROI(NW)) |
---|
135 | |
---|
136 | c and same thing by spectral band... (RW) |
---|
137 | FLUXUPI_nu(L,NW) = FLUXUPI_nu(L,NW) + |
---|
138 | * FMUPI(L)*DWNI(NW)*GWEIGHT(NG)*(1.0-FZEROI(NW)) |
---|
139 | |
---|
140 | END DO |
---|
141 | |
---|
142 | 30 CONTINUE |
---|
143 | |
---|
144 | END DO !End NGAUSS LOOP |
---|
145 | |
---|
146 | 40 CONTINUE |
---|
147 | |
---|
148 | C SPECIAL 17th Gauss point |
---|
149 | |
---|
150 | NG = L_NGAUSS |
---|
151 | |
---|
152 | TAUTOP = DTAUI(1,NW,NG)*PLEV(2)/(PLEV(4)-PLEV(2)) |
---|
153 | BTOP = (1.0-EXP(-TAUTOP/UBARI))*PLTOP |
---|
154 | |
---|
155 | C WE CAN NOW SOLVE FOR THE COEFFICIENTS OF THE TWO STREAM |
---|
156 | C CALL A SUBROUTINE THAT SOLVES FOR THE FLUX TERMS |
---|
157 | C WITHIN EACH INTERVAL AT THE MIDPOINT WAVENUMBER |
---|
158 | |
---|
159 | |
---|
160 | CALL GFLUXI(NLEVRAD,TLEV,NW,DWNI(NW),DTAUI(1,NW,NG), |
---|
161 | * TAUCUMI(1,NW,NG), |
---|
162 | * WBARI(1,NW,NG),COSBI(1,NW,NG),UBARI,RSFI,BTOP, |
---|
163 | * BSURF,FTOPUP,FMUPI,FMDI) |
---|
164 | |
---|
165 | C NOW CALCULATE THE CUMULATIVE IR NET FLUX |
---|
166 | |
---|
167 | NFLUXTOPI = NFLUXTOPI+FTOPUP*DWNI(NW)*FZERO |
---|
168 | |
---|
169 | c and same thing by spectral band... (RW) |
---|
170 | NFLUXTOPI_nu(NW) = NFLUXTOPI_nu(NW) |
---|
171 | * +FTOPUP*DWNI(NW)*FZERO |
---|
172 | |
---|
173 | DO L=1,L_NLEVRAD-1 |
---|
174 | |
---|
175 | C CORRECT FOR THE WAVENUMBER INTERVALS |
---|
176 | |
---|
177 | FMNETI(L) = FMNETI(L)+(FMUPI(L)-FMDI(L))*DWNI(NW)*FZERO |
---|
178 | FLUXUPI(L) = FLUXUPI(L) + FMUPI(L)*DWNI(NW)*FZERO |
---|
179 | FLUXDNI(L) = FLUXDNI(L) + FMDI(L)*DWNI(NW)*FZERO |
---|
180 | |
---|
181 | c and same thing by spectral band... (RW) |
---|
182 | FLUXUPI_nu(L,NW) = FLUXUPI_nu(L,NW) + FMUPI(L)*DWNI(NW)*FZERO |
---|
183 | |
---|
184 | END DO |
---|
185 | |
---|
186 | 501 CONTINUE !End Spectral Interval LOOP |
---|
187 | |
---|
188 | C *** END OF MAJOR SPECTRAL INTERVAL LOOP IN THE INFRARED**** |
---|
189 | |
---|
190 | RETURN |
---|
191 | END |
---|