| 1 | ! |
|---|
| 2 | ! |
|---|
| 3 | ! |
|---|
| 4 | SUBROUTINE thermcell_env(ngrid,nlay,po,pt,pu,pv,pplay, & |
|---|
| 5 | & pplev,zo,zh,zl,ztv,zthl,zu,zv,zpspsk,pqsat,lev_out) |
|---|
| 6 | |
|---|
| 7 | !============================================================================== |
|---|
| 8 | ! thermcell_env: calcule les caracteristiques de l environnement |
|---|
| 9 | ! necessaires au calcul des proprietes dans le thermique |
|---|
| 10 | !============================================================================== |
|---|
| 11 | |
|---|
| 12 | USE print_control_mod, ONLY: prt_level |
|---|
| 13 | USE thermcell_mod, ONLY: RKAPPA |
|---|
| 14 | USE watercommon_h, ONLY: RLvCp, RETV, Psat_water |
|---|
| 15 | USE planete_mod, ONLY: preff |
|---|
| 16 | |
|---|
| 17 | IMPLICIT NONE |
|---|
| 18 | |
|---|
| 19 | !============================================================================== |
|---|
| 20 | ! Declaration |
|---|
| 21 | !============================================================================== |
|---|
| 22 | |
|---|
| 23 | ! inputs: |
|---|
| 24 | ! ------- |
|---|
| 25 | |
|---|
| 26 | INTEGER ngrid |
|---|
| 27 | INTEGER nlay |
|---|
| 28 | INTEGER lev_out ! niveau pour les print |
|---|
| 29 | |
|---|
| 30 | REAL po(ngrid,nlay) ! large scale water |
|---|
| 31 | REAL pt(ngrid,nlay) ! large scale temperature |
|---|
| 32 | REAL pu(ngrid,nlay) ! large scale zonal wind |
|---|
| 33 | REAL pv(ngrid,nlay) ! large scale meridional wind |
|---|
| 34 | REAL pplay(ngrid,nlay) ! layers pressure |
|---|
| 35 | REAL pplev(ngrid,nlay+1) ! levels pressure |
|---|
| 36 | |
|---|
| 37 | ! outputs: |
|---|
| 38 | ! -------- |
|---|
| 39 | |
|---|
| 40 | REAL zo(ngrid,nlay) ! qt environment |
|---|
| 41 | REAL zl(ngrid,nlay) ! ql environment |
|---|
| 42 | REAL zh(ngrid,nlay) ! T environment |
|---|
| 43 | REAL ztv(ngrid,nlay) ! TV environment |
|---|
| 44 | REAL zthl(ngrid,nlay) ! TPV environment |
|---|
| 45 | REAL zu(ngrid,nlay) ! u environment |
|---|
| 46 | REAL zv(ngrid,nlay) ! v environment |
|---|
| 47 | |
|---|
| 48 | REAL zpspsk(ngrid,nlay) ! Exner function |
|---|
| 49 | REAL pqsat(ngrid,nlay) ! saturation vapor pressure |
|---|
| 50 | |
|---|
| 51 | ! local: |
|---|
| 52 | ! ------ |
|---|
| 53 | |
|---|
| 54 | INTEGER ig, ll |
|---|
| 55 | |
|---|
| 56 | REAL dummy |
|---|
| 57 | |
|---|
| 58 | !============================================================================== |
|---|
| 59 | ! Initialization |
|---|
| 60 | !============================================================================== |
|---|
| 61 | |
|---|
| 62 | !------------------------------------------------------------------------------ |
|---|
| 63 | ! Calcul des caracteristiques de l'environnement |
|---|
| 64 | !------------------------------------------------------------------------------ |
|---|
| 65 | DO ll=1,nlay |
|---|
| 66 | DO ig=1,ngrid |
|---|
| 67 | zo(ig,ll) = po(ig,ll) |
|---|
| 68 | zl(ig,ll) = 0. |
|---|
| 69 | zh(ig,ll) = pt(ig,ll) |
|---|
| 70 | ENDDO |
|---|
| 71 | ENDDO |
|---|
| 72 | |
|---|
| 73 | !============================================================================== |
|---|
| 74 | ! Computation of qsat and condensation |
|---|
| 75 | !============================================================================== |
|---|
| 76 | |
|---|
| 77 | DO ll=1,nlay |
|---|
| 78 | DO ig=1,ngrid |
|---|
| 79 | CALL Psat_water(pt(ig,ll), pplev(ig,ll), dummy, pqsat(ig,ll)) |
|---|
| 80 | ENDDO |
|---|
| 81 | ENDDO |
|---|
| 82 | |
|---|
| 83 | DO ll=1,nlay |
|---|
| 84 | DO ig=1,ngrid |
|---|
| 85 | zl(ig,ll) = max(0.,po(ig,ll) - pqsat(ig,ll)) ! zl set to ql env |
|---|
| 86 | zh(ig,ll) = pt(ig,ll) + RLvCp * zl(ig,ll) ! zh set to TR env |
|---|
| 87 | zo(ig,ll) = po(ig,ll) - zl(ig,ll) ! zo set to qv env |
|---|
| 88 | ENDDO |
|---|
| 89 | ENDDO |
|---|
| 90 | |
|---|
| 91 | DO ll=1,nlay |
|---|
| 92 | DO ig=1,ngrid |
|---|
| 93 | zpspsk(ig,ll) = (pplay(ig,ll)/preff)**RKAPPA |
|---|
| 94 | zu(ig,ll) = pu(ig,ll) |
|---|
| 95 | zv(ig,ll) = pv(ig,ll) |
|---|
| 96 | |
|---|
| 97 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 98 | ! AB : WARNING, zh is no longer the potentiel temperature. |
|---|
| 99 | ! It is now the temperature. How awful! |
|---|
| 100 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 101 | ztv(ig,ll) = zh(ig,ll)/zpspsk(ig,ll) ! ztv set to TRP env |
|---|
| 102 | ztv(ig,ll) = ztv(ig,ll)*(1.+RETV*(zo(ig,ll))-zl(ig,ll)) ! ztv set to TRPV env |
|---|
| 103 | zthl(ig,ll) = pt(ig,ll)/zpspsk(ig,ll) ! zthl set to TP env |
|---|
| 104 | |
|---|
| 105 | ENDDO |
|---|
| 106 | ENDDO |
|---|
| 107 | |
|---|
| 108 | |
|---|
| 109 | RETURN |
|---|
| 110 | END |
|---|