Changeset 1993


Ignore:
Timestamp:
Aug 29, 2018, 4:41:34 PM (6 years ago)
Author:
jleconte
Message:

29/08/2018 == JL

-watersat was used only in vdifc and thus it was not consistent with other routines (turbdiff, rain, largescale...) which used Psat_water from watercommon.
This is now harmonized. ALl routines use Psat_water. Watersat.F has been removed, but the routine is now in watercommon for archival purpose. It is not used anymore.
-also changed the number of chars for tname in the dyn3D/infotrac.F90 to be able to run rcm1d.

Location:
trunk/LMDZ.GENERIC
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.GENERIC/README

    r1990 r1993  
    13891389correct bug on rain initialization at each timestep in physiqu_mod so that mass_redist can work without rain (if precipitations are taken care with sedimentation for example)
    13901390change a table that was used as a float to a float in gfluxv for speedup. Does not change results bit for bit
     1391
     1392== 29/08/2018 == JL
     1393-watersat was used only in vdifc and thus it was not consistent with other routines (turbdiff, rain, largescale...) which used Psat_water from watercommon.
     1394This is now harmonized. ALl routines use Psat_water. Watersat.F has been removed, but the routine is now in watercommon for archival purpose. It is not used anymore.
     1395-also changed the number of chars for tname in the dyn3D/infotrac.F90 to be able to run rcm1d.
  • trunk/LMDZ.GENERIC/libf/dyn3d/infotrac.F90

    r1416 r1993  
    1212
    1313! Name variables
    14   CHARACTER(len=20), ALLOCATABLE, DIMENSION(:), SAVE :: tname ! tracer short name for restart and diagnostics
    15   CHARACTER(len=23), ALLOCATABLE, DIMENSION(:), SAVE :: ttext ! tracer long name for diagnostics
     14  CHARACTER(len=30), ALLOCATABLE, DIMENSION(:), SAVE :: tname ! tracer short name for restart and diagnostics
     15  CHARACTER(len=33), ALLOCATABLE, DIMENSION(:), SAVE :: ttext ! tracer long name for diagnostics
    1616
    1717! iadv  : index of trasport schema for each tracer
  • trunk/LMDZ.GENERIC/libf/phystd/callcorrk.F90

    r1988 r1993  
    167167      real*8 pq_temp(nlayer)
    168168! real(KIND=r8) :: pq_temp(nlayer) ! better F90 way.. DOESNT PORT TO F77!!!
    169       real ptemp, Ttemp, qsat
     169      real psat,qsat
    170170
    171171      logical OLRz
     
    533533            if(RH.lt.0.0) RH=0.0
    534534           
    535             ptemp=pplay(ig,l)
    536             Ttemp=pt(ig,l)
    537             call watersat(Ttemp,ptemp,qsat)
     535            call Psat_water(pt(ig,l),pplay(ig,l),psat,qsat)
    538536
    539537            !pq_temp(l) = qsat      ! fully saturated everywhere
     
    551549         RH = satval * (1 - 0.02) / 0.98
    552550         if(RH.lt.0.0) RH=0.0
    553 
    554 !         ptemp = pplev(ig,1)
    555 !         Ttemp = tsurf(ig)
    556 !         call watersat(Ttemp,ptemp,qsat)
    557551
    558552         qvar(2*nlayer+1)= RH * qsat ! ~realistic profile (e.g. 80% saturation at ground)
  • trunk/LMDZ.GENERIC/libf/phystd/largescale.F90

    r1830 r1993  
    55      use ioipsl_getin_p_mod, only: getin_p
    66      use watercommon_h, only : RLVTT, RCPD, RVTMP2,  &
    7           T_h2O_ice_clouds,T_h2O_ice_liq,Psat_waterDP,Lcpdqsat_waterDP
     7          T_h2O_ice_clouds,T_h2O_ice_liq,Psat_water,Lcpdqsat_water
    88      USE tracer_h
    99      IMPLICIT none
     
    5050      ! JL13: if "careful, T<Tmin in psat water" appears often, you may want to stabilise the model by
    5151      !                   decreasing alpha and increasing nitermax accordingly
    52       DOUBLE PRECISION zt(ngrid), zq(ngrid)
     52      DOUBLE PRECISION zq(ngrid)
    5353      DOUBLE PRECISION zcond(ngrid),zcond_iter
    5454      DOUBLE PRECISION zdelq(ngrid)
    55       DOUBLE PRECISION zqs(ngrid), zdqs(ngrid)
    56       DOUBLE PRECISION local_p,psat_tmp,dlnpsat_tmp,Lcp
     55      DOUBLE PRECISION zqs(ngrid)
     56      real zt(ngrid),local_p,psat_tmp,dlnpsat_tmp,Lcp,zqs_temp,zdqs
    5757     
    5858! evaporation calculations
     
    106106!           zt(i)=15.   ! check too low temperatures
    107107         endif
    108          call Psat_waterDP(zt(i),local_p,psat_tmp,zqs(i))
     108         call Psat_water(zt(i),local_p,psat_tmp,zqs_temp)
     109         zqs(i)=zqs_temp
    109110 
    110111         zdelq(i) = MAX(MIN(ratqs * zq(i),1.-zq(i)),1.d-12)
     
    127128            zcond(i) = 0.0d0
    128129            Do nn=1,nitermax 
    129                call Psat_waterDP(zt(i),local_p,psat_tmp,zqs(i))
    130                call Lcpdqsat_waterDP(zt(i),local_p,psat_tmp,zqs(i),zdqs(i),dlnpsat_tmp)
    131                zcond_iter = alpha*(zx_q(i)-zqs(i))/(1.d0+zdqs(i))         
     130               call Psat_water(zt(i),local_p,psat_tmp,zqs_temp)
     131               zqs(i)=zqs_temp
     132               call Lcpdqsat_water(zt(i),local_p,psat_tmp,zqs_temp,zdqs,dlnpsat_tmp)
     133               zcond_iter = alpha*(zx_q(i)-zqs(i))/(1.d0+zdqs)     
    132134                  !zcond can be negative here
    133135               zx_q(i) = zx_q(i) - zcond_iter
     
    150152            zcond(i) = 0.0d0
    151153            Do nn=1,nitermax 
    152                call Lcpdqsat_waterDP(zt(i),local_p,psat_tmp,zqs(i),zdqs(i),dlnpsat_tmp)
    153                zcond_iter = MAX(0.0d0,alpha*(zx_q(i)-zqs(i))/(1.d0+zdqs(i)))       
     154               call Lcpdqsat_water(zt(i),local_p,psat_tmp,zqs(i),zdqs,dlnpsat_tmp)
     155               zcond_iter = MAX(0.0d0,alpha*(zx_q(i)-zqs(i))/(1.d0+zdqs))         
    154156                  !zcond always postive! cannot evaporate clouds!
    155157                  !this is why we must reevaporate before largescale
     
    159161!              if (ABS(zcond_iter/alpha).lt.qthreshold) exit
    160162               zt(i) = zt(i) + zcond_iter*Lcp*rneb(i,k)
    161                call Psat_waterDP(zt(i),local_p,psat_tmp,zqs(i))
     163               call Psat_water(zt(i),local_p,psat_tmp,zqs_temp)
     164               zqs(i)=zqs_temp
    162165               if (nn.eq.nitermax) print*,'itermax in largescale'
    163166            End do ! niter
     
    172175         pdqvaplsc(1:ngrid,k)  = dqevap(1:ngrid,k) - zcond(1:ngrid)
    173176         pdqliqlsc(1:ngrid,k) = - pdqvaplsc(1:ngrid,k)
    174          pdtlsc(1:ngrid,k)  = pdqliqlsc(1:ngrid,k)*real(Lcp)
     177         pdtlsc(1:ngrid,k)  = pdqliqlsc(1:ngrid,k)*Lcp
    175178
    176179   Enddo ! k= nlayer, 1, -1
  • trunk/LMDZ.GENERIC/libf/phystd/rain.F90

    r1859 r1993  
    8282      real reffh2oliq(ngrid,nlayer),reffh2oice(ngrid,nlayer)
    8383 
    84       real ttemp, ptemp, psat_tmp
     84      real ptemp, psat_tmp
    8585      real tnext(ngrid,nlayer)
    8686
     
    183183      DO k = 1, nlayer
    184184         DO i = 1, ngrid
    185             ttemp = zt(i,k)
    186185            ptemp = pplay(i,k)
    187 !            call watersat(ttemp,ptemp,zqs(i,k))
    188             call Psat_water(ttemp,ptemp,psat_tmp,zqs(i,k))
     186            call Psat_water(zt(i,k) ,ptemp,psat_tmp,zqs(i,k))
    189187            call Tsat_water(ptemp,Tsat(i,k))
    190188         ENDDO
  • trunk/LMDZ.GENERIC/libf/phystd/turbdiff.F90

    r1863 r1993  
    77          pdqdif,pdqevap,pdqsdif,flux_u,flux_v,lastcall)
    88
    9       use watercommon_h, only : RLVTT, T_h2O_ice_liq, RCPD, mx_eau_sol,Psat_water
     9      use watercommon_h, only : RLVTT, T_h2O_ice_liq, RCPD, mx_eau_sol,Psat_water, Lcpdqsat_water
    1010      use radcommon_h, only : sigma, glat
    1111      use surfdat_h, only: dryness
     
    116116      REAL zdmassevap(ngrid)
    117117      REAL rho(ngrid)         ! near-surface air density
    118       REAL qsat(ngrid),psat(ngrid)
    119118      REAL kmixmin
    120119
    121120!     Variables added for implicit latent heat inclusion
    122121!     --------------------------------------------------
    123       real dqsat(ngrid), qsat_temp1, qsat_temp2,psat_temp
     122      real dqsat(ngrid),psat_temp,qsat(ngrid),psat(ngrid)
    124123
    125124      integer, save :: ivap, iliq, iliq_surf,iice_surf ! also make liq for clarity on surface...
     
    518517                ! Calculate the value of qsat at the surface (water)
    519518                call Psat_water(ptsrf(ig),pplev(ig,1),psat(ig),qsat(ig))
    520                 call Psat_water(ptsrf(ig)-0.0001,pplev(ig,1),psat_temp,qsat_temp1)
    521                 call Psat_water(ptsrf(ig)+0.0001,pplev(ig,1),psat_temp,qsat_temp2)
    522                 dqsat(ig)=(qsat_temp2-qsat_temp1)/0.0002
    523                 ! calculate dQsat / dT by finite differences
    524                 ! we cannot use the updated temperature value yet...
     519                call Lcpdqsat_water(ptsrf(ig),pplev(ig,1),psat(ig),qsat(ig),dqsat(ig),psat_temp)
     520                dqsat(ig)=dqsat(ig)*RCPD/RLVTT
    525521               enddo
    526522
  • trunk/LMDZ.GENERIC/libf/phystd/vdifc.F

    r1542 r1993  
    77     &     pdqdif,pdqsdif,lastcall)
    88
    9       use watercommon_h, only : RLVTT, T_h2O_ice_liq, RCPD, mx_eau_sol
     9      use watercommon_h, only : RLVTT, T_h2O_ice_liq, RCPD, mx_eau_sol
     10     &    ,Psat_water, Lcpdqsat_water
    1011      use radcommon_h, only : sigma
    1112      USE surfdat_h
     
    112113      REAL zq1temp(ngrid)
    113114      REAL rho(ngrid)         ! near-surface air density
    114       REAL qsat(ngrid)
    115115      DATA firstcall/.true./
    116116      REAL kmixmin
     
    118118!     Variables added for implicit latent heat inclusion
    119119!     --------------------------------------------------
    120       real latconst, dqsat(ngrid), qsat_temp1, qsat_temp2
    121       real z1_Tdry(ngrid), z2_Tdry(ngrid)
    122       real z1_T(ngrid), z2_T(ngrid)
    123       real zb_T(ngrid)
    124       real zc_T(ngrid,nlay)
    125       real zd_T(ngrid,nlay)
    126       real lat1(ngrid), lat2(ngrid)
    127       real surfh2otot
    128       logical surffluxdiag
    129       integer isub ! sub-loop for precision
     120      real dqsat(ngrid),psat_temp,qsat(ngrid),psat(ngrid)
    130121
    131122      integer ivap, iice ! also make liq for clarity on surface...
     
    520511
    521512               do ig=1,ngrid
    522 
    523513                ! Calculate the value of qsat at the surface (water)
    524                 call watersat(ptsrf(ig),pplev(ig,1),qsat(ig))
    525                 call watersat(ptsrf(ig)-0.0001,pplev(ig,1),qsat_temp1)
    526                 call watersat(ptsrf(ig)+0.0001,pplev(ig,1),qsat_temp2)
    527                 dqsat(ig)=(qsat_temp2-qsat_temp1)/0.0002
    528                 ! calculate dQsat / dT by finite differences
    529                 ! we cannot use the updated temperature value yet...
    530  
     514                call Psat_water(ptsrf(ig),pplev(ig,1),psat(ig),qsat(ig))
     515                call Lcpdqsat_water(ptsrf(ig),pplev(ig,1),psat(ig),
     516     &             qsat(ig),dqsat(ig),psat_temp)
     517                dqsat(ig)=dqsat(ig)*RCPD/RLVTT
    531518               enddo
    532519
  • trunk/LMDZ.GENERIC/libf/phystd/watercommon_h.F90

    r1916 r1993  
    208208         return
    209209      end subroutine Tsat_water
    210 
    211 !==================================================================
    212       subroutine Psat_waterDP(T,p,psat,qsat)
    213 
    214          implicit none
    215 
    216 !==================================================================
    217 !     Purpose
    218 !     -------
    219 !     Compute the saturation vapor pressure and mass mixing ratio at saturation (kg/kg)
     210!==================================================================
     211
     212
     213!==================================================================
     214subroutine watersat(T,p,qsat)
     215  implicit none
     216
     217!==================================================================
     218!     Purpose
     219!     -------
     220!     Compute the water mass mixing ratio at saturation (kg/kg)
    220221!     for a given pressure (Pa) and temperature (K)
    221 !     DOUBLE PRECISION
    222 !     Based on the Tetens formula from L.Li physical parametrization manual
    223 !
    224 !     Authors
    225 !     -------
    226 !     Jeremy Leconte (2012)
    227 !
    228 !==================================================================
    229 
    230 !        input
    231          double precision, intent(in) :: T, p
    232  
    233 !        output
    234          double precision psat,qsat
    235 
    236 ! JL12 variables for tetens formula
    237          double precision,parameter :: Pref_solid_liquid=611.14d0
    238          double precision,parameter :: Trefvaporization=35.86D0
    239          double precision,parameter :: Trefsublimation=7.66d0
    240          double precision,parameter :: Tmin=8.d0
    241          double precision,parameter :: r3vaporization=17.269d0
    242          double precision,parameter :: r3sublimation=21.875d0
    243 
    244 ! checked vs. old watersat data 14/05/2012 by JL.
    245 
    246          if (T.gt.T_h2O_ice_liq) then
    247             psat = Pref_solid_liquid*Exp(r3vaporization*(T-T_h2O_ice_liq)/(T-Trefvaporization)) ! liquid / vapour
    248          else if (T.lt.Tmin) then
    249             print*, "careful, T<Tmin in psat water"
    250          !   psat = Pref_solid_liquid*Exp(r3sublimation*(Tmin-T_h2O_ice_liq)/(Tmin-Trefsublimation)) ! min psat 
    251          ! Ehouarn: gfortran says: Error: Result of EXP underflows its kind,
    252          !          so set psat to the smallest possible value instead
    253             psat=tiny(psat)
    254          else                 
    255             psat = Pref_solid_liquid*Exp(r3sublimation*(T-T_h2O_ice_liq)/(T-Trefsublimation)) ! solid / vapour
    256          endif
    257          if(psat.gt.p) then
    258             qsat=1.d0
    259          else
    260             qsat=epsi*psat/(p-(1.d0-epsi)*psat)
    261          endif
    262          return
    263       end subroutine Psat_waterDP
    264 
    265 
    266 
    267 
    268 !==================================================================
    269       subroutine Lcpdqsat_waterDP(T,p,psat,qsat,dqsat,dlnpsat)
    270 
    271          implicit none
    272 
    273 !==================================================================
    274 !     Purpose
    275 !     -------
    276 !     Compute dqsat=L/cp*d (q_sat)/d T and dlnpsat=L/cp d(ln Psat)/d T
    277 !     for a given temperature (K)!
    278 !     Based on the Tetens formula from L.Li physical parametrization manual
    279 !
    280 !     Authors
    281 !     -------
    282 !     Jeremy Leconte (2012)
    283 !
    284 !==================================================================
    285 
    286 !        input
    287          double precision T, p, psat, qsat
    288  
    289 !        output
    290          double precision dqsat,dlnpsat
    291 
    292 ! JL12 variables for tetens formula
    293          double precision,parameter :: Pref_solid_liquid=611.14d0
    294          double precision,parameter :: Trefvaporization=35.86d0
    295          double precision,parameter :: Tmin=8.d0
    296          double precision,parameter :: Trefsublimation=7.66d0
    297          double precision,parameter :: r3vaporization=17.269d0
    298          double precision,parameter :: r3sublimation=21.875d0
    299 
    300          double precision :: dummy
    301 
    302          if (psat.gt.p) then
    303             dqsat=0.d0
    304             return
    305          endif
    306 
    307          if (T.gt.T_h2O_ice_liq) then
    308             dummy = r3vaporization*(T_h2O_ice_liq-Trefvaporization)/(T-Trefvaporization)**2  ! liquid / vapour
    309          else if (T.lt.Tmin) then
    310             print*, "careful, T<Tmin in Lcp psat water"
    311             dummy = r3sublimation*(T_h2O_ice_liq-Trefsublimation)/(Tmin-Trefsublimation)**2  ! solid / vapour
    312          else               
    313             dummy = r3sublimation*(T_h2O_ice_liq-Trefsublimation)/(T-Trefsublimation)**2  ! solid / vapour
    314          endif
    315 
    316          dqsat=RLVTT/RCPD*qsat*(p/(p-(1.d0-epsi)*psat))*dummy
    317          dlnpsat=RLVTT/RCPD*dummy
    318          return
    319       end subroutine Lcpdqsat_waterDP
     222!     A replacement for the old watersat.F in the Martian GCM.
     223!     Based on FCTTRE.h in the LMDTERRE model.
     224!
     225!     JL18 watersat was used only in vdifc and thus it was not consistent with other routines (turbdiff, rain, largescale...)
     226!        which used Psat_water. This is now harmonized
     227!        we put it here for archival purpose, but it is not used anymore.
     228!
     229!     Authors
     230!     -------
     231!     Robin Wordsworth (2010)
     232!
     233!==================================================================
     234
     235!   input
     236  real T, p
     237 
     238!   output
     239  real qsat
     240
     241! checked vs. NIST data 22/06/2010 by RW.
     242! / by p gives partial pressure
     243! x by epsi converts to mass mixing ratio
     244
     245  if (T.lt.T_h2O_ice_liq) then ! solid / vapour
     246     qsat = 100.0 * 10**(2.07023 - 0.00320991             &
     247          * T - 2484.896 / T + 3.56654 * alog10(T))
     248  else                 ! liquid / vapour
     249     qsat = 100.0 * 10**(23.8319 - 2948.964 / T - 5.028  &
     250          * alog10(T) - 29810.16 * exp( -0.0699382 * T)  &
     251          + 25.21935 * exp(-2999.924/T))
     252  endif
     253!  qsat=epsi*qsat/p
     254  if(qsat.gt.p) then
     255     qsat=1.
     256  else
     257     qsat=epsi*qsat/(p-(1.-epsi)*qsat)
     258  endif
     259  return
     260end subroutine watersat
     261
     262subroutine watersat_grad(T,qsat,dqsat)
     263
     264  implicit none
     265
     266!==================================================================
     267!     Purpose
     268!     -------
     269!     Compute the L/cp*d (q_sat)/d T
     270!     for a given temperature (K)
     271!
     272!     JL18: see watersat
     273!
     274!     Authors
     275!     -------
     276!     Robin Wordsworth (2010)
     277!
     278!==================================================================
     279
     280!   input
     281  real T,qsat
     282 
     283!   output
     284  real dqsat
     285
     286!  if (T.lt.T_coup) then ! solid / vapour !why use T_coup?????????? JL12
     287  if (T.lt.T_h2O_ice_liq) then ! solid / vapour
     288     dqsat = RLVTT/RCPD*qsat*(3.56654/T             &
     289          +2484.896*LOG(10.)/T**2                   &
     290          -0.00320991*LOG(10.))
     291  else                 ! liquid / vapour
     292     dqsat = RLVTT/RCPD*qsat*LOG(10.)*              &
     293          (2948.964/T**2-5.028/LOG(10.)/T           &
     294          +25.21935*2999.924/T**2*EXP(-2999.924/T)  &
     295          +29810.16*0.0699382*EXP(-0.0699382*T))
     296  end if
     297
     298  return
     299end subroutine watersat_grad
     300
    320301
    321302
Note: See TracChangeset for help on using the changeset viewer.