Back to home page

darwin3

 
 

    


File indexing completed on 2024-12-17 18:37:25 UTC

view on githubraw file Latest commit 87dd4f7d on 2024-01-17 18:17:24 UTC
87dd4f7d5f Oliv*0001 #include "OASIM_OPTIONS.h"
                0002 
                0003 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
                0004 CBOP
                0005 C     !ROUTINE: OASIM_LIGHT
                0006 
                0007 C     !INTERFACE:
                0008       SUBROUTINE OASIM_LIGHT(
                0009      I sunz,cosunz,daycor,pres,ws,ozone,wvapor,relhum,
                0010      I ta,wa,asym,cov,clwp,re,
                0011      O Ed,Es,Edclr,Esclr,Edcld,Escld,
                0012      I myThid)
                0013 
                0014 C     !DESCRIPTION:
                0015 C     calls clrtrans.F to get cloud-free transmittance and slingo.F to
                0016 C     get cloudy transmittance, then computes total irradiance in
                0017 C     W/m2/(variable)nm weighted by the cloudiness.
                0018 
                0019 C     !USES:
                0020       IMPLICIT NONE
                0021 #include "SIZE.h"
                0022 #include "OASIM_SIZE.h"
                0023 #include "OASIM_INTERNAL.h"
                0024 #include "OASIM_SLINGO.h"
                0025 
                0026 C     !INPUT PARAMETERS:
                0027       _RL ta(nlt),wa(nlt),asym(nlt)
                0028       _RL sunz,cosunz,daycor,pres,ws,ozone,wvapor,relhum
                0029       _RL cov,clwp,re
                0030       INTEGER myThid
                0031 
                0032 C     !OUTPUT PARAMETERS:
                0033       _RL Ed(nlt),Es(nlt)
                0034       _RL Edclr(nlt),Esclr(nlt)
                0035       _RL Edcld(nlt),Escld(nlt)
                0036 CEOP
                0037 
                0038 #ifdef ALLOW_OASIM
                0039 
                0040 C     !LOCAL VARIABLES:
                0041 c     Tdclr :: spectral clear sky direct transmittance
                0042 c     Tsclr :: spectral clear sky diffuse transmittance
                0043 c     Tdcld :: spectral cloudy direct transmittance
                0044 c     Tscld :: spectral cloudy diffuse transmittance
                0045       INTEGER l
                0046       _RL ag, ccov1, edir, edif, garg, foinc, gtmp, gtmp2, oarg
                0047       _RL otmp, rm, rmp, rmo, rmu0, rtmp, to
                0048       _RL warg, wtmp, wtmp2
                0049       _RL Tgas(nlt)
                0050       _RL Tdclr(nlt),Tsclr(nlt)
                0051       _RL Tdcld(ncld),Tscld(ncld)
                0052 c
                0053       IF (pres .LT. 0.0 _d 0 .OR. ws .LT. 0.0 _d 0 .OR.
                0054      &    relhum .LT. 0.0 _d 0 .OR.
                0055      &    ozone .LT. 0.0 _d 0 .OR. wvapor .LT. 0.0 _d 0) THEN
                0056        DO l = 1,nlt
                0057         Ed(l) = 0.0 _d 0
                0058         Es(l) = 0.0 _d 0
                0059         Edclr(l) = 0.0 _d 0
                0060         Esclr(l) = 0.0 _d 0
                0061         Edcld(l) = 0.0 _d 0
                0062         Escld(l) = 0.0 _d 0
                0063        ENDDO
                0064        RETURN
                0065       ENDIF
                0066 c
                0067 c  Compute atmospheric path lengths (air mass); not pressure-corrected
                0068       rtmp = (93.885 _d 0-sunz)**(-1.253 _d 0)
                0069       rmu0 = cosunz+0.15 _d 0*rtmp
                0070       rm = 1.0 _d 0/rmu0
                0071       otmp = (cosunz*cosunz+ozfac1)**0.5 _d 0
                0072       rmo = ozfac2/otmp
                0073 c
                0074 c  Compute pressure-corrected atmospheric path length (air mass)
                0075       rmp = pres/p0*rm
                0076 c
                0077 c  Loop to compute total irradiances at each grid point
                0078 c   Compute direct and diffuse irradiance for a cloudy and non-cloudy
                0079 c   atmosphere
                0080 c   Account for gaseous absorption
                0081       DO l = 1,nlt
                0082 c    Ozone
                0083        to = oza(l)*ozone*0.001 _d 0   !optical thickness
                0084        oarg = -to*rmo
                0085 c   Oxygen/gases
                0086        ag = ao(l) + aco2(l)
                0087        gtmp = (1.0 _d 0 + 118.3 _d 0*ag*rmp)**0.45 _d 0
                0088        gtmp2 = -1.41 _d 0*ag*rmp
                0089        garg = gtmp2/gtmp
                0090 c   Water Vapor
                0091        wtmp = (1.0 _d 0+20.07 _d 0*awv(l)*wvapor*rm)**0.45 _d 0
                0092        wtmp2 = -0.2385 _d 0*awv(l)*wvapor*rm
                0093        warg = wtmp2/wtmp
                0094        Tgas(l) = EXP(oarg+garg+warg)
                0095       enddo
                0096 c
                0097 c  Compute clear sky transmittances
                0098       CALL OASIM_CLRTRANS(
                0099      I              cosunz,rm,rmp,ta,wa,asym,
                0100      O              Tdclr,Tsclr,
                0101      I              myThid)
                0102       DO l = 1,nlt
                0103        Foinc = Fobar(l)*daycor*cosunz
                0104 c    Direct irradiance
                0105        Edir = Foinc*Tgas(l)*Tdclr(l)
                0106 c    Diffuse irradiance
                0107        Edif = Foinc*Tgas(l)*Tsclr(l)
                0108 c    Spectral components
                0109        Edclr(l) = Edir
                0110        Esclr(l) = Edif
                0111       ENDDO    !end clear l loop
                0112 c  Compute cloudy transmittances
                0113       CALL OASIM_SLINGO(rmu0,clwp,re,
                0114      O                  Tdcld,Tscld,
                0115      I                  myThid)
                0116       DO l = 1,nlt
                0117        Foinc = Fobar(l)*daycor*cosunz
                0118 c    Direct irradiance
                0119        Edir = Foinc*Tgas(l)*Tdcld(ica(l))
                0120 c    Diffuse irradiance
                0121        Edif = Foinc*Tgas(l)*Tscld(ica(l))
                0122 c    Spectral components
                0123        Edcld(l) = Edir
                0124        Escld(l) = Edif
                0125       ENDDO   !end cloudy l loop
                0126 c
                0127 c  Sum clear and cloudy by percent
                0128       ccov1 = cov*0.01 _d 0  !convert from percent to fraction
                0129       DO l = 1,nlt
                0130        Ed(l) = (1.0 _d 0-ccov1)*Edclr(l) + ccov1*Edcld(l)
                0131        Es(l) = (1.0 _d 0-ccov1)*Esclr(l) + ccov1*Escld(l)
                0132       ENDDO
                0133 c
                0134 c   Total short-wave (W/m2)
                0135 c       sirrsw = sirrsw + Edir + Edif
                0136 
                0137 #endif /* ALLOW_OASIM */
                0138 
                0139       RETURN
                0140       END