Changeset 4833


Ignore:
Timestamp:
Feb 27, 2024, 5:48:56 PM (2 months ago)
Author:
evignon
Message:

commission poprecip liee a l'atelier nuage du jour:
traitement exact de l'evaporation et de la sublimation
validation de la nouvelle formulation du freezing de la pluie

File:
1 edited

Legend:

Unmodified
Added
Removed
  • LMDZ6/trunk/libf/phylmd/lmdz_lscp_poprecip.F90

    r4832 r4833  
    6363!--Integer for interating over klon
    6464INTEGER :: i
    65 !--hum_to_flux: coef to convert a specific quantity to a flux
    66 REAL, DIMENSION(klon) :: hum_to_flux
     65!--dhum_to_dflux: coef to convert a specific quantity to a flux
     66REAL, DIMENSION(klon) :: dhum_to_dflux
     67!--
     68REAL, DIMENSION(klon) :: rho, dz
    6769
    6870!--Saturation values
     
    8284dqssubl   = 0.
    8385
    84 !-- hum_to_flux = rho * dz/dt = 1 / g * dP/dt
    85 hum_to_flux(:) = ( paprsdn(:) - paprsup(:) ) / RG / dtime
     86!-- dhum_to_dflux = rho * dz/dt = 1 / g * dP/dt
     87dhum_to_dflux(:) = ( paprsdn(:) - paprsup(:) ) / RG / dtime
     88rho(:) = pplay(:) / temp(:) / RD
     89dz(:) = ( paprsdn(:) - paprsup(:) ) / RG / rho(:)
    8690
    8791!--Calculation of saturation specific humidity
     
    117121    !--same temperature as the lowermost layer
    118122    !--we convert the flux into a specific quantity qprecip
    119     qprecip(i) = ( rain(i) + snow(i) ) / hum_to_flux(i)
     123    qprecip(i) = ( rain(i) + snow(i) ) / dhum_to_dflux(i)
    120124    !-- t(i,k+1) + d_t(i,k+1): new temperature of the overlying layer
    121125    temp(i) = ( tempupnew(i) * qprecip(i) * cpw + cpair * temp(i) ) &
     
    133137    !--Evaporation of liquid precipitation coming from above
    134138    !--in the clear sky only
    135     !--dP/dz=beta*(1-q/qsat)*(P**expo_eva) (lines 1-2)
    136     !--multiplying by dz = - dP / g / rho (line 3-4)
     139    !--dprecip/dz = -beta*(1-qvap/qsat)*(precip**expo_eva)
    137140    !--formula from Sundqvist 1988, Klemp & Wilhemson 1978
    138     draineva = - precipfracclr(i) * coef_eva * (1. - qvap(i) / qsatl(i)) &
    139              * ( rainclr(i) / MAX(thresh_precip_frac, precipfracclr(i)) ) ** expo_eva &
    140              * temp(i) * RD / pplay(i) &
    141              * ( paprsdn(i) - paprsup(i) ) / RG
    142 
    143     !--Evaporation is limited by 0 and by the total water amount in
    144     !--the precipitation
    145     draineva = MIN(0., MAX(draineva, -rainclr(i)))
     141    !--Explicit formulation
     142    !draineva = - precipfracclr(i) * coef_eva * (1. - qvap(i) / qsatl(i)) * dz(i) &
     143    !         * ( rainclr(i) / MAX(thresh_precip_frac, precipfracclr(i)) ) ** expo_eva &
     144    !draineva = MAX( - rainclr(i), draineva)
     145    !--Exact explicit formulation (rainclr is resolved exactly, qvap explicitly)
     146    !--which does not need a barrier on rainclr, because included in the formula
     147    draineva = precipfracclr(i) * ( MAX(0., &
     148             - coef_eva * ( 1. - expo_eva ) * (1. - qvap(i) / qsatl(i)) * dz(i) &
     149             + ( rainclr(i) / MAX(thresh_precip_frac, precipfracclr(i)) )**( 1. - expo_eva ) &
     150               ) )**( 1. / ( 1. - expo_eva ) ) - rainclr(i)
     151             
     152    !--Evaporation is limited by 0
     153    draineva = MIN(0., draineva)
    146154
    147155
    148156    !--Sublimation of the solid precipitation coming from above
    149157    !--(same formula as for liquid precip)
    150     dsnowsub = - precipfracclr(i) * coef_sub * (1. - qvap(i) / qsati(i)) &
    151              * ( snowclr(i) / MAX(thresh_precip_frac, precipfracclr(i)) ) ** expo_sub &
    152              * temp(i) * RD / pplay(i) &
    153              * ( paprsdn(i) - paprsup(i) ) / RG
    154 
    155     !--Sublimation is limited by 0 and by the total water amount in
    156     !--the precipitation
     158    !--Explicit formulation
     159    !dsnowsub = - precipfracclr(i) * coef_sub * (1. - qvap(i) / qsatl(i)) * dz(i) &
     160    !         * ( snowclr(i) / MAX(thresh_precip_frac, precipfracclr(i)) ) ** expo_sub &
     161    !dsnowsub = MAX( - snowclr(i), dsnowsub)
     162    !--Exact explicit formulation (snowclr is resolved exactly, qvap explicitly)
     163    !--which does not need a barrier on snowclr, because included in the formula
     164    dsnowsub = precipfracclr(i) * ( MAX(0., &
     165             - coef_sub * ( 1. - expo_sub ) * (1. - qvap(i) / qsatl(i)) * dz(i) &
     166             + ( snowclr(i) / MAX(thresh_precip_frac, precipfracclr(i)) )**( 1. - expo_sub ) &
     167             ) )**( 1. / ( 1. - expo_sub ) ) - snowclr(i)
     168
     169    !--Sublimation is limited by 0
    157170    ! TODO: change max when we will allow for vapor deposition in supersaturated regions
    158     dsnowsub = MIN(0., MAX(dsnowsub, -snowclr(i)))
     171    dsnowsub = MIN(0., dsnowsub)
    159172
    160173    !--Evaporation limit: we ensure that the layer's fraction below
     
    166179   
    167180    dprecip_evasub_max = MIN(0., ( qvap(i) - qsat(i) ) * precipfracclr(i)) &
    168                      * hum_to_flux(i)
     181                     * dhum_to_dflux(i)
    169182    dprecip_evasub_tot = draineva + dsnowsub
    170183
     
    179192
    180193    !--New solid and liquid precipitation fluxes after evap and sublimation
    181     dqrevap = draineva / hum_to_flux(i)
    182     dqssubl = dsnowsub / hum_to_flux(i)
     194    dqrevap = draineva / dhum_to_dflux(i)
     195    dqssubl = dsnowsub / dhum_to_dflux(i)
    183196
    184197
     
    196209
    197210    !--Add tendencies
    198 
     211    !--The MAX is needed because in some cases, the flux can be slightly negative (numerical precision)
    199212    rainclr(i) = MAX(0., rainclr(i) + draineva)
    200213    snowclr(i) = MAX(0., snowclr(i) + dsnowsub)
     
    306319
    307320INTEGER :: i
    308 REAL, DIMENSION(klon) :: hum_to_flux
     321REAL, DIMENSION(klon) :: dhum_to_dflux
    309322REAL, DIMENSION(klon) :: qtot !--includes vap, liq, ice and precip
    310323
     
    371384  dqifreez= 0.
    372385
    373   !--hum_to_flux: coef to convert a delta in specific quantity to a flux
    374   !-- hum_to_flux = rho * dz/dt = 1 / g * dP/dt
    375   hum_to_flux(i) = ( paprsdn(i) - paprsup(i) ) / RG / dtime
     386  !--dhum_to_dflux: coef to convert a delta in specific quantity to a flux
     387  !-- dhum_to_dflux = rho * dz/dt = 1 / g * dP/dt
     388  dhum_to_dflux(i) = ( paprsdn(i) - paprsup(i) ) / RG / dtime
    376389  qtot(i) = qvap(i) + qliq(i) + qice(i) &
    377           + ( raincld(i) + rainclr(i) + snowcld(i) + snowclr(i) ) / hum_to_flux(i)
     390          + ( raincld(i) + rainclr(i) + snowcld(i) + snowclr(i) ) / dhum_to_dflux(i)
    378391
    379392  !------------------------------------------------------------
     
    457470
    458471  !--We add the tendencies
     472  !--The MAX is needed because in some cases, the flux can be slightly negative (numerical precision)
    459473  precipfraccld(i) = precipfraccld(i) + dprecipfraccld
    460474  precipfracclr(i) = precipfracclr(i) + dprecipfracclr
    461 
    462   rainclr(i) = MAX( 0. , rainclr(i) + drainclr )
    463   snowclr(i) = MAX( 0. , snowclr(i) + dsnowclr )
    464   raincld(i) = MAX( 0. , raincld(i) - drainclr )
    465   snowcld(i) = MAX( 0. , snowcld(i) - dsnowclr )
     475  rainclr(i) = MAX(0., rainclr(i) + drainclr)
     476  snowclr(i) = MAX(0., snowclr(i) + dsnowclr)
     477  raincld(i) = MAX(0., raincld(i) - drainclr)
     478  snowcld(i) = MAX(0., snowcld(i) - dsnowclr)
    466479 
    467480  !--If vertical heterogeneity is taken into account, we use
     
    501514    !--then simplified.
    502515
    503     !--The sticking efficacy is perfect.
     516    !--The collection efficiency is perfect.
    504517    Eff_rain_liq = 1.
    505518    coef_col = gamma_col * 3. / 4. / rho_rain / r_rain * Eff_rain_liq
    506     IF ((raincld(i) .GT. 0.) .AND. (coef_col .GT. 0.)) THEN
     519    IF ( raincld(i) .GT. 0. ) THEN
    507520      !-- ATTENTION Double implicit version
    508521      !-- BEWARE the formule below is FALSE (because raincld is a flux, not a delta flux)
    509       !qrain_tmp = raincld(i) / hum_to_flux(i)
     522      !qrain_tmp = raincld(i) / dhum_to_dflux(i)
    510523      !coef_tmp = coef_col * dtime * ( qrain_tmp / precipfraccld(i) + qliq(i) / eff_cldfra )
    511524      !dqlcol = qliq(i) * ( 1. / ( 1. + 0.5 * ( coef_tmp - 1. + SQRT( &
     
    521534      !--Add tendencies
    522535      qliq(i) = qliq(i) + dqlcol
    523       raincld(i) =  MAX( 0. , raincld(i) - dqlcol * hum_to_flux(i) )
     536      raincld(i) = raincld(i) - dqlcol * dhum_to_dflux(i)
    524537
    525538      !--Diagnostic tendencies
     
    532545    Eff_snow_ice = 0.05 * EXP( 0.1 * ( temp(i) - RTT ) )
    533546    coef_agg = gamma_agg * 3. / 4. / rho_snow / r_snow * Eff_snow_ice
    534     IF ((snowcld(i) .GT. 0.) .AND. (coef_agg .GT. 0.)) THEN
     547    IF ( snowcld(i) .GT. 0. ) THEN
    535548      !-- ATTENTION Double implicit version?
    536549      !--Barriers so that the processes do not consume more liquid/ice than
     
    543556      !--Add tendencies
    544557      qice(i) = qice(i) + dqiagg
    545       snowcld(i) = MAX( 0. , snowcld(i) - dqiagg * hum_to_flux(i) )
     558      snowcld(i) = snowcld(i) - dqiagg * dhum_to_dflux(i)
    546559
    547560      !--Diagnostic tendencies
     
    607620    qliq(i) = qliq(i) + dqlauto
    608621    qice(i) = qice(i) + dqiauto
    609     raincld(i) = MAX( 0. , raincld(i) - dqlauto * hum_to_flux(i) )
    610     snowcld(i) = MAX( 0. , snowcld(i) - dqiauto * hum_to_flux(i) )
     622    raincld(i) = raincld(i) - dqlauto * dhum_to_dflux(i)
     623    snowcld(i) = snowcld(i) - dqiauto * dhum_to_dflux(i)
    611624
    612625    !--Diagnostic tendencies
     
    628641    Eff_snow_liq = 0.2
    629642    coef_rim = gamma_rim * 3. / 4. / rho_snow / r_snow * Eff_snow_liq
    630     IF ((snowcld(i) .GT. 0.) .AND. (coef_rim .GT. 0.)) THEN
     643    IF ( snowcld(i) .GT. 0. ) THEN
    631644      !-- ATTENTION Double implicit version?
    632645      !--Barriers so that the processes do not consume more liquid than
     
    638651
    639652      !--Add tendencies
     653      !--The MAX is needed because in some cases, the flux can be slightly negative (numerical precision)
    640654      qliq(i) = qliq(i) + dqlrim
    641       snowcld(i) = MAX( 0. , snowcld(i) - dqlrim * hum_to_flux(i) )
     655      snowcld(i) = snowcld(i) - dqlrim * dhum_to_dflux(i)
    642656
    643657      !--Temperature adjustment with the release of latent
     
    706720
    707721      !--Barrier to limit the melting flux to the clr snow flux in the mesh
    708       dqsclrmelt = MAX( dqsclrmelt , -snowclr(i) / hum_to_flux(i))
     722      dqsclrmelt = MAX( dqsclrmelt , -snowclr(i) / dhum_to_dflux(i))
    709723    ENDIF
    710724
     
    720734
    721735      !--Barrier to limit the melting flux to the cld snow flux in the mesh
    722       dqscldmelt = MAX( dqscldmelt , -snowcld(i) / hum_to_flux(i))
     736      dqscldmelt = MAX(dqscldmelt , - snowcld(i) / dhum_to_dflux(i))
    723737    ENDIF
    724738   
     
    738752
    739753    !--Add tendencies
    740 
    741     rainclr(i) = MAX( 0. , rainclr(i) - dqsclrmelt * hum_to_flux(i) )
    742     raincld(i) = MAX( 0. , raincld(i) - dqscldmelt * hum_to_flux(i) )
    743     snowclr(i) = MAX( 0. , snowclr(i) + dqsclrmelt * hum_to_flux(i) )
    744     snowcld(i) = MAX( 0. , snowcld(i) + dqscldmelt * hum_to_flux(i) )
     754    !--The MAX is needed because in some cases, the flux can be slightly negative (numerical precision)
     755    rainclr(i) = MAX(0., rainclr(i) - dqsclrmelt * dhum_to_dflux(i))
     756    raincld(i) = MAX(0., raincld(i) - dqscldmelt * dhum_to_dflux(i))
     757    snowclr(i) = MAX(0., snowclr(i) + dqsclrmelt * dhum_to_dflux(i))
     758    snowcld(i) = MAX(0., snowcld(i) + dqscldmelt * dhum_to_dflux(i))
    745759
    746760
     
    792806    dqrtotfreez_step1 = 0.
    793807
    794     IF ((qice(i) .GT. 0.) .AND. (raincld(i) .GT. 0.)) THEN
     808    IF ( ( qice(i) .GT. 0. ) .AND. ( raincld(i) .GT. 0. ) ) THEN
    795809      dqrclrfreez = 0.
    796810      dqrcldfreez = 0.
     
    815829
    816830      !--We add the part of rain water that freezes, limited by a temperature barrier
    817       !-- this quantity is calculated assuming that the number of drop that freeze correspond to the number
    818       !-- of crystals collected (and assuming uniform distributions of ice crystals and rain drops)
    819       dqrcldfreez = MAX(dqifreez*rho_rain*r_rain/(rho_ice*r_ice),-raincld(i)/hum_to_flux(i))
     831      !--this quantity is calculated assuming that the number of drop that freeze correspond to the number
     832      !--of crystals collected (and assuming uniform distributions of ice crystals and rain drops)
     833      !--The ice specific humidity that collide with rain is dqi = dNi 4/3 PI rho_ice r_ice**3
     834      !--The rain that collide with ice is, similarly, dqr = dNr 4/3 PI rho_rain r_rain**3
     835      !--The assumption above corresponds to dNi = dNr, i.e.,
     836      !-- dqr = dqi * (4/3 PI rho_rain * r_rain**3) / (4/3 PI rho_ice * r_ice**3)
     837      dqrcldfreez = dqifreez * rho_rain * r_rain**3. / ( rho_ice * r_ice**3. )
     838      dqrcldfreez = MAX(dqrcldfreez, - raincld(i) / dhum_to_dflux(i))
    820839      dqrcldfreez = MAX(dqrcldfreez, dqrfreez_max)
    821840      dqrtotfreez_step1 = dqrcldfreez
    822841
    823842      !--Add tendencies
     843      !--The MAX is needed because in some cases, the flux can be slightly negative (numerical precision)
    824844      qice(i) = qice(i) + dqifreez
    825       raincld(i) = MAX( 0. , raincld(i) + dqrcldfreez * hum_to_flux(i) )
    826       snowcld(i) = MAX( 0. , snowcld(i) - dqrcldfreez * hum_to_flux(i) - dqifreez * hum_to_flux(i) )
     845      raincld(i) = MAX(0., raincld(i) + dqrcldfreez * dhum_to_dflux(i))
     846      snowcld(i) = MAX(0., snowcld(i) - dqrcldfreez * dhum_to_dflux(i) - dqifreez * dhum_to_dflux(i))
    827847      temp(i) = temp(i) - dqrtotfreez_step1 * RLMLT / RCPD &
    828                       / ( 1. + RVTMP2 * qtot(i) )
     848                        / ( 1. + RVTMP2 * qtot(i) )
    829849
    830850    ENDIF
     
    850870    IF ( rainclr(i) .GT. 0. ) THEN
    851871      !--Exact solution of dqrain/dt = -qrain/tau_freez
    852       dqrclrfreez = rainclr(i) / hum_to_flux(i) * ( EXP( - dtime / tau_freez ) - 1. )
     872      dqrclrfreez = rainclr(i) / dhum_to_dflux(i) * ( EXP( - dtime / tau_freez ) - 1. )
    853873    ENDIF
    854874
     
    856876    IF ( raincld(i) .GT. 0. ) THEN
    857877      !--Exact solution of dqrain/dt = -qrain/tau_freez
    858       dqrcldfreez = raincld(i) / hum_to_flux(i) * ( EXP( - dtime / tau_freez ) - 1. )
     878      dqrcldfreez = raincld(i) / dhum_to_dflux(i) * ( EXP( - dtime / tau_freez ) - 1. )
    859879    ENDIF
    860880
     
    874894
    875895    !--Add tendencies
    876     rainclr(i) = MAX( 0. , rainclr(i) + dqrclrfreez * hum_to_flux(i) )
    877     raincld(i) = MAX( 0. , raincld(i) + dqrcldfreez * hum_to_flux(i) )
    878     snowclr(i) = MAX( 0. , snowclr(i) - dqrclrfreez * hum_to_flux(i) )
    879     snowcld(i) = MAX( 0. , snowcld(i) - dqrcldfreez * hum_to_flux(i) )
     896    !--The MAX is needed because in some cases, the flux can be slightly negative (numerical precision)
     897    rainclr(i) = MAX(0., rainclr(i) + dqrclrfreez * dhum_to_dflux(i))
     898    raincld(i) = MAX(0., raincld(i) + dqrcldfreez * dhum_to_dflux(i))
     899    snowclr(i) = MAX(0., snowclr(i) - dqrclrfreez * dhum_to_dflux(i))
     900    snowcld(i) = MAX(0., snowcld(i) - dqrcldfreez * dhum_to_dflux(i))
    880901
    881902
     
    885906                      / ( 1. + RVTMP2 * qtot(i) )
    886907
    887     dqrtotfreez=dqrtotfreez_step1+dqrtotfreez_step2         
    888908    !--Diagnostic tendencies
     909    dqrtotfreez = dqrtotfreez_step1 + dqrtotfreez_step2         
    889910    dqrfreez(i) = dqrtotfreez / dtime
    890911    dqsfreez(i) = -(dqrtotfreez + dqifreez) / dtime
Note: See TracChangeset for help on using the changeset viewer.