Ignore:
Timestamp:
Aug 20, 2024, 12:12:40 PM (3 months ago)
Author:
afalco
Message:

Pluto PCM:
Take into account zeros in aerosol optical properties.
AF

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.PLUTO/libf/phypluto/gfluxv.F

    r3184 r3409  
    11      module gfluxv_mod
    2      
     2
    33      implicit none
    4      
     4
    55      contains
    6      
     6
    77      SUBROUTINE GFLUXV(DTDEL,TDEL,TAUCUMIN,WDEL,CDEL,UBAR0,F0PI,RSF,
    88     *                  BTOP,BSURF,FMIDP,FMIDM,DIFFV,FLUXUP,FLUXDN)
     
    1212C  FOR THE VISIBLE  FLUX AT ONE WAVELENGTH AND SOLVES FOR THE FLUXES AT
    1313C  THE LEVELS. THIS VERSION IS SET UP TO WORK WITH LAYER OPTICAL DEPTHS
    14 C  MEASURED FROM THE TOP OF EACH LAYER.  (DTAU) TOP OF EACH LAYER HAS 
     14C  MEASURED FROM THE TOP OF EACH LAYER.  (DTAU) TOP OF EACH LAYER HAS
    1515C  OPTICAL DEPTH TAU(N).IN THIS SUB LEVEL N IS ABOVE LAYER N. THAT IS LAYER N
    1616C  HAS LEVEL N ON TOP AND LEVEL N+1 ON BOTTOM. OPTICAL DEPTH INCREASES
    1717C  FROM TOP TO BOTTOM. SEE C.P. MCKAY, TGM NOTES.
    18 C THIS SUBROUTINE DIFFERS FROM ITS IR COUNTERPART IN THAT HERE WE SOLVE FOR 
     18C THIS SUBROUTINE DIFFERS FROM ITS IR COUNTERPART IN THAT HERE WE SOLVE FOR
    1919C THE FLUXES DIRECTLY USING THE GENERALIZED NOTATION OF MEADOR AND WEAVOR
    2020C J.A.S., 37, 630-642, 1980.
    21 C THE TRI-DIAGONAL MATRIX SOLVER IS DSOLVER AND IS DOUBLE PRECISION SO MANY 
     21C THE TRI-DIAGONAL MATRIX SOLVER IS DSOLVER AND IS DOUBLE PRECISION SO MANY
    2222C VARIABLES ARE PASSED AS SINGLE THEN BECOME DOUBLE IN DSOLVER
    2323C
     
    2929C WDEL(NLEVEL)  = SINGLE SCATTERING ALBEDO
    3030C CDEL(NLL)     = ASYMMETRY FACTORS, 0=ISOTROPIC
    31 C UBARV         = AVERAGE ANGLE, 
     31C UBARV         = AVERAGE ANGLE,
    3232C UBAR0         = SOLAR ZENITH ANGLE
    3333C F0PI          = INCIDENT SOLAR DIRECT BEAM FLUX
     
    4141C added Dec 2002
    4242C DIFFV         = downward diffuse solar flux at the surface
    43 C 
     43C
    4444!======================================================================!
    4545
     
    7676      NAYER  = L_NLAYRAD
    7777      TAUMAX = L_TAUMAX    !Default is 35.0
    78      
     78
    7979!  Delta-Eddington Scaling
    8080
     
    9191        FACTOR      = 1.0D0 - WDEL(L)*CDEL(L)**2
    9292        W0(L)       = WDEL(L)*(1.0D0-CDEL(L)**2)/FACTOR
     93        IF (W0(L).gt.1) THEN
     94            W0(L) = 1
     95        END IF
    9396        COSBAR(L)   = CDEL(L)/(1.0D0+CDEL(L))
    9497
     
    105108      FACTOR        = 1.0D0 - WDEL(L)*CDEL(L)**2
    106109      W0(L)         = WDEL(L)*(1.0D0-CDEL(L)**2)/FACTOR
     110      IF (W0(L).gt.1) THEN
     111          W0(L) = 1
     112      END IF
    107113      COSBAR(L)     = CDEL(L)/(1.0D0+CDEL(L))
    108114      DTAU(L)       = DTDEL(L)*FACTOR
     
    123129        ALPHA(L)=SQRT( (1.0-W0(L))/(1.0-W0(L)*COSBAR(L) ) )
    124130
    125 C       SET OF CONSTANTS DETERMINED BY DOM 
     131C       SET OF CONSTANTS DETERMINED BY DOM
    126132
    127133!     Quadrature method
     
    148154c     but the scaling is Eddington?
    149155
    150         LAMDA(L) = SQRT(G1(L)**2 - G2(L)**2)
     156        IF (G1(L) - G2(L) < 1E-15) THEN
     157            LAMDA(L) = 0
     158        ELSE
     159            LAMDA(L) = SQRT(G1(L)**2 - G2(L)**2)
     160        END IF
    151161        GAMA(L)  = (G1(L)-LAMDA(L))/G2(L)
    152162      END DO
     
    156166        G4    = 1.0-G3(L)
    157167        DENOM = LAMDA(L)**2 - 1./UBAR0**2
    158  
     168
    159169C       THERE IS A POTENTIAL PROBLEM HERE IF W0=0 AND UBARV=UBAR0
    160 C       THEN DENOM WILL VANISH. THIS ONLY HAPPENS PHYSICALLY WHEN 
     170C       THEN DENOM WILL VANISH. THIS ONLY HAPPENS PHYSICALLY WHEN
    161171C       THE SCATTERING GOES TO ZERO
    162172C       PREVENT THIS WITH AN IF STATEMENT
     
    172182C       CPM1 AND CMM1 ARE THE CPLUS AND CMINUS TERMS EVALUATED
    173183C       AT THE TOP OF THE LAYER, THAT IS LOWER   OPTICAL DEPTH TAU(L)
    174  
     184
    175185        CPM1(L) = AP*EXP(-TAU(L)/UBAR0)
    176186        CMM1(L) = AM*EXP(-TAU(L)/UBAR0)
     
    185195
    186196
    187  
     197
    188198C     NOW CALCULATE THE EXPONENTIAL TERMS NEEDED
    189199C     FOR THE TRIDIAGONAL ROTATED LAYERED METHOD
     
    204214
    205215C     NOW WE CALCULATE THE FLUXES AT THE MIDPOINTS OF THE LAYERS.
    206  
     216
    207217      DO L=1,L_NLAYRAD-1
    208218        EXPTRM = MIN(TAUMAX,LAMDA(L)*(TAUCUM(2*L+1)-TAUCUM(2*L)))
    209  
     219
    210220        EP = EXP(EXPTRM)
    211221
     
    215225
    216226C       THERE IS A POTENTIAL PROBLEM HERE IF W0=0 AND UBARV=UBAR0
    217 C       THEN DENOM WILL VANISH. THIS ONLY HAPPENS PHYSICALLY WHEN 
     227C       THEN DENOM WILL VANISH. THIS ONLY HAPPENS PHYSICALLY WHEN
    218228C       THE SCATTERING GOES TO ZERO
    219229C       PREVENT THIS WITH A IF STATEMENT
     
    237247        FMIDP(L) = XK1(L)*EP + GAMA(L)*XK2(L)*EM + CPMID
    238248        FMIDM(L) = XK1(L)*EP*GAMA(L) + XK2(L)*EM + CMMID
    239  
     249
    240250C       ADD THE DIRECT FLUX TO THE DOWNWELLING TERM
    241251
    242252        FMIDM(L)= FMIDM(L)+UBAR0*F0PI*EXP(-MIN(TAUMID,TAUMAX)/UBAR0)
    243    
    244       END DO
    245  
     253
     254      END DO
     255
    246256C     FLUX AT THE Ptop layer
    247257
     
    256266
    257267C     THERE IS A POTENTIAL PROBLEM HERE IF W0=0 AND UBARV=UBAR0
    258 C     THEN DENOM WILL VANISH. THIS ONLY HAPPENS PHYSICALLY WHEN 
     268C     THEN DENOM WILL VANISH. THIS ONLY HAPPENS PHYSICALLY WHEN
    259269C     THE SCATTERING GOES TO ZERO
    260270C     PREVENT THIS WITH A IF STATEMENT
     
    284294!      fluxdn = fluxdn+UBAR0*F0PI*EXP(-MIN(TAUCUM(1),TAUMAX)/UBAR0)
    285295!JL18 the line above assumed that the top of the radiative model was P=0
    286 !   it seems to be better for the IR to use the middle of the last physical layer as the radiative top. 
     296!   it seems to be better for the IR to use the middle of the last physical layer as the radiative top.
    287297!   so we correct the downwelling flux below for the calculation of the heating rate
    288298      fluxdn = fluxdn+UBAR0*F0PI*EXP(-TAUCUM(2)/UBAR0)
     
    291301C     DTAU instead of DTAU/2.
    292302
    293       L     = L_NLAYRAD 
     303      L     = L_NLAYRAD
    294304      EXPTRM = MIN(TAUMAX,LAMDA(L)*(TAUCUM(L_LEVELS)-
    295305     *                                 TAUCUM(L_LEVELS-1)))
     
    302312
    303313C     THERE IS A POTENTIAL PROBLEM HERE IF W0=0 AND UBARV=UBAR0
    304 C     THEN DENOM WILL VANISH. THIS ONLY HAPPENS PHYSICALLY WHEN 
     314C     THEN DENOM WILL VANISH. THIS ONLY HAPPENS PHYSICALLY WHEN
    305315C     THE SCATTERING GOES TO ZERO
    306316C     PREVENT THIS WITH A IF STATEMENT
Note: See TracChangeset for help on using the changeset viewer.