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

Last change on this file since 786 was 786, checked in by jleconte, 13 years ago

19/09/2012 == JL

  • Correction in largescale to improve robustness when large water vapor amount
  • Correction in soil_setting to allow change of the number of subsurface layers


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