[38] | 1 | SUBROUTINE SWR_TOON ( KDLON, KFLEV, KNU |
---|
| 2 | S , aerosol,QVISsQREF3d,omegaVIS3d,gVIS3d |
---|
| 3 | & , albedo,PDSIG,PPSOL,PRMU,PSEC |
---|
| 4 | S , PFD,PFU ) |
---|
| 5 | |
---|
[1246] | 6 | use dimradmars_mod, only: sunfr, ndlo2, nsun, nflev, |
---|
| 7 | & ndlon, naerkind |
---|
[1047] | 8 | use yomlw_h, only: nlaylte |
---|
| 9 | |
---|
[38] | 10 | IMPLICIT NONE |
---|
| 11 | C |
---|
| 12 | #include "callkeys.h" |
---|
| 13 | |
---|
| 14 | C |
---|
| 15 | C SWR - Continuum scattering computations |
---|
| 16 | C |
---|
| 17 | C PURPOSE. |
---|
| 18 | C -------- |
---|
| 19 | C Computes the reflectivity and transmissivity in case oF |
---|
| 20 | C Continuum scattering |
---|
| 21 | c F. Forget (1999) |
---|
| 22 | c |
---|
| 23 | c Modified by Tran The Trung, using radiative transfer code |
---|
| 24 | c of Toon 1981. |
---|
| 25 | C |
---|
| 26 | C IMPLICIT ARGUMENTS : |
---|
| 27 | C -------------------- |
---|
| 28 | C |
---|
| 29 | C ==== INPUTS === |
---|
| 30 | c |
---|
| 31 | c KDLON : number of horizontal grid points |
---|
| 32 | c KFLEV : number of vertical layers |
---|
| 33 | c KNU : Solar band # (1 or 2) |
---|
| 34 | c aerosol aerosol extinction optical depth |
---|
| 35 | c at reference wavelength "longrefvis" set |
---|
[1047] | 36 | c in dimradmars_mod , in each layer, for one of |
---|
[38] | 37 | c the "naerkind" kind of aerosol optical properties. |
---|
| 38 | c albedo hemispheric surface albedo |
---|
| 39 | c albedo (i,1) : mean albedo for solar band#1 |
---|
| 40 | c (see below) |
---|
| 41 | c albedo (i,2) : mean albedo for solar band#2 |
---|
| 42 | c (see below) |
---|
| 43 | c PDSIG layer thickness in sigma coordinates |
---|
| 44 | c PPSOL Surface pressure (Pa) |
---|
| 45 | c PRMU: cos of solar zenith angle (=1 when sun at zenith) |
---|
| 46 | c (CORRECTED for high zenith angle (atmosphere), unlike mu0) |
---|
| 47 | c PSEC =1./PRMU |
---|
| 48 | |
---|
| 49 | C ==== OUTPUTS === |
---|
| 50 | c |
---|
| 51 | c PFD : downward flux in spectral band #INU in a given mesh |
---|
| 52 | c (normalized to the total incident flux at the top of the atmosphere) |
---|
| 53 | c PFU : upward flux in specatral band #INU in a given mesh |
---|
| 54 | c (normalized to the total incident flux at the top of the atmosphere) |
---|
| 55 | C |
---|
| 56 | C |
---|
| 57 | C METHOD. |
---|
| 58 | C ------- |
---|
| 59 | C |
---|
| 60 | C Computes continuum fluxes corresponding to aerosoL |
---|
| 61 | C Or/and rayleigh scattering (no molecular gas absorption) |
---|
| 62 | C |
---|
| 63 | C----------------------------------------------------------------------- |
---|
| 64 | C |
---|
| 65 | C |
---|
| 66 | C----------------------------------------------------------------------- |
---|
| 67 | C |
---|
| 68 | |
---|
| 69 | C ARGUMENTS |
---|
| 70 | C --------- |
---|
| 71 | INTEGER KDLON, KFLEV, KNU |
---|
| 72 | REAL aerosol(NDLO2,KFLEV,naerkind), albedo(NDLO2,2), |
---|
| 73 | S PDSIG(NDLO2,KFLEV),PSEC(NDLO2) |
---|
| 74 | |
---|
| 75 | REAL QVISsQREF3d(NDLO2,KFLEV,nsun,naerkind) |
---|
| 76 | REAL omegaVIS3d(NDLO2,KFLEV,nsun,naerkind) |
---|
| 77 | REAL gVIS3d(NDLO2,KFLEV,nsun,naerkind) |
---|
| 78 | |
---|
| 79 | REAL PPSOL(NDLO2) |
---|
| 80 | REAL PFD(NDLO2,KFLEV+1),PFU(NDLO2,KFLEV+1) |
---|
| 81 | REAL PRMU(NDLO2) |
---|
| 82 | |
---|
| 83 | C LOCAL ARRAYS |
---|
| 84 | C ------------ |
---|
| 85 | |
---|
| 86 | INTEGER jk,jl,jae |
---|
| 87 | REAL ZTRAY, ZRATIO,ZGAR, ZFF |
---|
| 88 | REAL ZCGAZ(NDLO2,NFLEV),ZPIZAZ(NDLO2,NFLEV),ZTAUAZ(NDLO2,NFLEV) |
---|
| 89 | REAL ZRAYL(NDLON) |
---|
| 90 | |
---|
| 91 | c Part added by Tran The Trung |
---|
| 92 | c inputs to gfluxv |
---|
| 93 | REAL*8 DTDEL(nlaylte), WDEL(nlaylte), CDEL(nlaylte) |
---|
| 94 | c outputs of gfluxv |
---|
| 95 | REAL*8 FP(nlaylte+1), FM(nlaylte+1) |
---|
| 96 | c normalization of top downward flux |
---|
| 97 | REAL*8 norm |
---|
| 98 | c End part added by Tran The Trung |
---|
| 99 | |
---|
| 100 | c Function |
---|
| 101 | c -------- |
---|
| 102 | real CVMGT |
---|
| 103 | |
---|
| 104 | c Computing TOTAL single scattering parameters by adding |
---|
| 105 | c properties of all the NAERKIND kind of aerosols |
---|
| 106 | |
---|
| 107 | DO JK = 1 , nlaylte |
---|
| 108 | DO JL = 1 , KDLON |
---|
| 109 | ZCGAZ(JL,JK) = 0. |
---|
| 110 | ZPIZAZ(JL,JK) = 0. |
---|
| 111 | ZTAUAZ(JL,JK) = 0. |
---|
| 112 | END DO |
---|
| 113 | DO 106 JAE=1,naerkind |
---|
| 114 | DO 105 JL = 1 , KDLON |
---|
| 115 | c Mean Extinction optical depth in the spectral band |
---|
| 116 | c ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 117 | ZTAUAZ(JL,JK)=ZTAUAZ(JL,JK) |
---|
| 118 | S +aerosol(JL,JK,JAE)*QVISsQREF3d(JL,JK,KNU,JAE) |
---|
| 119 | c Single scattering albedo |
---|
| 120 | c ~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 121 | ZPIZAZ(JL,JK)=ZPIZAZ(JL,JK)+aerosol(JL,JK,JAE)* |
---|
| 122 | S QVISsQREF3d(JL,JK,KNU,JAE)* |
---|
| 123 | & omegaVIS3d(JL,JK,KNU,JAE) |
---|
| 124 | c Assymetry factor |
---|
| 125 | c ~~~~~~~~~~~~~~~~ |
---|
| 126 | ZCGAZ(JL,JK) = ZCGAZ(JL,JK) +aerosol(JL,JK,JAE)* |
---|
| 127 | S QVISsQREF3d(JL,JK,KNU,JAE)* |
---|
| 128 | & omegaVIS3d(JL,JK,KNU,JAE)*gVIS3d(JL,JK,KNU,JAE) |
---|
| 129 | 105 CONTINUE |
---|
| 130 | 106 CONTINUE |
---|
| 131 | END DO |
---|
| 132 | C |
---|
| 133 | DO JK = 1 , nlaylte |
---|
| 134 | DO JL = 1 , KDLON |
---|
| 135 | ZCGAZ(JL,JK) = CVMGT( 0., ZCGAZ(JL,JK) / ZPIZAZ(JL,JK), |
---|
| 136 | S (ZPIZAZ(JL,JK).EQ.0) ) |
---|
| 137 | ZPIZAZ(JL,JK) = CVMGT( 1., ZPIZAZ(JL,JK) / ZTAUAZ(JL,JK), |
---|
| 138 | S (ZTAUAZ(JL,JK).EQ.0) ) |
---|
| 139 | END DO |
---|
| 140 | END DO |
---|
| 141 | |
---|
| 142 | C -------------------------------- |
---|
| 143 | C INCLUDING RAYLEIGH SCATERRING |
---|
| 144 | C ------------------------------- |
---|
| 145 | if (rayleigh) then |
---|
| 146 | |
---|
| 147 | call swrayleigh(kdlon,knu,ppsol,prmu,ZRAYL) |
---|
| 148 | |
---|
| 149 | c Modifying mean aerosol parameters to account rayleigh scat by gas: |
---|
| 150 | |
---|
| 151 | DO JK = 1 , nlaylte |
---|
| 152 | DO JL = 1 , KDLON |
---|
| 153 | c Rayleigh opacity in each layer : |
---|
| 154 | ZTRAY = ZRAYL(JL) * PDSIG(JL,JK) |
---|
| 155 | c ratio Tau(rayleigh) / Tau (total) |
---|
| 156 | ZRATIO = ZTRAY / (ZTRAY + ZTAUAZ(JL,JK)) |
---|
| 157 | ZGAR = ZCGAZ(JL,JK) |
---|
| 158 | ZFF = ZGAR * ZGAR |
---|
| 159 | ZTAUAZ(JL,JK)=ZTRAY+ZTAUAZ(JL,JK)*(1.-ZPIZAZ(JL,JK)*ZFF) |
---|
| 160 | ZCGAZ(JL,JK) = ZGAR * (1. - ZRATIO) / (1. + ZGAR) |
---|
| 161 | ZPIZAZ(JL,JK) =ZRATIO+(1.-ZRATIO)*ZPIZAZ(JL,JK)*(1.-ZFF) |
---|
| 162 | S / (1. -ZPIZAZ(JL,JK) * ZFF) |
---|
| 163 | END DO |
---|
| 164 | END DO |
---|
| 165 | end if |
---|
| 166 | |
---|
| 167 | c Part added by Tran The Trung |
---|
| 168 | c new radiative transfer |
---|
| 169 | |
---|
| 170 | do JL = 1, KDLON |
---|
| 171 | |
---|
| 172 | c assign temporary inputs |
---|
| 173 | do JK = 1, nlaylte |
---|
| 174 | jae = nlaylte+1-JK |
---|
| 175 | DTDEL(JK) = real(ZTAUAZ(JL,jae),8) |
---|
| 176 | WDEL(JK) = real(ZPIZAZ(JL,jae),8) |
---|
| 177 | CDEL(JK) = real(ZCGAZ(JL,jae),8) |
---|
| 178 | end do |
---|
| 179 | |
---|
| 180 | c call gfluxv |
---|
| 181 | call gfluxv(nlaylte, DTDEL,WDEL,CDEL, |
---|
| 182 | S real(PRMU(JL),8), |
---|
| 183 | S real(albedo(JL,KNU),8), |
---|
| 184 | S FP,FM) |
---|
| 185 | |
---|
| 186 | c assign output |
---|
| 187 | norm = FM(1) |
---|
| 188 | c here we can have a check of norm not being 0.0 |
---|
| 189 | c however it would never happen in practice, |
---|
| 190 | c so we can comment out |
---|
| 191 | c if (norm .gt. 0.0) then |
---|
| 192 | do JK = 1, nlaylte+1 |
---|
| 193 | jae = nlaylte+2-JK |
---|
| 194 | PFU(JL,JK) = sunfr(KNU)*real(FP(jae)/norm,4) |
---|
| 195 | PFD(JL,JK) = sunfr(KNU)*real(FM(jae)/norm,4) |
---|
| 196 | end do |
---|
| 197 | c elseif (norm .eq. 0.0) then |
---|
| 198 | c do JK = 1, nlaylte+1 |
---|
| 199 | c PFU(JL,JK) = 0.0 |
---|
| 200 | c PFD(JL,JK) = 0.0 |
---|
| 201 | c end do |
---|
| 202 | c else |
---|
| 203 | c stop "Error: top downward visible flux is negative!" |
---|
| 204 | c end if |
---|
| 205 | |
---|
| 206 | end do |
---|
| 207 | c End part added by Tran The Trung |
---|
| 208 | |
---|
| 209 | RETURN |
---|
| 210 | END |
---|
| 211 | |
---|
| 212 | CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC |
---|
| 213 | |
---|
| 214 | SUBROUTINE GFLUXV(NAYER,DTDEL,WDEL,CDEL,UBAR0,RSF |
---|
| 215 | & ,FP,FM) |
---|
| 216 | IMPLICIT NONE |
---|
| 217 | C THIS SUBROUTINE TAKES THE OPTICAL CONSTANTS AND BOUNDARY CONDITONS |
---|
| 218 | C FOR THE VISIBLE FLUX AT ONE WAVELENGTH AND SOLVES FOR THE FLUXES AT |
---|
| 219 | C THE LEVELS. THIS VERSION IS SET UP TO WORK WITH LAYER OPTICAL DEPTHS |
---|
| 220 | C MEASURED FROM THE TOP OF EACH LAYER. (DTAU) TOP OF EACH LAYER HAS |
---|
| 221 | C OPTICAL DEPTH TAU(N). IN THIS SUB LEVEL N IS ABOVE LAYER N. THAT IS LAYER N |
---|
| 222 | C HAS LEVEL N ON TOP AND LEVEL N+1 ON BOTTOM. OPTICAL DEPTH INCREASES |
---|
| 223 | C FROM TOP TO BOTTOM. SEE C.P. MCKAY, TGM NOTES. |
---|
| 224 | C THIS SUBROUTINE DIFFERS FROM ITS IR CONTERPART IN THAT HERE WE SOLVE FOR |
---|
| 225 | C THE FLUXES DIRECTLY USING THE GENERALIZED NOTATION OF MEADOR AND WEAVOR |
---|
| 226 | C J.A.S., 37, 630-642, 1980. |
---|
| 227 | C THE TRI-DIAGONAL MATRIX SOLVER IS DSOLVER AND IS DOUBLE PRECISION SO MANY |
---|
| 228 | C VARIABLES ARE PASSED AS SINGLE THEN BECOME DOUBLE IN DSOLVER |
---|
| 229 | |
---|
| 230 | C THIS VERSION HAS BEEN MODIFIED BY TRAN THE TRUNG WITH: |
---|
| 231 | C 1. Simplified input & output for swr.F subroutine in LMDZ.MARS gcm model |
---|
| 232 | C 2. Use delta function to modify optical properties |
---|
| 233 | C 3. Use delta-eddington G1, G2, G3 parameters |
---|
| 234 | C 4. Optimized for speed |
---|
| 235 | |
---|
| 236 | C INPUTS: |
---|
| 237 | INTEGER NAYER |
---|
| 238 | c NAYER = number of layer |
---|
| 239 | c first layer is at top |
---|
| 240 | c last layer is at bottom |
---|
| 241 | REAL*8 DTDEL(NAYER), WDEL(NAYER), CDEL(NAYER) |
---|
| 242 | c DTDEL = optical thickness of layer |
---|
| 243 | c WDEL = single scattering of layer |
---|
| 244 | c CDEL = assymetry parameter |
---|
| 245 | REAL*8 UBAR0, RSF |
---|
| 246 | c UBAR0 = absolute value of cosine of solar zenith angle |
---|
| 247 | c RSF = surface albedo |
---|
| 248 | C OUTPUTS: |
---|
| 249 | REAL*8 FP(NAYER+1), FM(NAYER+1) |
---|
| 250 | c FP = flux up |
---|
| 251 | c FM = flux down |
---|
| 252 | C PRIVATES: |
---|
| 253 | INTEGER J,NL,NLEV |
---|
| 254 | !!!! AS+JBM 03/2010 BUG BUG si trop niveaux verticaux (LES) |
---|
| 255 | !!!! ET PAS BESOIN DE HARDWIRE SALE ICI ! |
---|
| 256 | !!!! CORRIGER CE BUG AMELIORE EFFICACITE ET FLEXIBILITE |
---|
| 257 | !! PARAMETER (NL=201) |
---|
| 258 | !! C THIS VALUE (201) MUST BE .GE. 2*NAYER |
---|
| 259 | REAL*8 BSURF,AP,AM,DENOM,EM,EP,G4 |
---|
| 260 | !! REAL*8 W0(NL), COSBAR(NL), DTAU(NL), TAU(NL) |
---|
| 261 | !! REAL*8 LAMDA(NL),XK1(NL),XK2(NL) |
---|
| 262 | !! REAL*8 G1(NL),G2(NL),G3(NL) |
---|
| 263 | !! REAL*8 GAMA(NL),CP(NL),CM(NL),CPM1(NL),CMM1(NL) |
---|
| 264 | !! REAL*8 E1(NL),E2(NL),E3(NL),E4(NL) |
---|
| 265 | REAL*8 W0(2*NAYER), COSBAR(2*NAYER), DTAU(2*NAYER), TAU(2*NAYER) |
---|
| 266 | REAL*8 LAMDA(2*NAYER),XK1(2*NAYER),XK2(2*NAYER) |
---|
| 267 | REAL*8 G1(2*NAYER),G2(2*NAYER),G3(2*NAYER) |
---|
| 268 | REAL*8 GAMA(2*NAYER),CP(2*NAYER),CM(2*NAYER),CPM1(2*NAYER) |
---|
| 269 | REAL*8 CMM1(2*NAYER) |
---|
| 270 | REAL*8 E1(2*NAYER),E2(2*NAYER),E3(2*NAYER),E4(2*NAYER) |
---|
| 271 | |
---|
| 272 | NL = 2*NAYER !!! AS+JBM 03/2010 |
---|
| 273 | NLEV = NAYER+1 |
---|
| 274 | |
---|
| 275 | C TURN ON THE DELTA-FUNCTION IF REQUIRED HERE |
---|
| 276 | c TAU(1) = 0.0 |
---|
| 277 | c DO J=1,NAYER |
---|
| 278 | c W0(J)=WDEL(J) |
---|
| 279 | c COSBAR(J)=CDEL(J) |
---|
| 280 | c DTAU(J)=DTDEL(J) |
---|
| 281 | c TAU(J+1)=TAU(J)+DTAU(J) |
---|
| 282 | c END DO |
---|
| 283 | C FOR THE DELTA FUNCTION HERE... |
---|
| 284 | TAU(1) = 0.0 |
---|
| 285 | DO J=1,NAYER |
---|
| 286 | COSBAR(J)=CDEL(J)/(1.+CDEL(J)) |
---|
| 287 | W0(J)=1.-WDEL(J)*CDEL(J)**2 |
---|
| 288 | DTAU(J)=DTDEL(J)*W0(J) |
---|
| 289 | W0(J)=WDEL(J)*(1.-CDEL(J)**2)/W0(J) |
---|
| 290 | TAU(J+1)=TAU(J)+DTAU(J) |
---|
| 291 | END DO |
---|
| 292 | |
---|
| 293 | c Optimization, this is the major speed gain |
---|
| 294 | TAU(1) = 1.0 |
---|
| 295 | do J = 2, NAYER+1 |
---|
| 296 | TAU(J) = EXP(-TAU(J)/UBAR0) |
---|
| 297 | end do |
---|
| 298 | BSURF = RSF*UBAR0*TAU(NLEV) |
---|
| 299 | C WE GO WITH THE HEMISPHERIC CONSTANT APPROACH |
---|
| 300 | C AS DEFINED BY M&W - THIS IS THE WAY THE IR IS DONE |
---|
| 301 | DO J=1,NAYER |
---|
| 302 | c Optimization: ALPHA not used |
---|
| 303 | c ALPHA(J)=SQRT( (1.-W0(J))/(1.-W0(J)*COSBAR(J)) ) |
---|
| 304 | C SET OF CONSTANTS DETERMINED BY DOM |
---|
| 305 | c G1(J)= (SQRT(3.)*0.5)*(2. - W0(J)*(1.+COSBAR(J))) |
---|
| 306 | c G2(J)= (SQRT(3.)*W0(J)*0.5)*(1.-COSBAR(J)) |
---|
| 307 | c G3(J)=0.5*(1.-SQRT(3.)*COSBAR(J)*UBAR0) |
---|
| 308 | c We use delta-Eddington instead |
---|
| 309 | G1(J)=0.25*(7.-W0(j)*(4.+3*cosbar(j))) |
---|
| 310 | G2(J)=-0.25*(1.-W0(j)*(4.-3*cosbar(j))) |
---|
| 311 | G3(J)=0.5*(1.-SQRT(3.)*COSBAR(J)*UBAR0) |
---|
| 312 | LAMDA(J)=SQRT(G1(J)**2 - G2(J)**2) |
---|
| 313 | GAMA(J)=(G1(J)-LAMDA(J))/G2(J) |
---|
| 314 | END DO |
---|
| 315 | |
---|
| 316 | DO J=1,NAYER |
---|
| 317 | G4=1.-G3(J) |
---|
| 318 | DENOM=LAMDA(J)**2 - 1./UBAR0**2 |
---|
| 319 | C NOTE THAT THE ALGORITHM DONOT ACCEPT UBAR0 .eq. 0 |
---|
| 320 | C THERE IS A POTENTIAL PROBLEM HERE IF W0=0 AND UBARV=UBAR0 |
---|
| 321 | C THEN DENOM WILL VANISH. THIS ONLY HAPPENS PHYSICALLY WHEN |
---|
| 322 | C THE SCATTERING GOES TO ZERO |
---|
| 323 | C PREVENT THIS WITH AN IF STATEMENT |
---|
| 324 | IF ( DENOM .EQ. 0.) THEN |
---|
| 325 | DENOM=1.E-6 |
---|
| 326 | END IF |
---|
| 327 | DENOM = W0(J)/DENOM |
---|
| 328 | AM=DENOM*(G4 *(G1(J)+1./UBAR0) +G2(J)*G3(J) ) |
---|
| 329 | AP=DENOM*(G3(J)*(G1(J)-1./UBAR0) +G2(J)*G4 ) |
---|
| 330 | C CPM1 AND CMM1 ARE THE CPLUS AND CMINUS TERMS EVALUATED |
---|
| 331 | C AT THE TOP OF THE LAYER, THAT IS LOWER OPTICAL DEPTH TAU(J) |
---|
| 332 | CPM1(J)=AP*TAU(J) |
---|
| 333 | CMM1(J)=AM*TAU(J) |
---|
| 334 | C CP AND CM ARE THE CPLUS AND CMINUS TERMS EVALUATED AT THE |
---|
| 335 | C BOTTOM OF THE LAYER. THAT IS AT HIGHER OPTICAL DEPTH TAU(J+1) |
---|
| 336 | CP(J)=AP*TAU(J+1) |
---|
| 337 | CM(J)=AM*TAU(J+1) |
---|
| 338 | END DO |
---|
| 339 | |
---|
| 340 | C NOW CALCULATE THE EXPONENTIAL TERMS NEEDED |
---|
| 341 | C FOR THE TRIDIAGONAL ROTATED LAYERED METHOD |
---|
| 342 | C WARNING IF DTAU(J) IS GREATER THAN ABOUT 35 |
---|
| 343 | C WE CLIPP IT TO AVOID OVERFLOW. |
---|
| 344 | C EXP (TAU) - EXP(-TAU) WILL BE NONSENSE THIS IS |
---|
| 345 | C CORRECTED IN THE DSOLVER ROUTINE. ??FLAG? |
---|
| 346 | DO J=1,NAYER |
---|
| 347 | c EXPTRM(J) = MIN(35.,LAMDA(J)*DTAU(J)) |
---|
| 348 | EP=EXP(MIN(35.0_8,LAMDA(J)*DTAU(J))) |
---|
| 349 | EM=1.0/EP |
---|
| 350 | AM = GAMA(J)*EM |
---|
| 351 | E1(J)=EP+AM |
---|
| 352 | E2(J)=EP-AM |
---|
| 353 | AP = GAMA(J)*EP |
---|
| 354 | E3(J)=AP+EM |
---|
| 355 | E4(J)=AP-EM |
---|
| 356 | END DO |
---|
| 357 | |
---|
| 358 | CALL DSOLVER(NAYER,GAMA,CP,CM,CPM1,CMM1 |
---|
| 359 | & ,E1,E2,E3,E4,0.0_8,BSURF,RSF,XK1,XK2) |
---|
| 360 | |
---|
| 361 | C EVALUATE THE NAYER FLUXES THROUGH THE NAYER LAYERS |
---|
| 362 | C USE THE TOP (TAU=0) OPTICAL DEPTH EXPRESSIONS TO EVALUATE FP AND FM |
---|
| 363 | C AT THE THE TOP OF EACH LAYER,J = LEVEL J |
---|
| 364 | DO J=1,NAYER |
---|
| 365 | FP(J)= XK1(J) + GAMA(J)*XK2(J) + CPM1(J) |
---|
| 366 | FM(J)= GAMA(J)*XK1(J) + XK2(J) + CMM1(J) |
---|
| 367 | END DO |
---|
| 368 | |
---|
| 369 | C USE EXPRESSION FOR BOTTOM FLUX TO GET THE FP AND FM AT NLEV |
---|
| 370 | c Optimization: no need this step since result of last |
---|
| 371 | c loop at about EP above give this |
---|
| 372 | c EP=EXP(EXPTRM(NAYER)) |
---|
| 373 | c EM=1.0/EP |
---|
| 374 | FP(NLEV)=XK1(NAYER)*EP + XK2(NAYER)*AM + CP(NAYER) |
---|
| 375 | FM(NLEV)=XK1(NAYER)*AP + XK2(NAYER)*EM + CM(NAYER) |
---|
| 376 | |
---|
| 377 | C ADD THE DIRECT FLUX TERM TO THE DOWNWELLING RADIATION, LIOU 182 |
---|
| 378 | DO J=1,NLEV |
---|
| 379 | FM(J)=FM(J)+UBAR0*TAU(J) |
---|
| 380 | END DO |
---|
| 381 | |
---|
| 382 | RETURN |
---|
| 383 | END |
---|
| 384 | |
---|
| 385 | CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC |
---|
| 386 | |
---|
| 387 | SUBROUTINE DSOLVER(NL,GAMA,CP,CM,CPM1,CMM1,E1,E2,E3,E4,BTOP, |
---|
| 388 | * BSURF,RSF,XK1,XK2) |
---|
| 389 | |
---|
| 390 | C DOUBLE PRECISION VERSION OF SOLVER |
---|
| 391 | |
---|
| 392 | cc PARAMETER (NMAX=201) |
---|
| 393 | cc AS+JBM 03/2010 |
---|
| 394 | IMPLICIT REAL*8 (A-H,O-Z) |
---|
| 395 | DIMENSION GAMA(NL),CP(NL),CM(NL),CPM1(NL),CMM1(NL),XK1(NL), |
---|
| 396 | * XK2(NL),E1(NL),E2(NL),E3(NL),E4(NL) |
---|
| 397 | cc AS+JBM 03/2010 |
---|
| 398 | cc DIMENSION AF(NMAX),BF(NMAX),CF(NMAX),DF(NMAX),XK(NMAX) |
---|
| 399 | DIMENSION AF(2*NL),BF(2*NL),CF(2*NL),DF(2*NL),XK(2*NL) |
---|
| 400 | |
---|
| 401 | C********************************************************* |
---|
| 402 | C* THIS SUBROUTINE SOLVES FOR THE COEFFICIENTS OF THE * |
---|
| 403 | C* TWO STREAM SOLUTION FOR GENERAL BOUNDARY CONDITIONS * |
---|
| 404 | C* NO ASSUMPTION OF THE DEPENDENCE ON OPTICAL DEPTH OF * |
---|
| 405 | C* C-PLUS OR C-MINUS HAS BEEN MADE. * |
---|
| 406 | C* NL = NUMBER OF LAYERS IN THE MODEL * |
---|
| 407 | C* CP = C-PLUS EVALUATED AT TAO=0 (TOP) * |
---|
| 408 | C* CM = C-MINUS EVALUATED AT TAO=0 (TOP) * |
---|
| 409 | C* CPM1 = C-PLUS EVALUATED AT TAOSTAR (BOTTOM) * |
---|
| 410 | C* CMM1 = C-MINUS EVALUATED AT TAOSTAR (BOTTOM) * |
---|
| 411 | C* EP = EXP(LAMDA*DTAU) * |
---|
| 412 | C* EM = 1/EP * |
---|
| 413 | C* E1 = EP + GAMA *EM * |
---|
| 414 | C* E2 = EP - GAMA *EM * |
---|
| 415 | C* E3 = GAMA*EP + EM * |
---|
| 416 | C* E4 = GAMA*EP - EM * |
---|
| 417 | C* BTOP = THE DIFFUSE RADIATION INTO THE MODEL AT TOP * |
---|
| 418 | C* BSURF = THE DIFFUSE RADIATION INTO THE MODEL AT * |
---|
| 419 | C* THE BOTTOM: INCLUDES EMMISION AND REFLECTION * |
---|
| 420 | C* OF THE UNATTENUATED PORTION OF THE DIRECT * |
---|
| 421 | C* BEAM. BSTAR+RSF*FO*EXP(-TAOSTAR/U0) * |
---|
| 422 | C* RSF = REFLECTIVITY OF THE SURFACE * |
---|
| 423 | C* XK1 = COEFFICIENT OF THE POSITIVE EXP TERM * |
---|
| 424 | C* XK2 = COEFFICIENT OF THE NEGATIVE EXP TERM * |
---|
| 425 | C********************************************************* |
---|
| 426 | C THIS ROUTINE CALLS ROUTINE DTRIDGL TO SOLVE TRIDIAGONAL |
---|
| 427 | C SYSTEMS |
---|
| 428 | C======================================================================C |
---|
| 429 | |
---|
| 430 | L=2*NL |
---|
| 431 | |
---|
| 432 | C ************MIXED COEFFICENTS********** |
---|
| 433 | C THIS VERSION AVOIDS SINGULARITIES ASSOC. |
---|
| 434 | C WITH W0=0 BY SOLVING FOR XK1+XK2, AND XK1-XK2. |
---|
| 435 | |
---|
| 436 | AF(1) = 0.0 |
---|
| 437 | BF(1) = GAMA(1)+1. |
---|
| 438 | CF(1) = GAMA(1)-1. |
---|
| 439 | DF(1) = BTOP-CMM1(1) |
---|
| 440 | N = 0 |
---|
| 441 | LM2 = L-2 |
---|
| 442 | |
---|
| 443 | C EVEN TERMS |
---|
| 444 | |
---|
| 445 | DO I=2,LM2,2 |
---|
| 446 | N = N+1 |
---|
| 447 | AF(I) = (E1(N)+E3(N))*(GAMA(N+1)-1.) |
---|
| 448 | BF(I) = (E2(N)+E4(N))*(GAMA(N+1)-1.) |
---|
| 449 | CF(I) = 2.0*(1.-GAMA(N+1)**2) |
---|
| 450 | DF(I) = (GAMA(N+1)-1.) * (CPM1(N+1) - CP(N)) + |
---|
| 451 | * (1.-GAMA(N+1))* (CM(N)-CMM1(N+1)) |
---|
| 452 | END DO |
---|
| 453 | |
---|
| 454 | N = 0 |
---|
| 455 | LM1 = L-1 |
---|
| 456 | DO I=3,LM1,2 |
---|
| 457 | N = N+1 |
---|
| 458 | AF(I) = 2.0*(1.-GAMA(N)**2) |
---|
| 459 | BF(I) = (E1(N)-E3(N))*(1.+GAMA(N+1)) |
---|
| 460 | CF(I) = (E1(N)+E3(N))*(GAMA(N+1)-1.) |
---|
| 461 | DF(I) = E3(N)*(CPM1(N+1) - CP(N)) + E1(N)*(CM(N) - CMM1(N+1)) |
---|
| 462 | END DO |
---|
| 463 | |
---|
| 464 | AF(L) = E1(NL)-RSF*E3(NL) |
---|
| 465 | BF(L) = E2(NL)-RSF*E4(NL) |
---|
| 466 | CF(L) = 0.0 |
---|
| 467 | DF(L) = BSURF-CP(NL)+RSF*CM(NL) |
---|
| 468 | |
---|
| 469 | CALL DTRIDGL(L,AF,BF,CF,DF,XK) |
---|
| 470 | |
---|
| 471 | C ***UNMIX THE COEFFICIENTS**** |
---|
| 472 | |
---|
| 473 | DO 28 N=1,NL |
---|
| 474 | XK1(N) = XK(2*N-1)+XK(2*N) |
---|
| 475 | XK2(N) = XK(2*N-1)-XK(2*N) |
---|
| 476 | |
---|
| 477 | C NOW TEST TO SEE IF XK2 IS REALLY ZERO TO THE LIMIT OF THE |
---|
| 478 | C MACHINE ACCURACY = 1 .E -30 |
---|
| 479 | C XK2 IS THE COEFFICIENT OF THE GROWING EXPONENTIAL AND MUST |
---|
| 480 | C BE TREATED CAREFULLY |
---|
| 481 | |
---|
| 482 | IF(XK2(N) .EQ. 0.0) GO TO 28 |
---|
| 483 | IF (ABS (XK2(N)/XK(2*N-1)) .LT. 1.E-30) XK2(N)=0.0 |
---|
| 484 | |
---|
| 485 | 28 CONTINUE |
---|
| 486 | |
---|
| 487 | RETURN |
---|
| 488 | END |
---|
| 489 | |
---|
| 490 | CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC |
---|
| 491 | |
---|
| 492 | SUBROUTINE DTRIDGL(L,AF,BF,CF,DF,XK) |
---|
| 493 | |
---|
| 494 | C DOUBLE PRECISION VERSION OF TRIDGL |
---|
| 495 | |
---|
| 496 | cc AS+JBM 03/2010 : OBSOLETE MAINTENANT |
---|
| 497 | cc PARAMETER (NMAX=201) |
---|
| 498 | IMPLICIT REAL*8 (A-H,O-Z) |
---|
| 499 | DIMENSION AF(L),BF(L),CF(L),DF(L),XK(L) |
---|
| 500 | cc AS+JBM 03/2010 : OBSOLETE MAINTENANT |
---|
| 501 | cc DIMENSION AS(NMAX),DS(NMAX) |
---|
| 502 | DIMENSION AS(L),DS(L) |
---|
| 503 | |
---|
| 504 | C* THIS SUBROUTINE SOLVES A SYSTEM OF TRIDIAGIONAL MATRIX |
---|
| 505 | C* EQUATIONS. THE FORM OF THE EQUATIONS ARE: |
---|
| 506 | C* A(I)*X(I-1) + B(I)*X(I) + C(I)*X(I+1) = D(I) |
---|
| 507 | C* WHERE I=1,L LESS THAN 103. |
---|
| 508 | C* ..............REVIEWED -CP........ |
---|
| 509 | |
---|
| 510 | C======================================================================C |
---|
| 511 | |
---|
| 512 | AS(L) = AF(L)/BF(L) |
---|
| 513 | DS(L) = DF(L)/BF(L) |
---|
| 514 | |
---|
| 515 | DO I=2,L |
---|
| 516 | X = 1./(BF(L+1-I) - CF(L+1-I)*AS(L+2-I)) |
---|
| 517 | AS(L+1-I) = AF(L+1-I)*X |
---|
| 518 | DS(L+1-I) = (DF(L+1-I)-CF(L+1-I)*DS(L+2-I))*X |
---|
| 519 | END DO |
---|
| 520 | |
---|
| 521 | XK(1)=DS(1) |
---|
| 522 | DO I=2,L |
---|
| 523 | XK(I) = DS(I)-AS(I)*XK(I-1) |
---|
| 524 | END DO |
---|
| 525 | |
---|
| 526 | RETURN |
---|
| 527 | END |
---|
| 528 | |
---|