| 1 | ! |
|---|
| 2 | ! |
|---|
| 3 | ! |
|---|
| 4 | SUBROUTINE thermcell_env(ngrid,nlay,nq,pq,pt,pu,pv,pplay,pplev, & |
|---|
| 5 | zqt,zql,zt,ztv,zhl,zu,zv,zpopsk,zqs) |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | !=============================================================================== |
|---|
| 9 | ! Purpose: calcul des caracteristiques de l'environnement necessaires au calcul |
|---|
| 10 | ! des proprietes dans le thermique. |
|---|
| 11 | ! |
|---|
| 12 | ! Modif 2019/04 (AB alexandre.boissinot@lmd.jussieu.fr) |
|---|
| 13 | ! |
|---|
| 14 | ! Nota Bene |
|---|
| 15 | ! ql means "non-gaseous water mass mixing ratio" (liquid and solid) |
|---|
| 16 | ! qv means "vapor mass mixing ratio" |
|---|
| 17 | ! qt means "total water mass mixing ratio" |
|---|
| 18 | ! TP means "potential temperature" |
|---|
| 19 | ! TRPV means "virtual potential temperature with latent heat release" |
|---|
| 20 | ! TPV means "virtual potential temperature" |
|---|
| 21 | ! TR means "temperature with latent heat release" |
|---|
| 22 | !=============================================================================== |
|---|
| 23 | |
|---|
| 24 | USE print_control_mod, ONLY: prt_level |
|---|
| 25 | USE thermcell_mod, ONLY: RKAPPA |
|---|
| 26 | USE watercommon_h, ONLY: RLvCp, RETV, Psat_water |
|---|
| 27 | USE tracer_h, ONLY: igcm_h2o_vap, igcm_h2o_ice |
|---|
| 28 | USE callkeys_mod, ONLY: water |
|---|
| 29 | |
|---|
| 30 | IMPLICIT NONE |
|---|
| 31 | |
|---|
| 32 | |
|---|
| 33 | !=============================================================================== |
|---|
| 34 | ! Declaration |
|---|
| 35 | !=============================================================================== |
|---|
| 36 | |
|---|
| 37 | ! Inputs: |
|---|
| 38 | ! ------- |
|---|
| 39 | |
|---|
| 40 | INTEGER, INTENT(in) :: ngrid |
|---|
| 41 | INTEGER, INTENT(in) :: nlay |
|---|
| 42 | INTEGER, INTENT(in) :: nq |
|---|
| 43 | |
|---|
| 44 | REAL, INTENT(in) :: pq(ngrid,nlay,nq) ! Large scale water |
|---|
| 45 | REAL, INTENT(in) :: pt(ngrid,nlay) ! Large scale temperature |
|---|
| 46 | REAL, INTENT(in) :: pu(ngrid,nlay) ! Large scale zonal wind |
|---|
| 47 | REAL, INTENT(in) :: pv(ngrid,nlay) ! Large scale meridional wind |
|---|
| 48 | REAL, INTENT(in) :: pplay(ngrid,nlay) ! Layers pressure |
|---|
| 49 | REAL, INTENT(in) :: pplev(ngrid,nlay+1) ! Levels pressure |
|---|
| 50 | REAL, INTENT(in) :: zpopsk(ngrid,nlay) ! Exner function |
|---|
| 51 | |
|---|
| 52 | ! Outputs: |
|---|
| 53 | ! -------- |
|---|
| 54 | |
|---|
| 55 | REAL, INTENT(out) :: zt(ngrid,nlay) ! T environment |
|---|
| 56 | REAL, INTENT(out) :: ztv(ngrid,nlay) ! TRPV environment |
|---|
| 57 | REAL, INTENT(out) :: zhl(ngrid,nlay) ! TP environment |
|---|
| 58 | REAL, INTENT(out) :: zu(ngrid,nlay) ! u environment |
|---|
| 59 | REAL, INTENT(out) :: zv(ngrid,nlay) ! v environment |
|---|
| 60 | REAL, INTENT(out) :: zqt(ngrid,nlay) ! qt environment |
|---|
| 61 | REAL, INTENT(out) :: zql(ngrid,nlay) ! ql environment |
|---|
| 62 | REAL, INTENT(out) :: zqs(ngrid,nlay) ! qsat environment |
|---|
| 63 | |
|---|
| 64 | ! Local: |
|---|
| 65 | ! ------ |
|---|
| 66 | |
|---|
| 67 | INTEGER ig, k |
|---|
| 68 | |
|---|
| 69 | REAL psat ! Dummy argument for Psat_water() |
|---|
| 70 | |
|---|
| 71 | !=============================================================================== |
|---|
| 72 | ! Initialization |
|---|
| 73 | !=============================================================================== |
|---|
| 74 | |
|---|
| 75 | zu(:,:) = pu(:,:) |
|---|
| 76 | zv(:,:) = pv(:,:) |
|---|
| 77 | |
|---|
| 78 | zhl(:,:) = pt(:,:) / zpopsk(:,:) |
|---|
| 79 | |
|---|
| 80 | zqt(:,:) = 0. |
|---|
| 81 | zql(:,:) = 0. |
|---|
| 82 | |
|---|
| 83 | !=============================================================================== |
|---|
| 84 | ! Condensation and latent heat release |
|---|
| 85 | !=============================================================================== |
|---|
| 86 | |
|---|
| 87 | IF (water) THEN |
|---|
| 88 | |
|---|
| 89 | zqt(:,:) = pq(:,:,igcm_h2o_vap) |
|---|
| 90 | |
|---|
| 91 | DO k=1,nlay |
|---|
| 92 | DO ig=1,ngrid |
|---|
| 93 | CALL Psat_water(pt(ig,k), pplev(ig,k), psat, zqs(ig,k)) |
|---|
| 94 | ENDDO |
|---|
| 95 | ENDDO |
|---|
| 96 | |
|---|
| 97 | DO k=1,nlay |
|---|
| 98 | DO ig=1,ngrid |
|---|
| 99 | zql(ig,k) = max(0.,pq(ig,k,igcm_h2o_vap) - zqs(ig,k)) |
|---|
| 100 | zt(ig,k) = pt(ig,k) + RLvCp * zql(ig,k) |
|---|
| 101 | ztv(ig,k) = zt(ig,k) / zpopsk(ig,k) & |
|---|
| 102 | & * (1. + RETV * (zqt(ig,k)-zql(ig,k)) - zql(ig,k)) |
|---|
| 103 | ENDDO |
|---|
| 104 | ENDDO |
|---|
| 105 | |
|---|
| 106 | ELSE |
|---|
| 107 | |
|---|
| 108 | zt(:,:) = pt(:,:) |
|---|
| 109 | ztv(:,:) = pt(:,:) / zpopsk(:,:) |
|---|
| 110 | |
|---|
| 111 | ENDIF |
|---|
| 112 | |
|---|
| 113 | |
|---|
| 114 | RETURN |
|---|
| 115 | END |
|---|