[135] | 1 | SUBROUTINE GFLUXV(DTDEL,TDEL,TAUCUMIN,WDEL,CDEL,UBAR0,F0PI,RSF, |
---|
| 2 | * BTOP,BSURF,FMIDP,FMIDM,DIFFV,FLUXUP,FLUXDN) |
---|
| 3 | |
---|
| 4 | |
---|
| 5 | C THIS SUBROUTINE TAKES THE OPTICAL CONSTANTS AND BOUNDARY CONDITIONS |
---|
| 6 | C FOR THE VISIBLE FLUX AT ONE WAVELENGTH AND SOLVES FOR THE FLUXES AT |
---|
| 7 | C THE LEVELS. THIS VERSION IS SET UP TO WORK WITH LAYER OPTICAL DEPTHS |
---|
| 8 | C MEASURED FROM THE TOP OF EACH LAYER. (DTAU) TOP OF EACH LAYER HAS |
---|
| 9 | C OPTICAL DEPTH TAU(N).IN THIS SUB LEVEL N IS ABOVE LAYER N. THAT IS LAYER N |
---|
| 10 | C HAS LEVEL N ON TOP AND LEVEL N+1 ON BOTTOM. OPTICAL DEPTH INCREASES |
---|
| 11 | C FROM TOP TO BOTTOM. SEE C.P. MCKAY, TGM NOTES. |
---|
| 12 | C THIS SUBROUTINE DIFFERS FROM ITS IR COUNTERPART IN THAT HERE WE SOLVE FOR |
---|
| 13 | C THE FLUXES DIRECTLY USING THE GENERALIZED NOTATION OF MEADOR AND WEAVOR |
---|
| 14 | C J.A.S., 37, 630-642, 1980. |
---|
| 15 | C THE TRI-DIAGONAL MATRIX SOLVER IS DSOLVER AND IS DOUBLE PRECISION SO MANY |
---|
| 16 | C VARIABLES ARE PASSED AS SINGLE THEN BECOME DOUBLE IN DSOLVER |
---|
| 17 | C |
---|
| 18 | C NLL = NUMBER OF LEVELS (NAYER + 1) THAT WILL BE SOLVED |
---|
| 19 | C NAYER = NUMBER OF LAYERS (NOTE DIFFERENT SPELLING HERE) |
---|
| 20 | C WAVEN = WAVELENGTH FOR THE COMPUTATION |
---|
| 21 | C DTDEL(NLAYER) = ARRAY OPTICAL DEPTH OF THE LAYERS |
---|
| 22 | C TDEL(NLL) = ARRAY COLUMN OPTICAL DEPTH AT THE LEVELS |
---|
| 23 | C WDEL(NLEVEL) = SINGLE SCATTERING ALBEDO |
---|
| 24 | C CDEL(NLL) = ASYMMETRY FACTORS, 0=ISOTROPIC |
---|
| 25 | C UBARV = AVERAGE ANGLE, |
---|
| 26 | C UBAR0 = SOLAR ZENITH ANGLE |
---|
| 27 | C F0PI = INCIDENT SOLAR DIRECT BEAM FLUX |
---|
| 28 | C RSF = SURFACE REFLECTANCE |
---|
| 29 | C BTOP = UPPER BOUNDARY CONDITION ON DIFFUSE FLUX |
---|
| 30 | C BSURF = REFLECTED DIRECT BEAM = (1-RSFI)*F0PI*EDP-TAU/U |
---|
| 31 | C FP(NLEVEL) = UPWARD FLUX AT LEVELS |
---|
| 32 | C FM(NLEVEL) = DOWNWARD FLUX AT LEVELS |
---|
| 33 | C FMIDP(NLAYER) = UPWARD FLUX AT LAYER MIDPOINTS |
---|
| 34 | C FMIDM(NLAYER) = DOWNWARD FLUX AT LAYER MIDPOINTS |
---|
| 35 | C added Dec 2002 |
---|
| 36 | C DIFFV = downward diffuse solar flux at the surface |
---|
| 37 | C |
---|
| 38 | !======================================================================! |
---|
| 39 | |
---|
| 40 | use radinc_h |
---|
| 41 | |
---|
| 42 | implicit none |
---|
| 43 | |
---|
[1420] | 44 | !! INTEGER NLP |
---|
| 45 | !! PARAMETER (NLP=101) ! MUST BE LARGER THAN NLEVEL |
---|
[135] | 46 | |
---|
| 47 | REAL*8 EM, EP |
---|
| 48 | REAL*8 W0(L_NLAYRAD), COSBAR(L_NLAYRAD), DTAU(L_NLAYRAD) |
---|
| 49 | REAL*8 TAU(L_NLEVRAD), WDEL(L_NLAYRAD), CDEL(L_NLAYRAD) |
---|
| 50 | REAL*8 DTDEL(L_NLAYRAD), TDEL(L_NLEVRAD) |
---|
| 51 | REAL*8 FMIDP(L_NLAYRAD), FMIDM(L_NLAYRAD) |
---|
[1420] | 52 | REAL*8 LAMDA(L_NLAYRAD), ALPHA(L_NLAYRAD), XK1(L_NLAYRAD) |
---|
| 53 | REAL*8 XK2(L_NLAYRAD),G1(L_NLAYRAD), G2(L_NLAYRAD) |
---|
| 54 | REAL*8 G3(L_NLAYRAD), GAMA(L_NLAYRAD),CP(L_NLAYRAD),CM(L_NLAYRAD) |
---|
| 55 | REAL*8 CPM1(L_NLAYRAD),CMM1(L_NLAYRAD), E1(L_NLAYRAD) |
---|
| 56 | REAL*8 E2(L_NLAYRAD),E3(L_NLAYRAD),E4(L_NLAYRAD),EXPTRM(L_NLAYRAD) |
---|
[135] | 57 | REAL*8 FLUXUP, FLUXDN |
---|
| 58 | REAL*8 FACTOR, TAUCUMIN(L_LEVELS), TAUCUM(L_LEVELS) |
---|
| 59 | |
---|
| 60 | integer NAYER, L, K |
---|
| 61 | real*8 ubar0, f0pi, rsf, btop, bsurf, g4, denom, am, ap |
---|
| 62 | real*8 taumax, taumid, cpmid, cmmid |
---|
| 63 | real*8 diffv |
---|
| 64 | |
---|
| 65 | C======================================================================C |
---|
| 66 | |
---|
| 67 | |
---|
| 68 | |
---|
[253] | 69 | |
---|
[135] | 70 | NAYER = L_NLAYRAD |
---|
| 71 | TAUMAX = L_TAUMAX !Default is 35.0 |
---|
| 72 | |
---|
| 73 | ! Delta-Eddington Scaling |
---|
| 74 | |
---|
| 75 | |
---|
| 76 | FACTOR = 1.0D0 - WDEL(1)*CDEL(1)**2 |
---|
| 77 | |
---|
| 78 | TAU(1) = TDEL(1)*FACTOR |
---|
| 79 | TAUCUM(1) = 0.0D0 |
---|
| 80 | TAUCUM(2) = TAUCUMIN(2)*FACTOR |
---|
| 81 | TAUCUM(3) = TAUCUM(2) +(TAUCUMIN(3)-TAUCUMIN(2))*FACTOR |
---|
| 82 | |
---|
| 83 | |
---|
| 84 | DO L=1,L_NLAYRAD-1 |
---|
| 85 | FACTOR = 1.0D0 - WDEL(L)*CDEL(L)**2 |
---|
| 86 | W0(L) = WDEL(L)*(1.0D0-CDEL(L)**2)/FACTOR |
---|
| 87 | COSBAR(L) = CDEL(L)/(1.0D0+CDEL(L)) |
---|
[253] | 88 | |
---|
[135] | 89 | DTAU(L) = DTDEL(L)*FACTOR |
---|
| 90 | TAU(L+1) = TAU(L)+DTAU(L) |
---|
| 91 | K = 2*(L+1) |
---|
| 92 | TAUCUM(K) = TAU(L+1) |
---|
| 93 | TAUCUM(K+1) = TAUCUM(K) + (TAUCUMIN(K+1)-TAUCUMIN(K))*FACTOR |
---|
| 94 | END DO |
---|
| 95 | |
---|
| 96 | ! Bottom layer |
---|
| 97 | |
---|
| 98 | L = L_NLAYRAD |
---|
| 99 | FACTOR = 1.0D0 - WDEL(L)*CDEL(L)**2 |
---|
| 100 | W0(L) = WDEL(L)*(1.0D0-CDEL(L)**2)/FACTOR |
---|
| 101 | COSBAR(L) = CDEL(L)/(1.0D0+CDEL(L)) |
---|
| 102 | DTAU(L) = DTDEL(L)*FACTOR |
---|
| 103 | TAU(L+1) = TAU(L)+DTAU(L) |
---|
| 104 | TAUCUM(2*L+1) = TAU(L+1) |
---|
| 105 | |
---|
| 106 | BSURF = RSF*UBAR0*F0PI*EXP(-MIN(TAU(L+1),TAUMAX)/UBAR0) |
---|
| 107 | ! new definition of BSURF |
---|
| 108 | ! the old one was false because it used tau, not tau' |
---|
| 109 | ! tau' includes the contribution to the downward flux |
---|
| 110 | ! of the radiation scattered in the forward direction |
---|
| 111 | |
---|
| 112 | C WE GO WITH THE QUADRATURE APPROACH HERE. THE "SQRT(3)" factors |
---|
| 113 | C ARE THE UBARV TERM. |
---|
| 114 | |
---|
| 115 | DO L=1,L_NLAYRAD |
---|
| 116 | |
---|
[253] | 117 | ALPHA(L)=SQRT( (1.0-W0(L))/(1.0-W0(L)*COSBAR(L) ) ) |
---|
[135] | 118 | |
---|
| 119 | C SET OF CONSTANTS DETERMINED BY DOM |
---|
| 120 | |
---|
[253] | 121 | ! Quadrature method |
---|
[135] | 122 | G1(L) = (SQRT(3.0)*0.5)*(2.0- W0(L)*(1.0+COSBAR(L))) |
---|
| 123 | G2(L) = (SQRT(3.0)*W0(L)*0.5)*(1.0-COSBAR(L)) |
---|
| 124 | G3(L) = 0.5*(1.0-SQRT(3.0)*COSBAR(L)*UBAR0) |
---|
| 125 | |
---|
[253] | 126 | ! ----- some other methods... (RDW) ------ |
---|
[135] | 127 | |
---|
[253] | 128 | ! Eddington method |
---|
| 129 | ! G1(L) = 0.25*(7.0 - W0(L)*(4.0 - 3.0*COSBAR(L))) |
---|
| 130 | ! G2(L) = -0.25*(1.0 - W0(L)*(4.0 - 3.0*COSBAR(L))) |
---|
| 131 | ! G3(L) = 0.25*(2.0 - 3.0*COSBAR(L)*UBAR0) |
---|
| 132 | |
---|
| 133 | ! delta-Eddington method |
---|
| 134 | ! G1(L) = (7.0 - 3.0*g^2 - W0(L)*(4.0 + 3.0*g) + W0(L)*g^2*(4*beta0 + 3*g)) / & |
---|
| 135 | ! (4* (1 - g^2*() )) 0.25*(7.0 - W0(L)*(4.0 - 3.0*COSBAR(L))) |
---|
| 136 | |
---|
| 137 | ! Hybrid modified Eddington-delta function method |
---|
| 138 | |
---|
| 139 | ! ---------------------------------------- |
---|
| 140 | |
---|
| 141 | c So they use Quadrature |
---|
[135] | 142 | c but the scaling is Eddington? |
---|
| 143 | |
---|
| 144 | LAMDA(L) = SQRT(G1(L)**2 - G2(L)**2) |
---|
| 145 | GAMA(L) = (G1(L)-LAMDA(L))/G2(L) |
---|
| 146 | END DO |
---|
| 147 | |
---|
| 148 | |
---|
| 149 | DO L=1,L_NLAYRAD |
---|
| 150 | G4 = 1.0-G3(L) |
---|
| 151 | DENOM = LAMDA(L)**2 - 1./UBAR0**2 |
---|
| 152 | |
---|
| 153 | C THERE IS A POTENTIAL PROBLEM HERE IF W0=0 AND UBARV=UBAR0 |
---|
| 154 | C THEN DENOM WILL VANISH. THIS ONLY HAPPENS PHYSICALLY WHEN |
---|
| 155 | C THE SCATTERING GOES TO ZERO |
---|
| 156 | C PREVENT THIS WITH AN IF STATEMENT |
---|
| 157 | |
---|
| 158 | IF ( DENOM .EQ. 0.) THEN |
---|
| 159 | DENOM=1.E-10 |
---|
| 160 | END IF |
---|
| 161 | |
---|
| 162 | |
---|
| 163 | AM = F0PI*W0(L)*(G4 *(G1(L)+1./UBAR0) +G2(L)*G3(L) )/DENOM |
---|
| 164 | AP = F0PI*W0(L)*(G3(L)*(G1(L)-1./UBAR0) +G2(L)*G4 )/DENOM |
---|
| 165 | |
---|
| 166 | C CPM1 AND CMM1 ARE THE CPLUS AND CMINUS TERMS EVALUATED |
---|
| 167 | C AT THE TOP OF THE LAYER, THAT IS LOWER OPTICAL DEPTH TAU(L) |
---|
| 168 | |
---|
| 169 | CPM1(L) = AP*EXP(-TAU(L)/UBAR0) |
---|
| 170 | CMM1(L) = AM*EXP(-TAU(L)/UBAR0) |
---|
| 171 | |
---|
| 172 | C CP AND CM ARE THE CPLUS AND CMINUS TERMS EVALUATED AT THE |
---|
| 173 | C BOTTOM OF THE LAYER. THAT IS AT HIGHER OPTICAL DEPTH TAU(L+1) |
---|
| 174 | |
---|
| 175 | CP(L) = AP*EXP(-TAU(L+1)/UBAR0) |
---|
| 176 | CM(L) = AM*EXP(-TAU(L+1)/UBAR0) |
---|
| 177 | |
---|
| 178 | END DO |
---|
| 179 | |
---|
| 180 | |
---|
| 181 | |
---|
| 182 | C NOW CALCULATE THE EXPONENTIAL TERMS NEEDED |
---|
| 183 | C FOR THE TRIDIAGONAL ROTATED LAYERED METHOD |
---|
| 184 | |
---|
| 185 | DO L=1,L_NLAYRAD |
---|
| 186 | EXPTRM(L) = MIN(TAUMAX,LAMDA(L)*DTAU(L)) ! CLIPPED EXPONENTIAL |
---|
| 187 | EP = EXP(EXPTRM(L)) |
---|
| 188 | |
---|
| 189 | EM = 1.0/EP |
---|
| 190 | E1(L) = EP+GAMA(L)*EM |
---|
| 191 | E2(L) = EP-GAMA(L)*EM |
---|
| 192 | E3(L) = GAMA(L)*EP+EM |
---|
| 193 | E4(L) = GAMA(L)*EP-EM |
---|
| 194 | END DO |
---|
| 195 | |
---|
| 196 | CALL DSOLVER(NAYER,GAMA,CP,CM,CPM1,CMM1,E1,E2,E3,E4,BTOP, |
---|
| 197 | * BSURF,RSF,XK1,XK2) |
---|
| 198 | |
---|
| 199 | C NOW WE CALCULATE THE FLUXES AT THE MIDPOINTS OF THE LAYERS. |
---|
| 200 | |
---|
| 201 | DO L=1,L_NLAYRAD-1 |
---|
| 202 | EXPTRM(L) = MIN(TAUMAX,LAMDA(L)*(TAUCUM(2*L+1)-TAUCUM(2*L))) |
---|
| 203 | |
---|
| 204 | EP = EXP(EXPTRM(L)) |
---|
| 205 | |
---|
| 206 | EM = 1.0/EP |
---|
| 207 | G4 = 1.0-G3(L) |
---|
| 208 | DENOM = LAMDA(L)**2 - 1./UBAR0**2 |
---|
| 209 | |
---|
| 210 | C THERE IS A POTENTIAL PROBLEM HERE IF W0=0 AND UBARV=UBAR0 |
---|
| 211 | C THEN DENOM WILL VANISH. THIS ONLY HAPPENS PHYSICALLY WHEN |
---|
| 212 | C THE SCATTERING GOES TO ZERO |
---|
| 213 | C PREVENT THIS WITH A IF STATEMENT |
---|
| 214 | |
---|
| 215 | |
---|
| 216 | IF ( DENOM .EQ. 0.) THEN |
---|
| 217 | DENOM=1.E-10 |
---|
| 218 | END IF |
---|
| 219 | |
---|
| 220 | AM = F0PI*W0(L)*(G4 *(G1(L)+1./UBAR0) +G2(L)*G3(L) )/DENOM |
---|
| 221 | AP = F0PI*W0(L)*(G3(L)*(G1(L)-1./UBAR0) +G2(L)*G4 )/DENOM |
---|
| 222 | |
---|
| 223 | C CPMID AND CMMID ARE THE CPLUS AND CMINUS TERMS EVALUATED |
---|
| 224 | C AT THE MIDDLE OF THE LAYER. |
---|
| 225 | |
---|
| 226 | TAUMID = TAUCUM(2*L+1) |
---|
| 227 | |
---|
| 228 | CPMID = AP*EXP(-TAUMID/UBAR0) |
---|
| 229 | CMMID = AM*EXP(-TAUMID/UBAR0) |
---|
| 230 | |
---|
| 231 | FMIDP(L) = XK1(L)*EP + GAMA(L)*XK2(L)*EM + CPMID |
---|
| 232 | FMIDM(L) = XK1(L)*EP*GAMA(L) + XK2(L)*EM + CMMID |
---|
| 233 | |
---|
| 234 | C ADD THE DIRECT FLUX TO THE DOWNWELLING TERM |
---|
| 235 | |
---|
| 236 | FMIDM(L)= FMIDM(L)+UBAR0*F0PI*EXP(-MIN(TAUMID,TAUMAX)/UBAR0) |
---|
| 237 | |
---|
| 238 | END DO |
---|
| 239 | |
---|
| 240 | C FLUX AT THE Ptop layer |
---|
| 241 | |
---|
[1988] | 242 | ! EP = 1.0 |
---|
| 243 | ! EM = 1.0 |
---|
| 244 | C JL18 correction to account for the fact that the radiative top is not at zero optical depth. |
---|
| 245 | EXPTRM(L) = MIN(TAUMAX,LAMDA(L)*(TAUCUM(2))) |
---|
| 246 | EP = EXP(EXPTRM(L)) |
---|
| 247 | EM = 1.0/EP |
---|
[135] | 248 | G4 = 1.0-G3(1) |
---|
| 249 | DENOM = LAMDA(1)**2 - 1./UBAR0**2 |
---|
| 250 | |
---|
| 251 | C THERE IS A POTENTIAL PROBLEM HERE IF W0=0 AND UBARV=UBAR0 |
---|
| 252 | C THEN DENOM WILL VANISH. THIS ONLY HAPPENS PHYSICALLY WHEN |
---|
| 253 | C THE SCATTERING GOES TO ZERO |
---|
| 254 | C PREVENT THIS WITH A IF STATEMENT |
---|
| 255 | |
---|
| 256 | IF ( DENOM .EQ. 0.) THEN |
---|
| 257 | DENOM=1.E-10 |
---|
| 258 | END IF |
---|
| 259 | |
---|
| 260 | AM = F0PI*W0(1)*(G4 *(G1(1)+1./UBAR0) +G2(1)*G3(1) )/DENOM |
---|
| 261 | AP = F0PI*W0(1)*(G3(1)*(G1(1)-1./UBAR0) +G2(1)*G4 )/DENOM |
---|
| 262 | |
---|
| 263 | C CPMID AND CMMID ARE THE CPLUS AND CMINUS TERMS EVALUATED |
---|
| 264 | C AT THE MIDDLE OF THE LAYER. |
---|
| 265 | |
---|
[1988] | 266 | C CPMID = AP |
---|
| 267 | C CMMID = AM |
---|
| 268 | C JL18 correction to account for the fact that the radiative top is not at zero optical depth. |
---|
| 269 | TAUMID = TAUCUM(2) |
---|
| 270 | CPMID = AP*EXP(-TAUMID/UBAR0) |
---|
| 271 | CMMID = AM*EXP(-TAUMID/UBAR0) |
---|
[135] | 272 | |
---|
| 273 | FLUXUP = XK1(1)*EP + GAMA(1)*XK2(1)*EM + CPMID |
---|
| 274 | FLUXDN = XK1(1)*EP*GAMA(1) + XK2(1)*EM + CMMID |
---|
| 275 | |
---|
| 276 | C ADD THE DIRECT FLUX TO THE DOWNWELLING TERM |
---|
| 277 | |
---|
[1988] | 278 | ! fluxdn = fluxdn+UBAR0*F0PI*EXP(-MIN(TAUCUM(1),TAUMAX)/UBAR0) |
---|
| 279 | !JL18 the line above assumed that the top of the radiative model was P=0 |
---|
| 280 | ! it seems to be better for the IR to use the middle of the last physical layer as the radiative top. |
---|
| 281 | ! so we correct the downwelling flux below for the calculation of the heating rate |
---|
| 282 | fluxdn = fluxdn+UBAR0*F0PI*EXP(-TAUCUM(2)/UBAR0) |
---|
[253] | 283 | |
---|
[135] | 284 | C This is for the "special" bottom layer, where we take |
---|
| 285 | C DTAU instead of DTAU/2. |
---|
| 286 | |
---|
| 287 | L = L_NLAYRAD |
---|
| 288 | EXPTRM(L) = MIN(TAUMAX,LAMDA(L)*(TAUCUM(L_LEVELS)- |
---|
| 289 | * TAUCUM(L_LEVELS-1))) |
---|
| 290 | |
---|
| 291 | EP = EXP(EXPTRM(L)) |
---|
| 292 | EM = 1.0/EP |
---|
| 293 | G4 = 1.0-G3(L) |
---|
| 294 | DENOM = LAMDA(L)**2 - 1./UBAR0**2 |
---|
| 295 | |
---|
| 296 | |
---|
| 297 | C THERE IS A POTENTIAL PROBLEM HERE IF W0=0 AND UBARV=UBAR0 |
---|
| 298 | C THEN DENOM WILL VANISH. THIS ONLY HAPPENS PHYSICALLY WHEN |
---|
| 299 | C THE SCATTERING GOES TO ZERO |
---|
| 300 | C PREVENT THIS WITH A IF STATEMENT |
---|
| 301 | |
---|
| 302 | |
---|
| 303 | IF ( DENOM .EQ. 0.) THEN |
---|
| 304 | DENOM=1.E-10 |
---|
| 305 | END IF |
---|
| 306 | |
---|
| 307 | AM = F0PI*W0(L)*(G4 *(G1(L)+1./UBAR0) +G2(L)*G3(L) )/DENOM |
---|
| 308 | AP = F0PI*W0(L)*(G3(L)*(G1(L)-1./UBAR0) +G2(L)*G4 )/DENOM |
---|
| 309 | |
---|
| 310 | C CPMID AND CMMID ARE THE CPLUS AND CMINUS TERMS EVALUATED |
---|
| 311 | C AT THE MIDDLE OF THE LAYER. |
---|
| 312 | |
---|
| 313 | TAUMID = MIN(TAUCUM(L_LEVELS),TAUMAX) |
---|
| 314 | CPMID = AP*EXP(-MIN(TAUMID,TAUMAX)/UBAR0) |
---|
| 315 | CMMID = AM*EXP(-MIN(TAUMID,TAUMAX)/UBAR0) |
---|
| 316 | |
---|
| 317 | |
---|
| 318 | FMIDP(L) = XK1(L)*EP + GAMA(L)*XK2(L)*EM + CPMID |
---|
| 319 | FMIDM(L) = XK1(L)*EP*GAMA(L) + XK2(L)*EM + CMMID |
---|
| 320 | |
---|
| 321 | C Save the diffuse downward flux for TEMPGR calculations |
---|
| 322 | |
---|
| 323 | DIFFV = FMIDM(L) |
---|
| 324 | |
---|
| 325 | |
---|
| 326 | C ADD THE DIRECT FLUX TO THE DOWNWELLING TERM |
---|
| 327 | |
---|
| 328 | FMIDM(L)= FMIDM(L)+UBAR0*F0PI*EXP(-MIN(TAUMID,TAUMAX)/UBAR0) |
---|
| 329 | |
---|
| 330 | |
---|
| 331 | RETURN |
---|
| 332 | END |
---|