Ignore:
Timestamp:
Aug 2, 2024, 2:12:03 PM (7 weeks ago)
Author:
abarral
Message:

Add missing klon on strataer_emiss_mod.F90
Correct various missing explicit declarations
Replace tabs by spaces (tabs are not part of the fortran charset)
Continue cleaning modules
Removed unused arguments and variables

File:
1 edited

Legend:

Unmodified
Added
Removed
  • LMDZ6/branches/Amaury_dev/libf/phylmd/cospv2/lidar_simulator.F90

    r5099 r5158  
    175175    ! PLANE PARRALLEL FIELDS
    176176    ! ####################################################################################
    177     do icol=1,ncolumns
     177    DO icol=1,ncolumns
    178178       ! #################################################################################
    179179       ! *) Total Backscatter signal
     
    200200    ! ####################################################################################
    201201    if (lphaseoptics) then
    202        do icol=1,ncolumns
     202       DO icol=1,ncolumns
    203203          ! #################################################################################
    204204          ! *) Ice/Liq Perpendicular Backscatter signal
     
    206206          ! Computation of ATBperp,ice/liq from ATBice/liq including the multiple scattering
    207207          ! contribution (Cesana and Chepfer 2013, JGR)
    208           do k=1,nlev
     208          DO k=1,nlev
    209209             ! Ice particles
    210210             pnorm_perp_ice(1:npoints,icol,k) = Alpha * pnorm_ice(1:npoints,icol,k)
     
    242242         
    243243          ! Other layers
    244           do k=2,nlev
     244          DO k=2,nlev
    245245             ! Optical thickness of layer k
    246246             tautot_lay(1:npoints) = tautot(1:npoints,icol,k)-tautot(1:npoints,icol,k-1)
     
    398398    ! Compute LIDAR scattering ratio
    399399    if (use_vgrid) then
    400        do ic = 1, ncol
     400       DO ic = 1, ncol
    401401          pnorm_c = pnormFlip(:,ic,:)
    402402          where ((pnorm_c .lt. xmax) .and. (betamolFlip(:,1,:) .lt. xmax) .and.          &
     
    427427       endif
    428428    else
    429        do ic = 1, ncol
     429       DO ic = 1, ncol
    430430          pnorm_c = pnorm(:,ic,:)
    431431          where ((pnorm_c.lt.xmax) .and. (pmol.lt.xmax) .and. (pmol.gt. 0.0 ))
     
    458458    if (ok_lidar_cfad) then
    459459       ! CFADs of subgrid-scale lidar scattering ratios
    460        do i=1,Npoints
    461           do j=1,llm
     460       DO i=1,Npoints
     461          DO j=1,llm
    462462             cfad2(i,:,j) = hist1D(ncol,x3d(i,:,j),SR_BINS,histBsct)
    463463          enddo
     
    499499
    500500    ! Other layers
    501     do k=2,nlev
     501    DO k=2,nlev
    502502       tautot_lay(:) = tau(:,k)-tau(:,k-1)
    503503       WHERE (tautot_lay(:) .gt. 0.)
     
    527527    epsrealwp = epsilon(1._wp)
    528528    beta(:,1) = pnorm(:,1) * (2._wp*tau(:,1))/(1._wp-exp(-2._wp*tau(:,1)))
    529     do k=2,nlev
     529    DO k=2,nlev
    530530       tautot_lay(:) = tau(:,k)-tau(:,k-1)       
    531531       WHERE ( EXP(-2._wp*tau(:,k-1)) .gt. epsrealwp )
     
    569569       zeta50    = -9.4776e-07_wp    !
    570570       
    571         ! Inputs
     571    ! Inputs
    572572    integer,intent(in) :: &
    573573       Npoints,  & ! Number of gridpoints
     
    576576       Ncat,     & ! Number of cloud layer types
    577577       Nphase      ! Number of cloud layer phase types
    578                        ! [ice,liquid,undefined,false ice,false liquid,Percent of ice]
     578                   ! [ice,liquid,undefined,false ice,false liquid,Percent of ice]
    579579    real(wp),intent(in) :: &
    580580       S_att,    & !
     
    590590       pplay       ! Pressure
    591591
    592         ! Outputs
     592    ! Outputs
    593593    real(wp),intent(out),dimension(Npoints,Ntemp,5) :: &
    594594       lidarcldtemp  ! 3D Temperature 1=tot,2=ice,3=liq,4=undef,5=ice/ice+liq
     
    625625             
    626626    ! ####################################################################################
    627         ! 1) Initialize   
     627    ! 1) Initialize
    628628    ! ####################################################################################
    629629    lidarcld              = 0._wp
     
    648648    ! 2) Cloud detection
    649649    ! ####################################################################################
    650     do k=1,Nlevels
     650    DO k=1,Nlevels
    651651       ! Cloud detection at subgrid-scale:
    652652       where ((x(:,:,k) .gt. S_cld) .and. (x(:,:,k) .ne. undef) )
     
    671671    cldlay   = 0._wp
    672672    nsublay  = 0._wp
    673     do k=1,Nlevels
    674        do ic = 1, Ncolumns
    675           do ip = 1, Npoints
     673    DO k=1,Nlevels
     674       DO ic = 1, Ncolumns
     675          DO ip = 1, Npoints
    676676         
    677677             ! Computation of the cloud fraction as a function of the temperature instead
    678678             ! of height, for ice,liquid and all clouds
    679679             if(srok(ip,ic,k).gt.0.)then
    680                 do itemp=1,Ntemp
     680                DO itemp=1,Ntemp
    681681                   if( (tmp(ip,k).ge.tempmod(itemp)).and.(tmp(ip,k).lt.tempmod(itemp+1)) )then
    682682                      lidarcldtempind(ip,itemp)=lidarcldtempind(ip,itemp)+1._wp
     
    686686             
    687687             if(cldy(ip,ic,k).eq.1.)then
    688                 do itemp=1,Ntemp
     688                DO itemp=1,Ntemp
    689689                   if( (tmp(ip,k) .ge. tempmod(itemp)).and.(tmp(ip,k) .lt. tempmod(itemp+1)) )then
    690690                      lidarcldtemp(ip,itemp,1)=lidarcldtemp(ip,itemp,1)+1._wp
     
    723723    cldlayer  = 0._wp
    724724    nsublayer = 0._wp
    725     do iz = 1, Ncat
    726        do ic = 1, Ncolumns
     725    DO iz = 1, Ncat
     726       DO ic = 1, Ncolumns
    727727          cldlayer(:,iz)  = cldlayer(:,iz)  + cldlay(:,ic,iz)
    728728          nsublayer(:,iz) = nsublayer(:,iz) + nsublay(:,ic,iz)
     
    742742    ! 4.1) For Cloudy pixels with 8.16km < z < 19.2km
    743743    ! ####################################################################################
    744     do ncol=1,Ncolumns
    745        do i=1,Npoints         
    746           do nlev=1,23 ! from 19.2km until 8.16km
     744    DO ncol=1,Ncolumns
     745       DO i=1,Npoints
     746          DO nlev=1,23 ! from 19.2km until 8.16km
    747747               p1 = pplay(1,nlev)
    748748
     
    856856          ! ##############################################################################
    857857          toplvlsat = 0
    858           do nlev=24,Nlevels! from 8.16km until 0km
     858          DO nlev=24,Nlevels! from 8.16km until 0km
    859859             p1 = pplay(i,nlev)
    860860
     
    979979          ! ##############################################################################
    980980          if(toplvlsat.ne.0) then
    981              do nlev = toplvlsat,Nlevels
     981             DO nlev = toplvlsat,Nlevels
    982982                p1 = pplay(i,nlev)
    983983                if(cldy(i,ncol,nlev).eq.1.)then
     
    10311031
    10321032    ! Compute Phase low mid high cloud fractions
    1033     do iz = 1, Ncat
    1034        do i=1,Nphase-3
    1035           do ic = 1, Ncolumns
     1033    DO iz = 1, Ncat
     1034       DO i=1,Nphase-3
     1035          DO ic = 1, Ncolumns
    10361036             cldlayerphase(:,iz,i)  = cldlayerphase(:,iz,i)  + cldlayphase(:,ic,iz,i)
    10371037             cldlayerphasesum(:,iz) = cldlayerphasesum(:,iz) + cldlayphase(:,ic,iz,i)
     
    10391039       enddo
    10401040    enddo
    1041     do iz = 1, Ncat
    1042        do i=4,5
    1043           do ic = 1, Ncolumns
     1041    DO iz = 1, Ncat
     1042       DO i=4,5
     1043          DO ic = 1, Ncolumns
    10441044             cldlayerphase(:,iz,i) = cldlayerphase(:,iz,i) + cldlayphase(:,ic,iz,i)
    10451045          enddo
     
    10551055    ENDWHERE
    10561056   
    1057     do i=1,Nphase-1
     1057    DO i=1,Nphase-1
    10581058       WHERE ( cldlayerphasesum(:,:).gt.0.0 )
    10591059          cldlayerphase(:,:,i) = (cldlayerphase(:,:,i)/cldlayerphasesum(:,:)) * cldlayer(:,:)
     
    10611061    enddo
    10621062   
    1063     do i=1,Npoints
    1064        do iz=1,Ncat
     1063    DO i=1,Npoints
     1064       DO iz=1,Ncat
    10651065          checkcldlayerphase=0.
    10661066          checkcldlayerphase2=0.
    10671067          if (cldlayerphasesum(i,iz) .gt. 0.0 )then
    1068              do ic=1,Nphase-3
     1068             DO ic=1,Nphase-3
    10691069                checkcldlayerphase = checkcldlayerphase+cldlayerphase(i,iz,ic)
    10701070             enddo
     
    10751075    enddo
    10761076   
    1077     do i=1,Nphase-1
     1077    DO i=1,Nphase-1
    10781078       WHERE (nsublayer(:,:) .eq. 0.0)
    10791079          cldlayerphase(:,:,i) = undef
     
    10821082 
    10831083    ! Compute Phase 3D as a function of temperature
    1084     do nlev=1,Nlevels
    1085        do ncol=1,Ncolumns
    1086           do i=1,Npoints
    1087              do itemp=1,Ntemp
     1084    DO nlev=1,Nlevels
     1085       DO ncol=1,Ncolumns
     1086          DO i=1,Npoints
     1087             DO itemp=1,Ntemp
    10881088                if(tmpi(i,ncol,nlev).gt.0.)then
    10891089                   if((tmpi(i,ncol,nlev) .ge. tempmod(itemp)) .and. (tmpi(i,ncol,nlev) .lt. tempmod(itemp+1)) )then
     
    11051105   
    11061106    ! Check temperature cloud fraction
    1107     do i=1,Npoints
    1108        do itemp=1,Ntemp
     1107    DO i=1,Npoints
     1108       DO itemp=1,Ntemp
    11091109          checktemp=lidarcldtemp(i,itemp,2)+lidarcldtemp(i,itemp,3)+lidarcldtemp(i,itemp,4)
    11101110          !if(checktemp .NE. lidarcldtemp(i,itemp,1))then
     
    11241124    ENDWHERE
    11251125   
    1126     do i=1,4
     1126    DO i=1,4
    11271127       WHERE(lidarcldtempind(:,:) .gt. 0.)
    11281128          lidarcldtemp(:,:,i) = lidarcldtemp(:,:,i)/lidarcldtempind(:,:)
     
    11911191    ! 2) Cloud detection
    11921192    ! ####################################################################################
    1193     do k=1,Nlevels
     1193    DO k=1,Nlevels
    11941194       ! Cloud detection at subgrid-scale:
    11951195       where ((x(:,:,k) .gt. S_cld) .and. (x(:,:,k) .ne. undef) )
     
    12101210    ! 3) Grid-box 3D cloud fraction and layered cloud fractions(ISCCP pressure categories)
    12111211    ! ####################################################################################
    1212     do k=1,Nlevels
    1213        do ic = 1, Ncolumns
    1214           do ip = 1, Npoints
     1212    DO k=1,Nlevels
     1213       DO ic = 1, Ncolumns
     1214          DO ip = 1, Npoints
    12151215
    12161216             iz=1
     
    12441244    cldlayer  = 0._wp
    12451245    nsublayer = 0._wp
    1246     do iz = 1, Ncat
    1247        do ic = 1, Ncolumns
     1246    DO iz = 1, Ncat
     1247       DO ic = 1, Ncolumns
    12481248          cldlayer(:,iz)  = cldlayer(:,iz)  + cldlay(:,ic,iz)
    12491249          nsublayer(:,iz) = nsublayer(:,iz) + nsublay(:,ic,iz)
     
    12721272       eta = 0.6_wp            ! Multiple-scattering factor (Vaillant de Guelis et al. 2017a, AMT)
    12731273
    1274         ! Inputs
     1274    ! Inputs
    12751275    integer,intent(in) :: &
    12761276       Npoints,  & ! Number of gridpoints
     
    12911291       surfelev    ! Surface Elevation (SE)
    12921292
    1293         ! Outputs
     1293    ! Outputs
    12941294    real(wp),intent(out),dimension(Npoints,Nlevels,Ntype+1) :: &
    12951295       lidarcldtype   ! 3D OPAQ product fraction (opaque clouds, thin clouds, z_opaque, opacity)
     
    13241324
    13251325    ! ####################################################################################
    1326         ! 1) Initialize   
     1326    ! 1) Initialize
    13271327    ! ####################################################################################
    13281328    cldtype(:,:)          = 0._wp
     
    13421342    ! 2) Cloud detection and Fully attenuated layer detection
    13431343    ! ####################################################################################
    1344     do k=1,Nlevels
     1344    DO k=1,Nlevels
    13451345       ! Cloud detection at subgrid-scale:
    13461346       where ( (x(:,:,k) .gt. S_cld) .and. (x(:,:,k) .ne. undef) )
     
    13751375    ! ####################################################################################
    13761376
    1377     do k=1,Nlevels
    1378        do ic = 1, Ncolumns
    1379           do ip = 1, Npoints
     1377    DO k=1,Nlevels
     1378       DO ic = 1, Ncolumns
     1379          DO ip = 1, Npoints
    13801380
    13811381             cldlay(ip,ic,1)   = MAX(cldlay(ip,ic,1),cldyopaq(ip,ic,k)) ! Opaque cloud
     
    13931393
    13941394! OPAQ variables
    1395      do ic = 1, Ncolumns
    1396         do ip = 1, Npoints
     1395     DO ic = 1, Ncolumns
     1396        DO ip = 1, Npoints
    13971397
    13981398     ! Declaring non-opaque cloudy profiles as thin cloud profiles
    1399            if ( cldlay(ip,ic,4).gt. 0. .and. cldlay(ip,ic,1) .eq. 0. ) then
    1400               cldlay(ip,ic,2)  =  1._wp
    1401            endif
     1399       if ( cldlay(ip,ic,4).gt. 0. .and. cldlay(ip,ic,1) .eq. 0. ) then
     1400          cldlay(ip,ic,2)  =  1._wp
     1401        endif
    14021402
    14031403     ! Filling in 3D and 2D variables
    14041404
    14051405     ! Opaque cloud profiles
    1406            if ( cldlay(ip,ic,1) .eq. 1. ) then
    1407               zopac = 0._wp
    1408               z_top = 0._wp
    1409               do k=1,Nlevels-1
     1406       if ( cldlay(ip,ic,1) .eq. 1. ) then
     1407          zopac = 0._wp
     1408          z_top = 0._wp
     1409          DO k=1,Nlevels-1
    14101410     ! Declaring z_opaque altitude and opaque cloud fraction for 3D and 2D variables
    14111411     ! From SFC-2-TOA ( actually from vgrid_z(SFC+1) = vgrid_z(Nlevels-1) )
    1412                  if ( cldy(ip,ic,Nlevels-k) .eq. 1. .and. zopac .eq. 0. ) then
    1413                     lidarcldtype(ip,Nlevels-k + 1,3) = lidarcldtype(ip,Nlevels-k + 1,3) + 1._wp
    1414                     cldlay(ip,ic,3)                  = vgrid_z(Nlevels-k+1)      ! z_opaque altitude
    1415                     nsublay(ip,ic,3)                 = 1._wp
    1416                     zopac = Nlevels-k+1                        ! z_opaque vertical index on vgrid_z
    1417                 endif
    1418                  if ( cldy(ip,ic,Nlevels-k) .eq. 1. ) then
    1419                     lidarcldtype(ip,Nlevels-k ,1)    = lidarcldtype(ip,Nlevels-k ,1) + 1._wp
    1420                     z_top = Nlevels-k    ! top cloud layer vertical index on vgrid_z
     1412             if ( cldy(ip,ic,Nlevels-k) .eq. 1. .and. zopac .eq. 0. ) then
     1413            lidarcldtype(ip,Nlevels-k + 1,3) = lidarcldtype(ip,Nlevels-k + 1,3) + 1._wp
     1414            cldlay(ip,ic,3)                  = vgrid_z(Nlevels-k+1)      ! z_opaque altitude
     1415            nsublay(ip,ic,3)                 = 1._wp
     1416            zopac = Nlevels-k+1                        ! z_opaque vertical index on vgrid_z
     1417        endif
     1418             if ( cldy(ip,ic,Nlevels-k) .eq. 1. ) then
     1419            lidarcldtype(ip,Nlevels-k ,1)    = lidarcldtype(ip,Nlevels-k ,1) + 1._wp
     1420            z_top = Nlevels-k    ! top cloud layer vertical index on vgrid_z
    14211421                 endif
    1422               enddo
     1422          enddo
    14231423     ! Summing opaque cloud mean temperatures and altitudes
    14241424     ! as defined in Vaillant de Guelis et al. 2017a, AMT
     
    14321432                 cldlay(ip,ic,1) = 0
    14331433              endif
    1434            endif
     1434       endif
    14351435
    14361436     ! Thin cloud profiles
    1437            if ( cldlay(ip,ic,2) .eq. 1. ) then
    1438               topcloud = 0._wp
    1439               z_top = 0._wp
    1440               z_base = 0._wp
    1441               do k=1,Nlevels
     1437       if ( cldlay(ip,ic,2) .eq. 1. ) then
     1438          topcloud = 0._wp
     1439          z_top = 0._wp
     1440          z_base = 0._wp
     1441          DO k=1,Nlevels
    14421442     ! Declaring thin cloud fraction for 3D variable
    14431443     ! From TOA-2-SFC
    14441444                 if ( cldy(ip,ic,k) .eq. 1. .and. topcloud .eq. 1. ) then
    14451445                    lidarcldtype(ip,k,2) = lidarcldtype(ip,k,2) + 1._wp
    1446                     z_base = k ! bottom cloud layer
     1446            z_base = k ! bottom cloud layer
    14471447                 endif
    1448                  if ( cldy(ip,ic,k) .eq. 1. .and. topcloud .eq. 0. ) then
     1448             if ( cldy(ip,ic,k) .eq. 1. .and. topcloud .eq. 0. ) then
    14491449                    lidarcldtype(ip,k,2) = lidarcldtype(ip,k,2) + 1._wp
    1450                     z_top = k  ! top cloud layer
    1451                     z_base = k ! bottom cloud layer
     1450            z_top = k  ! top cloud layer
     1451            z_base = k ! bottom cloud layer
    14521452                    topcloud = 1._wp
    1453                 endif
    1454               enddo
     1453        endif
     1454          enddo
    14551455     ! Computing mean emissivity using layers below the bottom cloud layer to the surface
    1456               srmean = 0._wp
    1457               srcount = 0._wp
    1458               cloudemis = 0._wp
    1459               do k=z_base+1,Nlevels
    1460                  if (  (x(ip,ic,k) .gt. S_att_opaq) .and. (x(ip,ic,k) .lt. 1.0) .and. (x(ip,ic,k) .ne. undef)  ) then
    1461                     srmean = srmean + x(ip,ic,k)
    1462                     srcount = srcount + 1.
     1456               srmean = 0._wp
     1457          srcount = 0._wp
     1458          cloudemis = 0._wp
     1459               DO k=z_base+1,Nlevels
     1460             if (  (x(ip,ic,k) .gt. S_att_opaq) .and. (x(ip,ic,k) .lt. 1.0) .and. (x(ip,ic,k) .ne. undef)  ) then
     1461            srmean = srmean + x(ip,ic,k)
     1462            srcount = srcount + 1.
    14631463                 endif
    1464               enddo
    1465               ! If clear sky layers exist below bottom cloud layer
    1466               if ( srcount .gt. 0. ) then
    1467                 trans2 = srmean/srcount              ! thin cloud transmittance**2
    1468                 tau_app = -(log(trans2))/2.          ! apparent cloud optical depth
    1469                 tau_vis = tau_app/eta                ! cloud visible optical depth (multiple scat.)
    1470                 tau_ir = tau_vis/2.                  ! approx. relation between visible and IR ODs
    1471                 cloudemis = 1. - exp(-tau_ir)        ! no diffusion in IR considered : emis = 1-T
    1472                 count_emis(ip) = count_emis(ip) + 1.
    1473               endif
     1464          enddo
     1465          ! If clear sky layers exist below bottom cloud layer
     1466          if ( srcount .gt. 0. ) then
     1467              trans2 = srmean/srcount              ! thin cloud transmittance**2
     1468              tau_app = -(log(trans2))/2.          ! apparent cloud optical depth
     1469              tau_vis = tau_app/eta                ! cloud visible optical depth (multiple scat.)
     1470              tau_ir = tau_vis/2.                  ! approx. relation between visible and IR ODs
     1471              cloudemis = 1. - exp(-tau_ir)        ! no diffusion in IR considered : emis = 1-T
     1472        count_emis(ip) = count_emis(ip) + 1.
     1473          endif
    14741474     ! Summing thin cloud mean temperatures and altitudes
    14751475     ! as defined in Vaillant de Guelis et al. 2017a, AMT
     
    15001500    ! 3D opacity fraction (=4) !Summing z_opaque fraction from TOA(k=1) to SFC(k=Nlevels)
    15011501       lidarcldtype(:,1,4) = lidarcldtype(:,1,3) !top layer equal to 3D z_opaque fraction
    1502     do ip = 1, Npoints
    1503         do k = 2, Nlevels
     1502    DO ip = 1, Npoints
     1503         DO k = 2, Nlevels
    15041504            if ( (lidarcldtype(ip,k,3) .ne. undef) .and. (lidarcldtype(ip,k-1,4) .ne. undef) ) then
    1505                 lidarcldtype(ip,k,4) = lidarcldtype(ip,k,3) + lidarcldtype(ip,k-1,4)
    1506             else
    1507                 lidarcldtype(ip,k,4) = undef
    1508             endif
    1509         enddo
     1505            lidarcldtype(ip,k,4) = lidarcldtype(ip,k,3) + lidarcldtype(ip,k-1,4)
     1506        else
     1507            lidarcldtype(ip,k,4) = undef
     1508        endif
    15101509    enddo
     1510    enddo
    15111511
    15121512    ! Layered cloud types (opaque, thin and z_opaque 2D variables)
    15131513
    1514     do iz = 1, Ntype
    1515        do ic = 1, Ncolumns
     1514    DO iz = 1, Ntype
     1515       DO ic = 1, Ncolumns
    15161516          cldtype(:,iz)  = cldtype(:,iz)  + cldlay(:,ic,iz)
    15171517          nsublayer(:,iz) = nsublayer(:,iz) + nsublay(:,ic,iz)
Note: See TracChangeset for help on using the changeset viewer.