Ignore:
Timestamp:
Dec 12, 2023, 10:45:40 AM (12 months ago)
Author:
csegonne
Message:

MARS PCM

  • zzlay and zzlev are calculated at the begining of physics taking into account the evolution of gravitational acceleration with altitude (g becomes gz) and varying reduced gas constant with composition of the atmosphere (r becomes rnew).
  • zzlay and zzlev are updated at the end of physics after call co2condens with updated pressure and temperature.
  • call concentrations, when photochem or callthermos is true, has been moved before the first calculation of zzlay and zzlev to be able to use varying reduced gas constant rnew.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.MARS/libf/phymars/physiq_mod.F

    r3152 r3157  
    343343      REAL zzlay(ngrid,nlayer)     ! altitude at the middle of the layers
    344344      REAL zzlev(ngrid,nlayer+1)   ! altitude at layer boundaries
     345      REAL gz(ngrid,nlayer)        ! variation of g with altitude from aeroid surface
    345346!      REAL latvl1,lonvl1             ! Viking Lander 1 point (for diagnostic)
    346347
     
    393394      INTEGER length
    394395      PARAMETER (length=100)
     396      REAL tlaymean ! temporary value of mean layer temperature for zzlay
     397
    395398
    396399c     Variables for the total dust for diagnostics
     
    836839      dwatercap(:,:)=0
    837840
     841
     842
    838843      call compute_meshgridavg(ngrid,nq,albedo,emis,tsurf,qsurf,
    839844     &       albedo_meshavg,emis_meshavg,tsurf_meshavg,qsurf_meshavg)
     
    869874      ps(:) = pplev(:,1)
    870875
     876
     877#ifndef MESOSCALE
     878c-----------------------------------------------------------------------
     879c    1.2.1 Compute mean mass, cp, and R
     880c    concentrations outputs rnew(ngrid,nlayer), cpnew(ngrid,nlayer)
     881c       , mmean(ngrid,nlayer) and Akknew(ngrid,nlayer)
     882c    --------------------------------
     883
     884      if(photochem.or.callthermos) then
     885         call concentrations(ngrid,nlayer,nq,
     886     &                       zplay,pt,pdt,pq,pdq,ptimestep)
     887      endif
     888#endif
     889
    871890c     Compute geopotential at interlayers
    872891c     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    873892c     ponderation des altitudes au niveau des couches en dp/p
    874 
    875       DO l=1,nlayer
    876          DO ig=1,ngrid
    877             zzlay(ig,l)=pphi(ig,l)/g
    878          ENDDO
     893cc ------------------------------------------
     894        !Calculation zzlev & zzlay for first layer     
     895      DO ig=1,ngrid
     896         zzlay(ig,1)=-(log(pplay(ig,1)/ps(ig)))*rnew(ig,1)*pt(ig,1)/g                                     
     897         zzlev(ig,1)=0
     898         zzlev(ig,nlayer+1)=1.e7    ! dummy top of last layer above 10000 km...
     899         gz(ig,1)=g
     900       
     901        DO l=2,nlayer     
     902         ! compute "mean" temperature of the layer
     903          if(pt(ig,l) .eq. pt(ig,l-1)) then
     904             tlaymean=pt(ig,l)
     905          else
     906             tlaymean=(pt(ig,l)- pt(ig,l-1))/log(pt(ig,l)/pt(ig,l-1))
     907          endif
     908                     
     909          ! compute gravitational acceleration (at altitude zaeroid(nlayer-1))
     910          gz(ig,l)=g*(rad**2)/(rad+zzlay(ig,l-1)+(phisfi(ig)/g))**2
     911         
     912          zzlay(ig,l)=zzlay(ig,l-1)-
     913     &   (log(pplay(ig,l)/pplay(ig,l-1))*rnew(ig,l)*tlaymean/gz(ig,l))
     914                 
     915          z1=(zplay(ig,l-1)+zplev(ig,l))/(zplay(ig,l-1)-zplev(ig,l))
     916          z2=(zplev(ig,l)+zplay(ig,l))/(zplev(ig,l)-zplay(ig,l))
     917          zzlev(ig,l)=(z1*zzlay(ig,l-1)+z2*zzlay(ig,l))/(z1+z2)
     918        ENDDO
    879919      ENDDO
    880       DO ig=1,ngrid
    881          zzlev(ig,1)=0.
    882          zzlev(ig,nlayer+1)=1.e7    ! dummy top of last layer above 10000 km...
    883       ENDDO
    884       DO l=2,nlayer
    885          DO ig=1,ngrid
    886             z1=(zplay(ig,l-1)+zplev(ig,l))/(zplay(ig,l-1)-zplev(ig,l))
    887             z2=(zplev(ig,l)+zplay(ig,l))/(zplev(ig,l)-zplay(ig,l))
    888             zzlev(ig,l)=(z1*zzlay(ig,l-1)+z2*zzlay(ig,l))/(z1+z2)
    889          ENDDO
    890       ENDDO
    891 
    892920
    893921!     Potential temperature calculation not the same in physiq and dynamic
     
    902930      ENDDO
    903931
    904 #ifndef MESOSCALE
    905 c-----------------------------------------------------------------------
    906 c    1.2.5 Compute mean mass, cp, and R
    907 c    --------------------------------
    908 
    909       if(photochem.or.callthermos) then
    910          call concentrations(ngrid,nlayer,nq,
    911      &                       zplay,pt,pdt,pq,pdq,ptimestep)
    912       endif
    913 #endif
    914932
    915933      ! Compute vertical velocity (m/s) from vertical mass flux
     
    13491367     &                      pdqrds,wspeed,dsodust,dsords,dsotop,
    13501368     &                      tau_pref_scenario,tau_pref_gcm)
    1351 
     1369     
    13521370c      update the tendencies of both dust after vertical transport
    13531371         DO l=1,nlayer
     
    16091627     $ pdu_th,pdv_th,pdt_th,pdq_th,lmax_th,zmax_th,
    16101628     $ dtke_th,zdhdif,hfmax_th,wstar,sensibFlux)
    1611 
     1629       
    16121630         DO l=1,nlayer
    16131631           DO ig=1,ngrid
     
    20612079     &                tau,tauscaling)
    20622080
     2081
    20632082c Flux at the surface of co2 ice computed in co2cloud microtimestep
    20642083           IF (rdstorm) THEN
     
    22822301        ENDDO
    22832302        zplev(:,nlayer+1) = 0.
    2284         ! update layers altitude
    2285         DO l=2,nlayer
    2286           DO ig=1,ngrid
    2287            z1=(zplay(ig,l-1)+zplev(ig,l))/(zplay(ig,l-1)-zplev(ig,l))
    2288            z2=(zplev(ig,l)+zplay(ig,l))/(zplev(ig,l)-zplay(ig,l))
    2289            zzlev(ig,l)=(z1*zzlay(ig,l-1)+z2*zzlay(ig,l))/(z1+z2)
     2303       
     2304        ! Calculation of zzlay and zzlay with udpated pressure and temperature
     2305        DO ig=1,ngrid
     2306         zzlay(ig,1)=-(log(zplay(ig,1)/ps(ig)))*rnew(ig,1)*
     2307     &          (pt(ig,1)+pdt(ig,1)*ptimestep) /g                                     
     2308
     2309          DO l=2,nlayer
     2310                 
     2311           ! compute "mean" temperature of the layer
     2312            if((pt(ig,l)+pdt(ig,l)*ptimestep) .eq.
     2313     &               (pt(ig,l-1)+pdt(ig,l-1)*ptimestep)) then
     2314               tlaymean= pt(ig,l)+pdt(ig,l)*ptimestep
     2315            else
     2316               tlaymean=((pt(ig,l)+pdt(ig,l)*ptimestep)-
     2317     &            (pt(ig,l-1)+pdt(ig,l-1)*ptimestep))/
     2318     &            log((pt(ig,l)+pdt(ig,l)*ptimestep)/
     2319     &            (pt(ig,l-1)+pdt(ig,l-1)*ptimestep))
     2320            endif
     2321                     
     2322            ! compute gravitational acceleration (at altitude zaeroid(nlayer-1))
     2323            gz(ig,l)=g*(rad**2)/(rad+zzlay(ig,l-1)+(phisfi(ig)/g))**2
     2324         
     2325
     2326            zzlay(ig,l)=zzlay(ig,l-1)-
     2327     &     (log(zplay(ig,l)/zplay(ig,l-1))*rnew(ig,l)*tlaymean/gz(ig,l))
     2328             
     2329       
     2330        !   update layers altitude
     2331             z1=(zplay(ig,l-1)+zplev(ig,l))/(zplay(ig,l-1)-zplev(ig,l))
     2332             z2=(zplev(ig,l)+zplay(ig,l))/(zplev(ig,l)-zplay(ig,l))
     2333             zzlev(ig,l)=(z1*zzlay(ig,l-1)+z2*zzlay(ig,l))/(z1+z2)
    22902334          ENDDO
    2291         ENDDO
     2335        ENDDO 
    22922336#endif
    22932337      ENDIF  ! of IF (callcond)
Note: See TracChangeset for help on using the changeset viewer.