source: trunk/LMDZ.GENERIC/libf/phystd/largescale.F90 @ 937

Last change on this file since 937 was 875, checked in by jleconte, 12 years ago

11/02/2013 == JL

  • Updated moist convection scheme to handle situations with a large water vapor content
  • Added a keyword to enable ocean runoff in callphys.def (activerunoff)


File size: 5.8 KB
Line 
1      subroutine largescale(ngrid,nq,ptimestep, pplev, pplay, pt, pq,   &
2                        pdt, pdq, pdtlsc, pdqvaplsc, pdqliqlsc, rneb)
3
4      use watercommon_h, only : RLVTT, RCPD, RVTMP2,  &
5          T_h2O_ice_clouds,T_h2O_ice_liq,Psat_water,Lcpdqsat_water
6      USE tracer_h
7      IMPLICIT none
8
9!==================================================================
10!     
11!     Purpose
12!     -------
13!     Calculates large-scale (stratiform) H2O condensation.
14!     
15!     Authors
16!     -------
17!     Adapted from the LMDTERRE code by R. Wordsworth (2009)
18!     Original author Z. X. Li (1993)
19!     
20!==================================================================
21
22#include "dimensions.h"
23#include "dimphys.h"
24#include "comcstfi.h"
25
26#include "callkeys.h"
27
28      INTEGER ngrid,nq
29
30!     Arguments
31      REAL ptimestep                 ! intervalle du temps (s)
32      REAL pplev(ngrid,nlayermx+1) ! pression a inter-couche
33      REAL pplay(ngrid,nlayermx)   ! pression au milieu de couche
34      REAL pt(ngrid,nlayermx)      ! temperature (K)
35      real pq(ngrid,nlayermx,nq) ! tracer mixing ratio (kg/kg)
36      REAL pdt(ngrid,nlayermx)     ! physical temperature tenedency (K/s)
37      REAL pdq(ngrid,nlayermx,nq)! physical tracer tenedency (K/s)
38      REAL pdtlsc(ngrid,nlayermx)  ! incrementation de la temperature (K)
39      REAL pdqvaplsc(ngrid,nlayermx) ! incrementation de la vapeur d'eau
40      REAL pdqliqlsc(ngrid,nlayermx) ! incrementation de l'eau liquide
41      REAL rneb(ngrid,nlayermx)    ! fraction nuageuse
42
43
44!     Options du programme
45      REAL ratqs   ! determine largeur de la distribution de vapeur
46      PARAMETER (ratqs=0.2)
47
48!     Variables locales
49      REAL CBRT
50      EXTERNAL CBRT
51      INTEGER i, k , nn
52      INTEGER,PARAMETER :: nitermax=2000
53      REAL,PARAMETER :: alpha=.5,qthreshold=1.e-6
54      ! JL13: if "careful, T<Tmin in psat water" appears often, you may want to stabilise the model by
55      !                   decreasing alpha and increasing nitermax accordingly
56      REAL zt(ngrid), zq(ngrid)
57      REAL zcond(ngrid),zcond_iter
58      REAL zdelq(ngrid)
59      REAL zqs(ngrid), zdqs(ngrid)
60      REAL psat_tmp,dlnpsat_tmp
61     
62! evaporation calculations
63      REAL dqevap(ngrid,nlayermx),dtevap(ngrid,nlayermx)     
64      REAL qevap(ngrid,nlayermx,nq)
65      REAL tevap(ngrid,nlayermx)
66
67      REAL zcor(ngrid), zdelta(ngrid), zcvm5(ngrid)
68      REAL zx_q(ngrid)
69      REAL Nmix_local,zfice
70
71!     GCM -----> subroutine variables, initialisation of outputs
72
73      pdtlsc(1:ngrid,1:nlayermx)  = 0.0
74      pdqvaplsc(1:ngrid,1:nlayermx)  = 0.0
75      pdqliqlsc(1:ngrid,1:nlayermx) = 0.0
76      rneb(1:ngrid,1:nlayermx) = 0.0
77
78
79      ! Evaporate cloud water/ice
80      call evap(ngrid,nq,ptimestep,pt,pq,pdq,pdt,dqevap,dtevap,qevap,tevap)
81      ! note: we use qevap but not tevap in largescale/moistadj
82            ! otherwise is a big mess
83
84
85!  Boucle verticale (du haut vers le bas)
86   DO k = nlayermx, 1, -1
87
88      zt(1:ngrid)=pt(1:ngrid,k)+(pdt(1:ngrid,k)+dtevap(1:ngrid,k))*ptimestep
89      zq(1:ngrid)=qevap(1:ngrid,k,igcm_h2o_vap) !liquid water is included in qevap
90
91!     Calculer la vapeur d'eau saturante et
92!     determiner la condensation partielle
93      DO i = 1, ngrid
94
95         if(zt(i).le.15.) then
96            print*,'in lsc',i,k,zt(i)
97!           zt(i)=15.   ! check too low temperatures
98         endif
99         call Psat_water(zt(i),pplay(i,k),psat_tmp,zqs(i))
100 
101         zdelq(i) = MAX(MIN(ratqs * zq(i),1.-zq(i)),1.e-12)
102         rneb(i,k) = (zq(i)+zdelq(i)-zqs(i)) / (2.0*zdelq(i))
103!        print*,zq(i),zdelq(i),zqs(i),rneb(i,k)
104         if (rneb(i,k).lt.0.) then  !no clouds
105
106            rneb(i,k)=0.
107            zcond(i)=0.
108
109         else if (rneb(i,k).gt.1.) then    !complete cloud cover, we start without evaporating
110
111            rneb(i,k)=1.
112            zt(i)=pt(i,k)+pdt(i,k)*ptimestep
113            zx_q(i) = pq(i,k,igcm_h2o_vap)+pdq(i,k,igcm_h2o_vap)*ptimestep
114            dqevap(i,k)=0.
115!           iterative process to stabilize the scheme when large water amounts JL12
116            zcond(i) = 0.0
117            Do nn=1,nitermax 
118               call Psat_water(zt(i),pplay(i,k),psat_tmp,zqs(i))
119               call Lcpdqsat_water(zt(i),pplay(i,k),psat_tmp,zqs(i),zdqs(i),dlnpsat_tmp)
120               zcond_iter = alpha*(zx_q(i)-zqs(i))/(1.+zdqs(i))   
121                  !zcond can be negative here
122               zx_q(i) = zx_q(i) - zcond_iter
123               zcond(i) = zcond(i) + zcond_iter
124               zt(i) = zt(i) + zcond_iter*RLVTT/RCPD
125               if (ABS(zcond_iter/alpha).lt.qthreshold) exit
126            End do ! niter
127            zcond(i)=MAX(zcond(i),-(pq(i,k,igcm_h2o_ice)+pdq(i,k,igcm_h2o_ice)*ptimestep))
128
129         else   !standard case     
130
131            zx_q(i) = (zq(i)+zdelq(i)+zqs(i))/2.0 !water vapor in cloudy sky
132!           iterative process to stabilize the scheme when large water amounts JL12
133            zcond(i) = 0.0
134            Do nn=1,nitermax 
135               call Lcpdqsat_water(zt(i),pplay(i,k),psat_tmp,zqs(i),zdqs(i),dlnpsat_tmp)
136               zcond_iter = MAX(0.0,alpha*(zx_q(i)-zqs(i))/(1.+zdqs(i)))           
137                  !zcond always postive! cannot evaporate clouds!
138                  !this is why we must reevaporate before largescale
139               zx_q(i) = zx_q(i) - zcond_iter
140               zcond(i) = zcond(i) + zcond_iter
141               if (ABS(zcond_iter/alpha).lt.qthreshold) exit
142               zt(i) = zt(i) + zcond_iter*RLVTT/RCPD*rneb(i,k)
143               call Psat_water(zt(i),pplay(i,k),psat_tmp,zqs(i))
144            End do ! niter
145
146         Endif
147
148         zcond(i) = zcond(i)*rneb(i,k)/ptimestep ! JL12
149
150      ENDDO
151
152!     Tendances de t et q
153         pdqvaplsc(1:ngrid,k)  = dqevap(1:ngrid,k) - zcond(1:ngrid)
154         pdqliqlsc(1:ngrid,k) = - pdqvaplsc(1:ngrid,k)
155         pdtlsc(1:ngrid,k)  = pdqliqlsc(1:ngrid,k)*RLVTT/RCPD
156
157   Enddo ! k= nlayermx, 1, -1
158   
159      !print*,'qsat=',zqs
160      !print*,'q=',q
161      !print*,'dq=',pdqvaplsc*ptimestep
162      !print*,'dT in LS=',pdtlsc*ptimestep
163
164      !print*,'rice=',rice
165      !print*,'rneb=',rneb
166
167      return
168      end
Note: See TracBrowser for help on using the repository browser.