Ignore:
Timestamp:
Jul 22, 2024, 9:29:09 PM (4 months ago)
Author:
abarral
Message:

Replace most uses of CPP_DUST by the corresponding logical defined in lmdz_cppkeys_wrapper.F90
Convert several files from .F to .f90 to allow Dust to compile w/o rrtm/ecrad
Create lmdz_yoerad.f90
(lint) Remove "!" on otherwise empty line

File:
1 edited

Legend:

Unmodified
Added
Removed
  • LMDZ6/branches/Amaury_dev/libf/phylmdiso/cv3_routines.F90

    r5087 r5099  
    5757!jyg<
    5858!  noff is chosen such that nl = k_upper so that upmost loops end at about 22 km
    59 !
     59
    6060  noff = min(max(nd-k_upper, 1), (nd+1)/2)
    6161!!  noff = 1
     
    16161616             qnk(i)*(lv0-clmcpv*(tnk(i)-273.15)) + gznk(i)
    16171617  END DO
    1618 !
     1618
    16191619!  Ice fraction
    1620 !
     1620
    16211621  IF (cvflag_ice) THEN
    16221622    DO k = minorig, nl
     
    16861686  END DO
    16871687!>jyg
    1688 !
    16891688
    16901689! ***  Find lifted parcel quantities above cloud base    ***
    16911690
    16921691!----------------------------------------------------------------------------
    1693 !
     1692
    16941693  IF (icvflag_Tpa == 2) THEN
    16951694#ifdef ISO
    16961695        CALL abort_gcm('cv3_routines 1813','isos pas prevus ici',1)
    16971696#endif
    1698 !
     1697
    16991698!----------------------------------------------------------------------------
    1700 !
     1699
    17011700    DO k = minorig + 1, nl
    17021701      DO i = 1,ncum
     
    17741773                  Ux*  (ah0(i) - ahg - ddelta)           /aa
    17751774            ENDIF ! (tg .gt. Tx)
    1776 !
     1775
    17771776!!     print *,' j, k, Um, U, Ux, aa, bb, discr, dd, ddelta ', j, k, Um, U, Ux, aa, bb, discr, dd, ddelta
    17781777!!     print *,' j, k, ah0(i), ahg, tg, qg, tp(i,k), ff ', j, k, ah0(i), ahg, tg, qg, tp(i,k), ff
     
    18021801    END DO ! k = minorig + 1, nl
    18031802!----------------------------------------------------------------------------
    1804 !
     1803
    18051804  ELSE IF (icvflag_Tpa == 1) THEN  ! (icvflag_Tpa == 2)
    1806 !
     1805
    18071806!----------------------------------------------------------------------------
    1808 !
     1807
    18091808#ifdef ISO
    18101809        CALL abort_gcm('cv3_routines 1813','isos pas prevus ici',1)
     
    18721871        END IF ! (k>=(icbs(i)+1))
    18731872      END DO ! i = 1, ncum
    1874 !
     1873
    18751874      IF (cvflag_prec_eject) THEN
    18761875#ifdef ISO
     
    18981897!   ejection.
    18991898!  =====================================================================================
    1900 
     1899
    19011900!   Verif
    19021901            qpreca(i,k) = ejectliq*qpl(i,k) + ejectice*qps(i,k)                                   !!jygprl
     
    19041903            frac_s(i,k) = (1.-ejectliq)*frac(i,k) + &                                             !!jygprl
    19051904               ejectliq*(1. - (qpl(i,k)+(1.-frac(i,k))*qcld(i,k))/max(clw(i,k),smallestreal))     !!jygprl
    1906 !         
     1905
    19071906            denomm1 = 1./(1. - qpreca(i,k))
    1908 !         
     1907
    19091908            qta(i,k) = qta(i,k-1) - &
    19101909                      qpreca(i,k)*(1.-qta(i,k-1))*denomm1
     
    19251924        END DO ! i = 1, ncum
    19261925      ENDIF  ! (cvflag_prec_eject)
    1927 !
     1926
    19281927    END DO ! k = minorig + 1, nl
    1929 !
     1928
    19301929!----------------------------------------------------------------------------
    1931 !
     1930
    19321931  ELSE IF (icvflag_Tpa == 0) THEN! (icvflag_Tpa == 2) ELSE IF(icvflag_Tpa == 1)
    1933 !
     1932
    19341933!----------------------------------------------------------------------------
    1935 !
     1934
    19361935  DO k = minorig + 1, nl
    19371936    DO i = 1, ncum
     
    21602159
    21612160!----------------------------------------------------------------------------
    2162 !
     2161
    21632162  ENDIF ! (icvflag_Tpa == 2) ELSEIF (icvflag_Tpa == 1) ELSE (icvflag_Tpa == 0)
    21642163#ifdef ISOVERIF
     
    21702169  enddo
    21712170#endif
    2172 !
     2171
    21732172!----------------------------------------------------------------------------
    2174 !
     2173
    21752174! =====================================================================
    21762175! --- SET THE PRECIPITATION EFFICIENCIES
    21772176! --- THESE MAY BE FUNCTIONS OF TP(I), P(I) AND CLW(I)
    21782177! =====================================================================
    2179 !
     2178
    21802179  IF (flag_epkeorig/=1) THEN
    21812180    DO k = 1, nl ! convect3
     
    22132212    END DO
    22142213  END IF
    2215 !
     2214
    22162215!   =========================================================================
    22172216  IF (prt_level >= 10) THEN
     
    22192218                          (k, tp(1,k), tvp(1,k), k = 1,nl)
    22202219  ENDIF
    2221 !
     2220
    22222221! =====================================================================
    22232222! --- CALCULATE VIRTUAL TEMPERATURE AND LIFTED PARCEL
     
    24512450
    24522451!jyg : cvflag_ice test outside the loops (07042015)
    2453 !
     2452
    24542453  IF (cvflag_ice) THEN
    2455 !
     2454
    24562455  IF (cvflag_prec_eject) THEN
    24572456!!    DO k = minorig + 1, nl
     
    24852484      END DO
    24862485    END DO
    2487 !
     2486
    24882487  ELSE   ! (cvflag_ice)
    2489 !
     2488
    24902489    DO k = minorig + 1, nl
    24912490      DO i = 1, ncum
     
    25012500      END DO
    25022501    END DO
    2503 !
     2502
    25042503  END IF  ! (cvflag_ice)
    25052504
     
    25142513! ===================================================================
    25152514! ---  CLOSURE OF CONVECT3
    2516 !
     2515
    25172516! vectorization: S. Bony
    25182517! ===================================================================
     
    38203819  END DO
    38213820
    3822 !
    38233821! Get adiabatic ascent mass flux
    3824 !
     3822
    38253823!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    38263824  IF (adiab_ascent_mass_flux_depends_on_ejectliq) THEN
     
    38573855
    38583856! ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    3859 !
     3857
    38603858! ***                    begin downdraft loop                    ***
    3861 !
     3859
    38623860! ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    38633861
     
    38783876! ***  integrate liquid water equation to find condensed water   ***
    38793877! ***                and condensed water flux                    ***
    3880 !
    3881 !
     3878
     3879
    38823880! ***              calculate detrained precipitation             ***
    38833881
     
    40884086        bfac = 1./(sigd(il)*wt(il,i))
    40894087
    4090 !
    40914088    IF (prt_level >= 20) THEN
    40924089      Print*, 'cv3_unsat after provisional rp estimate: rp, afac, bfac ', &
    40934090          i, rp(1, i), afac,bfac
    40944091    ENDIF
    4095 !
     4092
    40964093!JYG1
    40974094! cc        sigt=1.0
     
    41714168          evap(il, i) = (wdtrain(il)+sigd(il)*wt(il,i)*(prec(il,i+1)-prec(il,i))) / &
    41724169                        (sigd(il)*(ph(il,i)-ph(il,i+1))*100.)
    4173 !
     4170
    41744171    IF (prt_level >= 20) THEN
    41754172      Print*, 'cv3_unsat after evap computation: wdtrain, sigd, wt, prec(i+1),prec(i) ', &
    41764173          i, wdtrain(1), sigd(1), wt(1,i), prec(1,i+1),prec(1,i)
    41774174    ENDIF
    4178 !
    41794175
    41804176!jyg<
     
    44034399    END DO
    44044400! ----------------------------------------------------------------
    4405 !
     4401
    44064402    IF (prt_level >= 20) THEN
    44074403      Print*, 'cv3_unsat after mp computation: mp, b(i), b(i-1) ', &
    44084404          i, mp(1, i), b(1,i), b(1,max(i-1,1))
    44094405    ENDIF
    4410 !
    44114406
    44124407! ***       find mixing ratio of precipitating downdraft     ***
     
    47664761      REAL, DIMENSION (ntraciso,nloc, na), INTENT (IN)            :: xtice
    47674762#endif
    4768 !
     4763
    47694764!input/output:
    47704765      REAL, DIMENSION (nloc, na), INTENT (INOUT)         :: m, mp
     
    47734768      REAL, DIMENSION (nloc, nd), INTENT (INOUT)         :: sig
    47744769      REAL, DIMENSION (nloc), INTENT (INOUT)             :: sigd
    4775 !
     4770
    47764771!outputs:
    47774772      REAL, DIMENSION (nloc), INTENT (OUT)               :: precip
     
    47944789      real, DIMENSION (ntraciso,nloc, nd+1), INTENT (OUT) :: xtVprecip, xtVprecipi
    47954790#endif
    4796 !
     4791
    47974792!local variables:
    47984793      INTEGER                                            :: i, k, il, n, j, num1
     
    48634858#endif
    48644859#endif
    4865 !
     4860
    48664861! -------------------------------------------------------------
    48674862
     
    51345129  ENDIF ! (adiab_ascent_mass_flux_depends_on_ejectliq) ELSE
    51355130!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    5136 !
     5131
    51375132!    print*,'cv3_yield avant ft'
    51385133! am is the part of cbmf taken from the first level
     
    54085403           IF (ok_optim_yield) THEN                       !|
    54095404!-----------------------------------------------------------
    5410 !
     5405
    54115406!***                                                      ***
    54125407!***    Compute convective mass fluxes upwd and dnwd      ***
    54135408
    5414 !
    54155409! =================================================
    54165410!              upward fluxes                      |
    54175411! ------------------------------------------------
    5418 !
     5412
    54195413upwd(:,:) = 0.
    54205414up_to(:,:) = 0.
    54215415up_from(:,:) = 0.
    5422 !
     5416
    54235417!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    54245418  IF (adiab_ascent_mass_flux_depends_on_ejectliq) THEN
     
    54285422!! WARNING : in the present version, taking into account the mass-flux decrease due to
    54295423!! precipitation ejection leads to water conservation violation.
    5430 !
     5424
    54315425! - Upward mass flux of mixed draughts
    54325426!---------------------------------------
     
    54405434  ENDDO
    54415435ENDDO
    5442 !
     5436
    54435437DO j = 3, nl
    54445438  DO i = 2, j-1
     
    54505444  ENDDO
    54515445ENDDO
    5452 !
     5446
    54535447! The difference between upwd(il,i) and upwd(il,i-1) is due to updrafts ending in layer
    54545448!(i-1) (theses drafts cross interface (i-1) but not interface(i)) and to updrafts starting
    54555449!from layer (i-1) (theses drafts cross interface (i) but not interface(i-1)):
    5456 !
     5450
    54575451DO i = 2, nlp
    54585452  DO il = 1, ncum
     
    54625456  ENDDO
    54635457ENDDO
    5464 !
     5458
    54655459! - Total upward mass flux
    54665460!---------------------------
     
    54775471!! The decrease of the adiabatic ascent mass flux due to ejection of precipitation
    54785472!! is not taken into account.
    5479 !
     5473
    54805474! - Upward mass flux
    54815475!-------------------
     
    54945488  ENDDO
    54955489ENDDO
    5496 !
     5490
    54975491DO i = 1, nl
    54985492  DO il = 1, ncum
     
    55025496  ENDDO
    55035497ENDDO
    5504 !
     5498
    55055499DO j = 3, nl
    55065500  DO i = 2, j-1
     
    55125506  ENDDO
    55135507ENDDO
    5514 !
     5508
    55155509! The difference between upwd(il,i) and upwd(il,i-1) is due to updrafts ending in layer
    55165510!(i-1) (theses drafts cross interface (i-1) but not interface(i)) and to updrafts starting
    55175511!from layer (i-1) (theses drafts cross interface (i) but not interface(i-1)):
    5518 !
     5512
    55195513DO i = 2, nlp
    55205514  DO il = 1, ncum
     
    55295523!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    55305524
    5531 !
    55325525! =================================================
    55335526!              downward fluxes                    |
     
    55465539  ENDDO
    55475540ENDDO
    5548 !
     5541
    55495542DO j = 1, nl
    55505543  DO i = j+1, nl
     
    55575550  ENDDO
    55585551ENDDO
    5559 !
     5552
    55605553! The difference between dnwd(il,i) and dnwd(il,i+1) is due to downdrafts ending in layer
    55615554!(i) (theses drafts cross interface (i+1) but not interface(i)) and to downdrafts
    55625555!starting from layer (i) (theses drafts cross interface (i) but not interface(i+1)):
    5563 !
     5556
    55645557DO i = nl-1, 1, -1
    55655558  DO il = 1, ncum
     
    55695562ENDDO
    55705563! =================================================
    5571 !
     5564
    55725565!-----------------------------------------------------------
    55735566        ENDIF !(ok_optim_yield)                           !|
     
    55935586    IF (num1<=0) GO TO 500
    55945587
    5595 !
    55965588!jyg<
    55975589!-----------------------------------------------------------
     
    56515643      END DO
    56525644    END DO
    5653 !
     5645
    56545646!-----------------------------------------------------------
    56555647        ENDIF !(ok_optim_yield)                           !|
    56565648!-----------------------------------------------------------
    5657 !
     5649
    56585650!!   print *,'yield, i, amp1, ad', i, amp1(1), ad(1)
    56595651
     
    57125704                                    t(il,i)*(cpv-cpd)*(rr(il,i)-qent(il,i,i)))*cpinv
    57135705        END IF
    5714 !
     5706
    57155707! sb: on ne fait pas encore la correction permettant de mieux
    57165708! conserver l'eau:
     
    58485840        ! ajout du terme des ddfts sensi stricto
    58495841!        write(*,*) 'tmp cv3_yield 4165: i,il=',i,il
    5850 !
     5842
    58515843        if (option_traceurs.eq.6) then
    58525844          do iiso = 1, niso
     
    61536145            ft(il, i) = ft(il, i) + 0.01*grav*dpinv*ment(il, k, i) * &
    61546146                 (hent(il,k,i)-h(il,i)+t(il,i)*(cpv-cpd)*(rr(il,i)+awat(il)-qent(il,k,i)))*cpinv
    6155 !
     6147
    61566148#ifdef ISO
    61576149        ! on change le traitement de cette ligne le 8 mai 2009:
     
    61926184       ! end cam verif
    61936185#endif
    6194 !
     6186
    61956187          END IF ! i
    61966188        END DO
     
    68146806    END IF
    68156807  END DO
    6816 !
     6808
    68176809    IF (prt_level >= 5) THEN
    68186810      print *,' CV3_YIELD : alpha_qpos ',alpha_qpos(1)
    68196811    ENDIF
    68206812
    6821 !
    68226813  DO il = 1, ncum
    68236814    IF (iflag(il)<=1) THEN
     
    73037294  REAL, DIMENSION (len, na, na), INTENT (OUT)        :: phi, phi2, epmlmMm
    73047295  REAL, DIMENSION (len, na), INTENT (OUT)            :: da, d1a, dam, eplaMm
    7305 !
     7296
    73067297! variables pour tracer dans precip de l'AA et des mel
    73077298!local variables:
     
    76007591!AC! 2110    continue
    76017592!AC! 2100   continue
    7602 !
     7593
    76037594  RETURN
    76047595END SUBROUTINE cv3_uncompress
Note: See TracChangeset for help on using the changeset viewer.