/[lmdze]/trunk/dyn3d/leapfrog.f
ViewVC logotype

Diff of /trunk/dyn3d/leapfrog.f

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/libf/dyn3d/leapfrog.f90 revision 70 by guez, Mon Jun 24 15:39:52 2013 UTC trunk/dyn3d/leapfrog.f revision 102 by guez, Tue Jul 15 13:43:24 2014 UTC
# Line 53  contains Line 53  contains
53    
54      REAL, intent(in):: time_0      REAL, intent(in):: time_0
55    
56      ! Variables local to the procedure:      ! Local:
57    
58      ! Variables dynamiques:      ! Variables dynamiques:
59    
60      REAL pks(iim + 1, jjm + 1) ! exner au sol      REAL pks(iim + 1, jjm + 1) ! exner au sol
61      REAL pk(iim + 1, jjm + 1, llm) ! exner au milieu des couches      REAL pk(iim + 1, jjm + 1, llm) ! exner au milieu des couches
62      REAL pkf(iim + 1, jjm + 1, llm) ! exner filtré au milieu des couches      REAL pkf(iim + 1, jjm + 1, llm) ! exner filtr\'e au milieu des couches
63      REAL phi(iim + 1, jjm + 1, llm) ! geopotential      REAL phi(iim + 1, jjm + 1, llm) ! geopotential
64      REAL w((iim + 1) * (jjm + 1), llm) ! vitesse verticale      REAL w(iim + 1, jjm + 1, llm) ! vitesse verticale
65    
66      ! Variables dynamiques intermediaire pour le transport      ! Variables dynamiques intermediaire pour le transport
67      ! Flux de masse :      ! Flux de masse :
68      REAL pbaru((iim + 1) * (jjm + 1), llm), pbarv((iim + 1) * jjm, llm)      REAL pbaru(iim + 1, jjm + 1, llm), pbarv(iim + 1, jjm, llm)
69    
70      ! Variables dynamiques au pas - 1      ! Variables dynamiques au pas - 1
71      REAL vcovm1(iim + 1, jjm, llm), ucovm1(iim + 1, jjm + 1, llm)      REAL vcovm1(iim + 1, jjm, llm), ucovm1(iim + 1, jjm + 1, llm)
# Line 73  contains Line 73  contains
73      REAL massem1(iim + 1, jjm + 1, llm)      REAL massem1(iim + 1, jjm + 1, llm)
74    
75      ! Tendances dynamiques      ! Tendances dynamiques
76      REAL dv((iim + 1) * jjm, llm), dudyn((iim + 1) * (jjm + 1), llm)      REAL dv((iim + 1) * jjm, llm), dudyn(iim + 1, jjm + 1, llm)
77      REAL dteta(iim + 1, jjm + 1, llm), dq((iim + 1) * (jjm + 1), llm, nqmx)      REAL dteta(iim + 1, jjm + 1, llm)
78      real dp((iim + 1) * (jjm + 1))      real dp((iim + 1) * (jjm + 1))
79    
80      ! Tendances de la dissipation :      ! Tendances de la dissipation :
# Line 82  contains Line 82  contains
82      REAL dtetadis(iim + 1, jjm + 1, llm)      REAL dtetadis(iim + 1, jjm + 1, llm)
83    
84      ! Tendances physiques      ! Tendances physiques
85      REAL dvfi((iim + 1) * jjm, llm), dufi((iim + 1) * (jjm + 1), llm)      REAL dvfi(iim + 1, jjm, llm), dufi(iim + 1, jjm + 1, llm)
86      REAL dtetafi(iim + 1, jjm + 1, llm), dqfi((iim + 1) * (jjm + 1), llm, nqmx)      REAL dtetafi(iim + 1, jjm + 1, llm), dqfi(iim + 1, jjm + 1, llm, nqmx)
     real dpfi((iim + 1) * (jjm + 1))  
87    
88      ! Variables pour le fichier histoire      ! Variables pour le fichier histoire
89    
# Line 95  contains Line 94  contains
94      INTEGER l      INTEGER l
95      REAL rdayvrai, rdaym_ini      REAL rdayvrai, rdaym_ini
96    
97      ! Variables test conservation energie      ! Variables test conservation \'energie
98      REAL ecin(iim + 1, jjm + 1, llm), ecin0(iim + 1, jjm + 1, llm)      REAL ecin(iim + 1, jjm + 1, llm), ecin0(iim + 1, jjm + 1, llm)
99    
100      REAL vcont((iim + 1) * jjm, llm), ucont((iim + 1) * (jjm + 1), llm)      REAL vcont((iim + 1) * jjm, llm), ucont((iim + 1) * (jjm + 1), llm)
101      logical leapf      logical leapf
102      real dt      real dt ! time step, in s
103    
104      !---------------------------------------------------      !---------------------------------------------------
105    
# Line 110  contains Line 109  contains
109      itaufin = nday * day_step      itaufin = nday * day_step
110      ! "day_step" is a multiple of "iperiod", therefore so is "itaufin".      ! "day_step" is a multiple of "iperiod", therefore so is "itaufin".
111    
     dq = 0.  
   
112      ! On initialise la pression et la fonction d'Exner :      ! On initialise la pression et la fonction d'Exner :
113      forall (l = 1: llm + 1) p3d(:, :, l) = ap(l) + bp(l) * ps      forall (l = 1: llm + 1) p3d(:, :, l) = ap(l) + bp(l) * ps
114      CALL exner_hyb(ps, p3d, pks, pk, pkf)      CALL exner_hyb(ps, p3d, pks, pk, pkf)
# Line 123  contains Line 120  contains
120         else         else
121            ! Matsuno            ! Matsuno
122            dt = dtvr            dt = dtvr
123            if (ok_guide .and. (itaufin - itau - 1) * dtvr > 21600.) &            if (ok_guide .and. itaufin - itau - 1 > day_step / 4) &
124                 call guide(itau, ucov, vcov, teta, q, masse, ps)                 call guide(itau, ucov, vcov, teta, q, ps)
125            vcovm1 = vcov            vcovm1 = vcov
126            ucovm1 = ucov            ucovm1 = ucov
127            tetam1 = teta            tetam1 = teta
# Line 138  contains Line 135  contains
135         CALL geopot(teta, pk, pks, phis, phi)         CALL geopot(teta, pk, pks, phis, phi)
136         CALL caldyn(itau, ucov, vcov, teta, ps, masse, pk, pkf, phis, phi, &         CALL caldyn(itau, ucov, vcov, teta, ps, masse, pk, pkf, phis, phi, &
137              dudyn, dv, dteta, dp, w, pbaru, pbarv, time_0, &              dudyn, dv, dteta, dp, w, pbaru, pbarv, time_0, &
138              conser=MOD(itau, iconser)==0)              conser = MOD(itau, iconser) == 0)
139    
140         ! Calcul des tendances advection des traceurs (dont l'humidité)         CALL caladvtrac(q, pbaru, pbarv, p3d, masse, teta, pk)
        CALL caladvtrac(q, pbaru, pbarv, p3d, masse, dq, teta, pk)  
141    
142         ! Stokage du flux de masse pour traceurs offline:         ! Stokage du flux de masse pour traceurs offline:
143         IF (offline) CALL fluxstokenc(pbaru, pbarv, masse, teta, phi, phis, &         IF (offline) CALL fluxstokenc(pbaru, pbarv, masse, teta, phi, phis, &
144              dtvr, itau)              dtvr, itau)
145    
146         ! Intégrations dynamique et traceurs:         ! Int\'egrations dynamique et traceurs:
147         CALL integrd(vcovm1, ucovm1, tetam1, psm1, massem1, dv, dudyn, dteta, &         CALL integrd(vcovm1, ucovm1, tetam1, psm1, massem1, dv, dudyn, dteta, &
148              dp, vcov, ucov, teta, q(:, :, :, :2), ps, masse, finvmaold, dt, &              dp, vcov, ucov, teta, q(:, :, :, :2), ps, masse, finvmaold, dt, &
149              leapf)              leapf)
150    
151           forall (l = 1: llm + 1) p3d(:, :, l) = ap(l) + bp(l) * ps
152           CALL exner_hyb(ps, p3d, pks, pk, pkf)
153    
154         if (.not. leapf) then         if (.not. leapf) then
155            ! Matsuno backward            ! Matsuno backward
           forall (l = 1: llm + 1) p3d(:, :, l) = ap(l) + bp(l) * ps  
           CALL exner_hyb(ps, p3d, pks, pk, pkf)  
   
156            ! Calcul des tendances dynamiques:            ! Calcul des tendances dynamiques:
157            CALL geopot(teta, pk, pks, phis, phi)            CALL geopot(teta, pk, pks, phis, phi)
158            CALL caldyn(itau + 1, ucov, vcov, teta, ps, masse, pk, pkf, phis, &            CALL caldyn(itau + 1, ucov, vcov, teta, ps, masse, pk, pkf, phis, &
159                 phi, dudyn, dv, dteta, dp, w, pbaru, pbarv, time_0, &                 phi, dudyn, dv, dteta, dp, w, pbaru, pbarv, time_0, &
160                 conser=.false.)                 conser = .false.)
161    
162            ! integrations dynamique et traceurs:            ! integrations dynamique et traceurs:
163            CALL integrd(vcovm1, ucovm1, tetam1, psm1, massem1, dv, dudyn, &            CALL integrd(vcovm1, ucovm1, tetam1, psm1, massem1, dv, dudyn, &
164                 dteta, dp, vcov, ucov, teta, q(:, :, :, :2), ps, masse, &                 dteta, dp, vcov, ucov, teta, q(:, :, :, :2), ps, masse, &
165                 finvmaold, dtvr, leapf=.false.)                 finvmaold, dtvr, leapf=.false.)
166    
167              forall (l = 1: llm + 1) p3d(:, :, l) = ap(l) + bp(l) * ps
168              CALL exner_hyb(ps, p3d, pks, pk, pkf)
169         end if         end if
170    
171         IF (MOD(itau + 1, iphysiq) == 0 .AND. iflag_phys /= 0) THEN         IF (MOD(itau + 1, iphysiq) == 0 .AND. iflag_phys /= 0) THEN
172            ! Calcul des tendances physiques:            ! Calcul des tendances physiques:
173    
           forall (l = 1: llm + 1) p3d(:, :, l) = ap(l) + bp(l) * ps  
           CALL exner_hyb(ps, p3d, pks, pk, pkf)  
   
174            rdaym_ini = itau * dtvr / daysec            rdaym_ini = itau * dtvr / daysec
175            rdayvrai = rdaym_ini + day_ini            rdayvrai = rdaym_ini + day_ini
176            time = REAL(mod(itau, day_step)) / day_step + time_0            time = REAL(mod(itau, day_step)) / day_step + time_0
177            IF (time > 1.) time = time - 1.            IF (time > 1.) time = time - 1.
178    
179            CALL calfis(rdayvrai, time, ucov, vcov, teta, q, masse, ps, pk, &            CALL calfis(rdayvrai, time, ucov, vcov, teta, q, pk, phis, phi, w, &
180                 phis, phi, dudyn, dv, dq, w, dufi, dvfi, dtetafi, dqfi, dpfi, &                 dufi, dvfi, dtetafi, dqfi, lafin = itau + 1 == itaufin)
                lafin = itau + 1 == itaufin)  
181    
182            ! Ajout des tendances physiques:            ! Ajout des tendances physiques:
183            CALL addfi(nqmx, ucov, vcov, teta, q, ps, dufi, dvfi, dtetafi, &            CALL addfi(ucov, vcov, teta, q, dufi, dvfi, dtetafi, dqfi)
                dqfi, dpfi)  
184         ENDIF         ENDIF
185    
        forall (l = 1: llm + 1) p3d(:, :, l) = ap(l) + bp(l) * ps  
        CALL exner_hyb(ps, p3d, pks, pk, pkf)  
   
186         IF (MOD(itau + 1, idissip) == 0) THEN         IF (MOD(itau + 1, idissip) == 0) THEN
187            ! Dissipation horizontale et verticale des petites échelles            ! Dissipation horizontale et verticale des petites \'echelles
188    
189            ! calcul de l'énergie cinétique avant dissipation            ! calcul de l'\'energie cin\'etique avant dissipation
190            call covcont(llm, ucov, vcov, ucont, vcont)            call covcont(llm, ucov, vcov, ucont, vcont)
191            call enercin(vcov, ucov, vcont, ucont, ecin0)            call enercin(vcov, ucov, vcont, ucont, ecin0)
192    
# Line 204  contains Line 195  contains
195            ucov = ucov + dudis            ucov = ucov + dudis
196            vcov = vcov + dvdis            vcov = vcov + dvdis
197    
198            ! On ajoute la tendance due à la transformation énergie            ! On ajoute la tendance due \`a la transformation \'energie
199            ! cinétique en énergie thermique par la dissipation            ! cin\'etique en \'energie thermique par la dissipation
200            call covcont(llm, ucov, vcov, ucont, vcont)            call covcont(llm, ucov, vcov, ucont, vcont)
201            call enercin(vcov, ucov, vcont, ucont, ecin)            call enercin(vcov, ucov, vcont, ucont, ecin)
202            dtetadis = dtetadis + (ecin0 - ecin) / pk            dtetadis = dtetadis + (ecin0 - ecin) / pk
203            teta = teta + dtetadis            teta = teta + dtetadis
204    
205            ! Calcul de la valeur moyenne aux pôles :            ! Calcul de la valeur moyenne aux p\^oles :
206            forall (l = 1: llm)            forall (l = 1: llm)
207               teta(:, 1, l) = SUM(aire_2d(:iim, 1) * teta(:iim, 1, l)) &               teta(:, 1, l) = SUM(aire_2d(:iim, 1) * teta(:iim, 1, l)) &
208                    / apoln                    / apoln
209               teta(:, jjm + 1, l) = SUM(aire_2d(:iim, jjm+1) &               teta(:, jjm + 1, l) = SUM(aire_2d(:iim, jjm+1) &
210                    * teta(:iim, jjm + 1, l)) / apols                    * teta(:iim, jjm + 1, l)) / apols
211            END forall            END forall
   
           ps(:, 1) = SUM(aire_2d(:iim, 1) * ps(:iim, 1)) / apoln  
           ps(:, jjm + 1) = SUM(aire_2d(:iim, jjm+1) * ps(:iim, jjm + 1)) &  
                / apols  
212         END IF         END IF
213    
214         IF (MOD(itau + 1, iperiod) == 0) THEN         IF (MOD(itau + 1, iperiod) == 0) THEN
215            ! Écriture du fichier histoire moyenne:            ! \'Ecriture du fichier histoire moyenne:
216            CALL writedynav(vcov, ucov, teta, pk, phi, q, masse, ps, phis, &            CALL writedynav(vcov, ucov, teta, pk, phi, q, masse, ps, phis, &
217                 time = itau + 1)                 time = itau + 1)
218            call bilan_dyn(ps, masse, pk, pbaru, pbarv, teta, phi, ucov, vcov, &            call bilan_dyn(ps, masse, pk, pbaru, pbarv, teta, phi, ucov, vcov, &

Legend:
Removed from v.70  
changed lines
  Added in v.102

  ViewVC Help
Powered by ViewVC 1.1.21