source: trunk/LMDZ.MARS/libf/phymars/calltherm_mars.F90 @ 173

Last change on this file since 173 was 173, checked in by acolaitis, 14 years ago

Minor modifications related to thermals

File size: 5.9 KB
RevLine 
[161]1!
2! $Id: calltherm.F90 1428 2010-09-13 08:43:37Z fairhead $
3!
4      subroutine calltherm_mars(ngrid,nlayer,dtime,nq,zzlev,zzlay  &
5     &      ,pplay,paprs,pphi  &
6     &      ,u_seri,v_seri,t_seri,pq_therm,q2_therm  &
7     &      ,d_u_ajs,d_v_ajs,d_t_ajs,d_q_ajs,dq2_therm  &
8     &      ,fm_therm,entr_therm,detr_therm,lmax,&
9     &   zw2,fraca,zpopsk,ztla,heatFlux,heatFlux_down,&
[173]10     &     buoyancyOut,buoyancyEst,hfmax,wmax)
[161]11
12       USE thermcell, only : nsplit_thermals,r_aspect_thermals
13       USE ioipsl_getincom
14      implicit none
15
16      INTEGER, INTENT(IN) :: ngrid,nlayer
17      REAL dtime
18      LOGICAL logexpr0, logexpr2(ngrid,nlayer), logexpr1(ngrid)
19      REAL fact
20      INTEGER nbptspb,nq
21
22      REAL, INTENT(IN) :: zzlay(ngrid,nlayer)
23      REAL, INTENT(IN) :: zzlev(ngrid,nlayer+1)
24
25      REAL u_seri(ngrid,nlayer),v_seri(ngrid,nlayer)
26      REAL t_seri(ngrid,nlayer),pq_therm(ngrid,nlayer,nq)
27      REAL q2_therm(ngrid,nlayer)
28      REAL paprs(ngrid,nlayer+1)
29      REAL pplay(ngrid,nlayer)
30      REAL pphi(ngrid,nlayer)
31      real zlev(ngrid,nlayer+1)
32!test: on sort lentr et a* pour alimenter KE
33      REAL zw2(ngrid,nlayer+1),fraca(ngrid,nlayer+1)
34      REAL zzw2(ngrid,nlayer+1)
35
36!FH Update Thermiques
37      REAL d_t_ajs(ngrid,nlayer), d_q_ajs(ngrid,nlayer,nq)
38      REAL d_u_ajs(ngrid,nlayer),d_v_ajs(ngrid,nlayer)
39      REAL dq2_therm(ngrid,nlayer), dq2_the(ngrid,nlayer)
40      real fm_therm(ngrid,nlayer+1)
41      real entr_therm(ngrid,nlayer),detr_therm(ngrid,nlayer)
42
43!********************************************************
44!     declarations
45      real zpopsk(ngrid,nlayer)
46      real ztla(ngrid,nlayer)
[173]47      real wmax(ngrid)
48      real hfmax(ngrid)
[161]49      integer lmax(ngrid)
50
51!nouvelles variables pour la convection
52!RC
53      !on garde le zmax du pas de temps precedent
54!********************************************************
55
56
57! variables locales
58      REAL d_t_the(ngrid,nlayer), d_q_the(ngrid,nlayer,nq)
59      REAL d_u_the(ngrid,nlayer),d_v_the(ngrid,nlayer)
60!
61      integer isplit
62      real zfm_therm(ngrid,nlayer+1),zdt
63      real zentr_therm(ngrid,nlayer),zdetr_therm(ngrid,nlayer)
64      real heatFlux(ngrid,nlayer)
65      real heatFlux_down(ngrid,nlayer)
66      real buoyancyOut(ngrid,nlayer)
67      real buoyancyEst(ngrid,nlayer)
68      real zheatFlux(ngrid,nlayer)
69      real zheatFlux_down(ngrid,nlayer)
70      real zbuoyancyOut(ngrid,nlayer)
71      real zbuoyancyEst(ngrid,nlayer)
72
73      character (len=20) :: modname='calltherm'
74      character (len=80) :: abort_message
75
76      integer i,k
77      logical, save :: first=.true.
78
79!  Modele du thermique
80!  ===================
81
82         nsplit_thermals=20
83         call getin("nsplit_thermals",nsplit_thermals)
84
85         fm_therm(:,:)=0.
86         detr_therm(:,:)=0.
87         entr_therm(:,:)=0.
88
89         heatFlux(:,:)=0.
90         heatFlux_down(:,:)=0.
91         buoyancyOut(:,:)=0.
92         buoyancyEst(:,:)=0.
93
94         zw2(:,:)=0.
95
96         zdt=dtime/REAL(nsplit_thermals)
97
98         do isplit=1,nsplit_thermals
99
100! On reinitialise les flux de masse a zero pour le cumul en
101! cas de splitting
102
103         zfm_therm(:,:)=0.
104         zentr_therm(:,:)=0.
105         zdetr_therm(:,:)=0.
106
107         zheatFlux(:,:)=0.
108         zheatFlux_down(:,:)=0.
109         zbuoyancyOut(:,:)=0.
110         zbuoyancyEst(:,:)=0.
111
112         zzw2(:,:)=0.
113
114         d_t_the(:,:)=0.
115         d_u_the(:,:)=0.
116         d_v_the(:,:)=0.
117         dq2_the(:,:)=0.
118         if (nq .ne. 0) then
119            d_q_the(:,:,:)=0.
120         endif
121
122             CALL thermcell_main_mars(ngrid,nlayer,nq,zdt  &
123     &      ,pplay,paprs,pphi,zzlev,zzlay  &
124     &      ,u_seri,v_seri,t_seri,pq_therm,q2_therm  &
125     &      ,d_u_the,d_v_the,d_t_the,d_q_the,dq2_the  &
126     &      ,zfm_therm,zentr_therm,zdetr_therm,lmax  &
127     &      ,r_aspect_thermals &
128     &      ,zzw2,fraca,zpopsk &
129     &      ,ztla,zheatFlux,zheatFlux_down &
130     &      ,zbuoyancyOut,zbuoyancyEst)
131
132      fact=1./REAL(nsplit_thermals)
133!  transformation de la derivee en tendance
134
135            d_t_the(:,:)=d_t_the(:,:)*dtime*fact
136            d_u_the(:,:)=d_u_the(:,:)*fact
137            d_v_the(:,:)=d_v_the(:,:)*fact
138            dq2_the(:,:)=dq2_the(:,:)*fact           
139
140            if (nq .ne. 0) then
141               d_q_the(:,:,:)=d_q_the(:,:,:)*fact
142            endif
143
144            fm_therm(:,:)=fm_therm(:,:)  &
145     &      +zfm_therm(:,:)*fact
146            entr_therm(:,:)=entr_therm(:,:)  &
147     &       +zentr_therm(:,:)*fact
148            detr_therm(:,:)=detr_therm(:,:)  &
149     &       +zdetr_therm(:,:)*fact
150
151            heatFlux(:,:)=heatFlux(:,:) &
152     &       +zheatFlux(:,:)*fact
153            heatFlux_down(:,:)=heatFlux_down(:,:) &
[173]154     &       +zheatFlux_down(:,:)*fact
[161]155            buoyancyOut(:,:)=buoyancyOut(:,:) &
156     &       +zbuoyancyOut(:,:)*fact
157            buoyancyEst(:,:)=buoyancyEst(:,:) &
[173]158     &       +zbuoyancyEst(:,:)*fact
[161]159
160            zw2(:,:)=zw2(:,:) + zzw2(:,:)*fact
161
162!  accumulation de la tendance
163     
164            d_t_ajs(:,:)=d_t_ajs(:,:)+d_t_the(:,:)
165            d_u_ajs(:,:)=d_u_ajs(:,:)+d_u_the(:,:)
166            d_v_ajs(:,:)=d_v_ajs(:,:)+d_v_the(:,:)
167            d_q_ajs(:,:,:)=d_q_ajs(:,:,:)+d_q_the(:,:,:)
168            dq2_therm(:,:)=dq2_therm(:,:)+dq2_the(:,:)
169!  incrementation des variables meteo
170     
171            t_seri(:,:) = t_seri(:,:) + d_t_the(:,:)
172            u_seri(:,:) = u_seri(:,:) + d_u_the(:,:)
173            v_seri(:,:) = v_seri(:,:) + d_v_the(:,:)
174            pq_therm(:,:,:) = pq_therm(:,:,:) + d_q_the(:,:,:)
175            q2_therm(:,:) = q2_therm(:,:) + dq2_therm(:,:)
176
177         enddo ! isplit
178
179     
180!****************************************************************
181
182!          do i=1,ngrid
183!             do k=1,nlayer
184!                if (ztla(i,k) .lt. 1.e-10) fraca(i,k) =0.
185!               print*,'youpi je sers a quelque chose !'
186!             enddo
187!          enddo
[173]188       
189          DO i=1,ngrid
190            hfmax(i)=MAXVAL(heatFlux(i,:)+heatFlux_down(i,:))
191            wmax(i)=MAXVAL(zw2(i,:))
192          ENDDO
193 
[161]194      return
195
196      end
Note: See TracBrowser for help on using the repository browser.