/[lmdze]/trunk/phylmd/phytrac.f
ViewVC logotype

Diff of /trunk/phylmd/phytrac.f

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

trunk/phylmd/phytrac.f revision 118 by guez, Thu Dec 18 17:30:24 2014 UTC trunk/Sources/phylmd/phytrac.f revision 244 by guez, Tue Nov 14 14:56:42 2017 UTC
# Line 7  module phytrac_m Line 7  module phytrac_m
7    
8  contains  contains
9    
10    SUBROUTINE phytrac(itap, lmt_pas, julien, gmtime, firstcal, lafin, pdtphys, &    SUBROUTINE phytrac(julien, gmtime, firstcal, lafin, pdtphys, t_seri, paprs, &
11         t_seri, paprs, pplay, pmfu, pmfd, pde_u, pen_d, coefh, fm_therm, &         pplay, pmfu, pmfd, pde_u, pen_d, coefh, cdragh, fm_therm, entr_therm, &
12         entr_therm, yu1, yv1, ftsol, pctsrf, frac_impa, frac_nucl, pphis, da, &         yu1, yv1, ftsol, pctsrf, frac_impa, frac_nucl, da, phi, mp, upwd, dnwd, &
13         phi, mp, upwd, dnwd, tr_seri, zmasse)         tr_seri, zmasse, ncid_startphy)
14    
15      ! From phylmd/phytrac.F, version 1.15 2006/02/21 08:08:30 (SVN revision 679)      ! From phylmd/phytrac.F, version 1.15, 2006/02/21 08:08:30 (SVN
16        ! revision 679) and phylmd/write_histrac.h, version 1.9,
17        ! 2006/02/21 08:08:30
18    
19      ! Authors: Fr\'ed\'eric Hourdin, Abderrahmane Idelkadi, Marie-Alice      ! Authors: Fr\'ed\'eric Hourdin, Abderrahmane Idelkadi, Marie-Alice
20      ! Foujols, Olivia      ! Foujols
21    
22      ! Objet : moniteur g\'en\'eral des tendances des traceurs      ! Objet : moniteur g\'en\'eral des tendances des traceurs
23    
# Line 23  contains Line 25  contains
25      ! bien les vrais traceurs, sans la vapeur d'eau ni l'eau liquide.      ! bien les vrais traceurs, sans la vapeur d'eau ni l'eau liquide.
26    
27      ! Modifications pour les traceurs :      ! Modifications pour les traceurs :
28      ! - uniformisation des parametrisations dans phytrac      ! - uniformisation des param\'etrisations dans phytrac
29      ! - stockage des moyennes des champs n\'ecessaires en mode traceur off-line      ! - stockage des moyennes des champs n\'ecessaires en mode traceur off-line
30    
31      use abort_gcm_m, only: abort_gcm      use abort_gcm_m, only: abort_gcm
32      use clesphys, only: ecrit_tra      use clesphys2, only: conv_emanuel
33      use clesphys2, only: iflag_con      use cltrac_m, only: cltrac
34      use cltracrn_m, only: cltracrn      use cltracrn_m, only: cltracrn
35        USE conf_gcm_m, ONLY: lmt_pas
36      use ctherm, only: iflag_thermals      use ctherm, only: iflag_thermals
37        use cvltr_m, only: cvltr
38      use dimens_m, only: llm, nqmx      use dimens_m, only: llm, nqmx
39      use dimphy, only: klon      use dimphy, only: klon
40        use histwrite_phy_m, only: histwrite_phy
41      use indicesol, only: nbsrf      use indicesol, only: nbsrf
42      use ini_histrac_m, only: ini_histrac      use iniadvtrac_m, only: tname
43      use initrrnpb_m, only: initrrnpb      use initrrnpb_m, only: initrrnpb
44      use minmaxqfi_m, only: minmaxqfi      use minmaxqfi_m, only: minmaxqfi
45        use netcdf, only: NF90_FILL_float
46        use netcdf95, only: nf95_inq_varid, nf95_get_var, nf95_put_var
47      use nflxtr_m, only: nflxtr      use nflxtr_m, only: nflxtr
48      use nr_util, only: assert      use nr_util, only: assert
49      use o3_chem_m, only: o3_chem      use o3_chem_m, only: o3_chem
50      use phyetat0_m, only: rlat      use phyetat0_m, only: rlat
51        use phyredem0_m, only: ncid_restartphy
52      use press_coefoz_m, only: press_coefoz      use press_coefoz_m, only: press_coefoz
53      use radiornpb_m, only: radiornpb      use radiornpb_m, only: radiornpb
54      use regr_pr_comb_coefoz_m, only: regr_pr_comb_coefoz      use regr_pr_comb_coefoz_m, only: regr_pr_comb_coefoz
55      use SUPHEC_M, only: rg      use SUPHEC_M, only: rg
56        use time_phylmdz, only: itap
57    
     integer, intent(in):: itap ! number of calls to "physiq"  
     integer, intent(in):: lmt_pas ! number of time steps of "physics" per day  
58      integer, intent(in):: julien !jour julien, 1 <= julien <= 360      integer, intent(in):: julien !jour julien, 1 <= julien <= 360
59      real, intent(in):: gmtime ! heure de la journ\'ee en fraction de jour      real, intent(in):: gmtime ! heure de la journ\'ee en fraction de jour
60      logical, intent(in):: firstcal ! first call to "calfis"      logical, intent(in):: firstcal ! first call to "calfis"
# Line 70  contains Line 77  contains
77    
78      REAL pde_u(klon, llm) ! flux detraine dans le panache montant      REAL pde_u(klon, llm) ! flux detraine dans le panache montant
79      REAL pen_d(klon, llm) ! flux entraine dans le panache descendant      REAL pen_d(klon, llm) ! flux entraine dans le panache descendant
80      REAL coefh(klon, llm) ! coeff melange couche limite      REAL coefh(:, 2:) ! (klon, 2:llm) coeff melange couche limite
81        real cdragh(:) ! (klon)
82      ! thermiques:      real fm_therm(klon, llm+1), entr_therm(klon, llm) ! thermiques
83      real fm_therm(klon, llm+1), entr_therm(klon, llm)      REAL, intent(in):: yu1(:), yv1(:) ! (klon) vent au premier niveau
   
     ! Couche limite:  
     REAL yu1(klon) ! vents au premier niveau  
     REAL yv1(klon) ! vents au premier niveau  
84    
85      ! Arguments n\'ecessaires pour les sources et puits de traceur :      ! Arguments n\'ecessaires pour les sources et puits de traceur :
86      real, intent(in):: ftsol(klon, nbsrf) ! Temperature du sol (surf)(Kelvin)      real, intent(in):: ftsol(:, :) ! (klon, nbsrf) surface temperature (K)
87      real pctsrf(klon, nbsrf) ! Pourcentage de sol f(nature du sol)      real, intent(in):: pctsrf(klon, nbsrf) ! Pourcentage de sol f(nature du sol)
88    
89      ! Lessivage pour le on-line      ! Lessivage pour le on-line
90      REAL frac_impa(klon, llm) ! fraction d'aerosols impactes      REAL, intent(in):: frac_impa(klon, llm) ! fraction d'aerosols impactes
91      REAL frac_nucl(klon, llm) ! fraction d'aerosols nuclees      REAL, intent(in):: frac_nucl(klon, llm) ! fraction d'aerosols nuclees
   
     real, intent(in):: pphis(klon)  
92    
93      ! Kerry Emanuel      ! Kerry Emanuel
94      real, intent(in):: da(klon, llm), phi(klon, llm, llm), mp(klon, llm)      real, intent(in):: da(klon, llm), phi(klon, llm, llm), mp(klon, llm)
# Line 100  contains Line 101  contains
101      real, intent(in):: zmasse(:, :) ! (klon, llm)      real, intent(in):: zmasse(:, :) ! (klon, llm)
102      ! (column-density of mass of air in a cell, in kg m-2)      ! (column-density of mass of air in a cell, in kg m-2)
103    
104      ! Variables local to the procedure:      integer, intent(in):: ncid_startphy
105    
106        ! Local:
107    
108      integer nsplit      integer nsplit
109    
# Line 114  contains Line 117  contains
117      !      !
118      ! Pour la source de radon et son reservoir de sol      ! Pour la source de radon et son reservoir de sol
119    
120      REAL, save:: trs(klon, nqmx - 2) ! Concentration de radon dans le sol      REAL, save:: trs(klon, nqmx - 2) ! Concentration de traceur dans le sol
121    
122      REAL masktr(klon, nqmx - 2) ! Masque reservoir de sol traceur      REAL masktr(klon, nqmx - 2) ! Masque reservoir de sol traceur
123      ! Masque de l'echange avec la surface      ! Masque de l'echange avec la surface
# Line 132  contains Line 135  contains
135      SAVE scavtr      SAVE scavtr
136    
137      CHARACTER itn      CHARACTER itn
     INTEGER, save:: nid_tra  
   
     ! nature du traceur  
138    
139      logical aerosol(nqmx - 2) ! Nature du traceur      logical, save:: aerosol(nqmx - 2) ! Nature du traceur
140      ! ! aerosol(it) = true => aerosol      ! ! aerosol(it) = true => aerosol
141      ! ! aerosol(it) = false => gaz      ! ! aerosol(it) = false => gaz
142      logical clsol(nqmx - 2) ! couche limite sol calcul\'ee  
143      logical radio(nqmx - 2) ! d\'ecroisssance radioactive      logical, save:: clsol(nqmx - 2) ! couche limite sol flux
144      save aerosol, clsol, radio      ! calcul\'ee, sinon prescrit
145        logical, save:: radio(nqmx - 2) ! d\'ecroisssance radioactive
146    
147      ! convection tiedtke      ! convection tiedtke
148      INTEGER i, k, it      INTEGER i, k, it
# Line 153  contains Line 154  contains
154    
155      REAL d_tr(klon, llm), d_trs(klon) ! tendances de traceurs      REAL d_tr(klon, llm), d_trs(klon) ! tendances de traceurs
156      REAL d_tr_cl(klon, llm, nqmx - 2) ! tendance de traceurs couche limite      REAL d_tr_cl(klon, llm, nqmx - 2) ! tendance de traceurs couche limite
157      REAL d_tr_cv(klon, llm, nqmx - 2) ! tendance de traceurs conv pour chq traceur  
158        REAL d_tr_cv(klon, llm, nqmx - 2)
159        ! tendance de traceurs conv pour chq traceur
160    
161      REAL d_tr_th(klon, llm, nqmx - 2) ! la tendance des thermiques      REAL d_tr_th(klon, llm, nqmx - 2) ! la tendance des thermiques
162      REAL d_tr_dec(klon, llm, 2) ! la tendance de la decroissance      REAL d_tr_dec(klon, llm, 2) ! la tendance de la decroissance
163      ! ! radioactive du rn - > pb      ! ! radioactive du rn - > pb
164      REAL d_tr_lessi_impa(klon, llm, nqmx - 2) ! la tendance du lessivage  
165      ! ! par impaction      REAL d_tr_lessi_impa(klon, llm, nqmx - 2)
166      REAL d_tr_lessi_nucl(klon, llm, nqmx - 2) ! la tendance du lessivage      ! tendance du lessivage par impaction
167      ! ! par nucleation  
168      REAL flestottr(klon, llm, nqmx - 2) ! flux de lessivage      REAL d_tr_lessi_nucl(klon, llm, nqmx - 2)
169      ! ! dans chaque couche      ! tendance du lessivage par nucleation
170    
171        REAL flestottr(klon, llm, nqmx - 2) ! flux de lessivage dans chaque couche
172    
173      real ztra_th(klon, llm)      real ztra_th(klon, llm)
174      integer isplit      integer isplit, varid
175    
176      ! Controls:      ! Controls:
     logical:: couchelimite = .true.  
177      logical:: convection = .true.      logical:: convection = .true.
     logical:: lessivage = .true.  
     logical, save:: inirnpb  
178    
179      !--------------------------------------      !--------------------------------------
180    
# Line 179  contains Line 182  contains
182      call assert(shape(tr_seri) == (/klon, llm, nqmx - 2/), "phytrac tr_seri")      call assert(shape(tr_seri) == (/klon, llm, nqmx - 2/), "phytrac tr_seri")
183    
184      if (firstcal) then      if (firstcal) then
        print *, 'phytrac: pdtphys = ', pdtphys  
        PRINT *, 'Frequency of tracer output: ecrit_tra = ', ecrit_tra  
        inirnpb = .true.  
   
        ! Initialisation des sorties :  
        call ini_histrac(nid_tra, pdtphys, nqmx - 2, lessivage)  
   
185         ! Initialisation de certaines variables pour le radon et le plomb         ! Initialisation de certaines variables pour le radon et le plomb
186         ! Initialisation du traceur dans le sol (couche limite radonique)         ! Initialisation du traceur dans le sol (couche limite radonique)
187         trs(:, :) = 0.         trs(:, 2:) = 0.
188    
189         open (unit=99, file='starttrac', status='old', err=999, &         call nf95_inq_varid(ncid_startphy, "trs", varid)
190              form='formatted')         call nf95_get_var(ncid_startphy, varid, trs(:, 1))
191         read(unit=99, fmt=*) (trs(i, 1), i=1, klon)         if (any(trs(:, 1) == NF90_FILL_float)) call abort_gcm("phytrac", &
192  999    continue              "some missing values in trs(:, 1)")
        close(unit=99)  
193    
194         ! Initialisation de la fraction d'aerosols lessivee         ! Initialisation de la fraction d'aerosols lessivee
195    
# Line 203  contains Line 198  contains
198    
199         ! Initialisation de la nature des traceurs         ! Initialisation de la nature des traceurs
200    
201         DO it = 1, nqmx - 2         aerosol = .FALSE. ! Tous les traceurs sont des gaz par defaut
202            aerosol(it) = .FALSE. ! Tous les traceurs sont des gaz par defaut         radio = .FALSE. ! par d\'efaut pas de passage par "radiornpb"
           radio(it) = .FALSE. ! par d\'efaut pas de passage par "radiornpb"  
           clsol(it) = .FALSE. ! Par defaut couche limite avec flux prescrit  
        ENDDO  
203    
204         if (nqmx >= 5) then         if (nqmx >= 5) then
205            call press_coefoz ! read input pressure levels for ozone coefficients            call press_coefoz ! read input pressure levels for ozone coefficients
206         end if         end if
     ENDIF  
207    
     if (inirnpb) THEN  
208         ! Initialisation du traceur dans le sol (couche limite radonique)         ! Initialisation du traceur dans le sol (couche limite radonique)
209         radio(1)= .true.         radio(1)= .true.
210         radio(2)= .true.         radio(2)= .true.
211         clsol(1)= .true.         clsol(:2)= .true.
212         clsol(2)= .true.         clsol(3:)= .false.
213         aerosol(2) = .TRUE. ! le Pb est un aerosol         aerosol(2) = .TRUE. ! le Pb est un aerosol
214         call initrrnpb(pctsrf, masktr, fshtr, hsoltr, tautr, vdeptr, scavtr)         call initrrnpb(pctsrf, masktr, fshtr, hsoltr, tautr, vdeptr, scavtr)
        inirnpb=.false.  
215      endif      endif
216    
217      if (convection) then      if (convection) then
218         ! Calcul de l'effet de la convection         ! Calcul de l'effet de la convection
219         DO it=1, nqmx - 2         DO it=1, nqmx - 2
220            if (iflag_con == 2) then            if (conv_emanuel) then
221               ! Tiedke               call cvltr(pdtphys, da, phi, mp, paprs, tr_seri(:, :, it), upwd, &
222                      dnwd, d_tr_cv(:, :, it))
223              else
224               CALL nflxtr(pdtphys, pmfu, pmfd, pde_u, pen_d, paprs, &               CALL nflxtr(pdtphys, pmfu, pmfd, pde_u, pen_d, paprs, &
225                    tr_seri(:, :, it), d_tr_cv(:, :, it))                    tr_seri(:, :, it), d_tr_cv(:, :, it))
           else if (iflag_con == 3) then  
              ! Emanuel  
              call cvltr(pdtphys, da, phi, mp, paprs, tr_seri(1, 1, it), upwd, &  
                   dnwd, d_tr_cv(1, 1, it))  
226            endif            endif
227    
228            DO k = 1, llm            DO k = 1, llm
# Line 283  contains Line 270  contains
270    
271      ! Calcul de l'effet de la couche limite      ! Calcul de l'effet de la couche limite
272    
273      if (couchelimite) then      DO k = 1, llm
274         DO k = 1, llm         DO i = 1, klon
275            DO i = 1, klon            delp(i, k) = paprs(i, k)-paprs(i, k+1)
              delp(i, k) = paprs(i, k)-paprs(i, k+1)  
           ENDDO  
276         ENDDO         ENDDO
277        ENDDO
278    
279         ! MAF modif pour tenir compte du cas traceur      ! MAF modif pour tenir compte du cas traceur
280         DO it=1, nqmx - 2      DO it=1, nqmx - 2
281            if (clsol(it)) then         if (clsol(it)) then
282               ! couche limite avec quantite dans le sol calculee            ! couche limite avec quantite dans le sol calculee
283               CALL cltracrn(it, pdtphys, yu1, yv1, &            CALL cltracrn(it, pdtphys, yu1, yv1, coefh, cdragh, t_seri, ftsol, &
284                    coefh, t_seri, ftsol, pctsrf, &                 pctsrf, tr_seri(:, :, it), trs(:, it), paprs, pplay, delp, &
285                    tr_seri(:, :, it), trs(1, it), &                 masktr(1, it), fshtr(1, it), hsoltr(it), tautr(it), &
286                    paprs, pplay, delp, &                 vdeptr(it), rlat, d_tr_cl(1, 1, it), d_trs)
287                    masktr(1, it), fshtr(1, it), hsoltr(it), &            DO k = 1, llm
288                    tautr(it), vdeptr(it), &               DO i = 1, klon
289                    rlat, &                  tr_seri(i, k, it) = tr_seri(i, k, it) + d_tr_cl(i, k, it)
                   d_tr_cl(1, 1, it), d_trs)  
              DO k = 1, llm  
                 DO i = 1, klon  
                    tr_seri(i, k, it) = tr_seri(i, k, it) + d_tr_cl(i, k, it)  
                 ENDDO  
290               ENDDO               ENDDO
291              ENDDO
292    
293               ! Traceur ds sol            trs(:, it) = trs(:, it) + d_trs
294           else
295              ! couche limite avec flux prescrit
296              !MAF provisoire source / traceur a creer
297              DO i=1, klon
298                 source(i) = 0. ! pas de source, pour l'instant
299              ENDDO
300    
301              CALL cltrac(pdtphys, coefh, t_seri, tr_seri(:, :, it), source, &
302                   paprs, pplay, delp, d_tr_cl(1, 1, it))
303              DO k = 1, llm
304               DO i = 1, klon               DO i = 1, klon
305                  trs(i, it) = trs(i, it) + d_trs(i)                  tr_seri(i, k, it) = tr_seri(i, k, it) + d_tr_cl(i, k, it)
              END DO  
           else ! couche limite avec flux prescrit  
              !MAF provisoire source / traceur a creer  
              DO i=1, klon  
                 source(i) = 0.0 ! pas de source, pour l'instant  
              ENDDO  
   
              CALL cltrac(pdtphys, coefh, t_seri, &  
                   tr_seri(1, 1, it), source, &  
                   paprs, pplay, delp, &  
                   d_tr_cl(1, 1, it))  
              DO k = 1, llm  
                 DO i = 1, klon  
                    tr_seri(i, k, it) = tr_seri(i, k, it) + d_tr_cl(i, k, it)  
                 ENDDO  
306               ENDDO               ENDDO
307            endif            ENDDO
308         ENDDO         endif
309      endif      ENDDO
310    
311      ! Calcul de l'effet du puits radioactif      ! Calcul de l'effet du puits radioactif
312    
# Line 349  contains Line 325  contains
325         ! Ozone as a tracer:         ! Ozone as a tracer:
326         if (mod(itap - 1, lmt_pas) == 0) then         if (mod(itap - 1, lmt_pas) == 0) then
327            ! Once per day, update the coefficients for ozone chemistry:            ! Once per day, update the coefficients for ozone chemistry:
328            call regr_pr_comb_coefoz(julien)            call regr_pr_comb_coefoz(julien, paprs, pplay)
329         end if         end if
330         call o3_chem(julien, gmtime, t_seri, zmasse, pdtphys, tr_seri(:, :, 3))         call o3_chem(julien, gmtime, t_seri, zmasse, pdtphys, tr_seri(:, :, 3))
331      end if      end if
332    
333      ! Calcul de l'effet de la precipitation      ! Calcul de l'effet de la precipitation
334    
335      IF (lessivage) THEN      d_tr_lessi_nucl = 0.
336         d_tr_lessi_nucl = 0.      d_tr_lessi_impa = 0.
337         d_tr_lessi_impa = 0.      flestottr = 0.
        flestottr = 0.  
   
        ! tendance des aerosols nuclees et impactes  
   
        DO it = 1, nqmx - 2  
           IF (aerosol(it)) THEN  
              DO k = 1, llm  
                 DO i = 1, klon  
                    d_tr_lessi_nucl(i, k, it) = d_tr_lessi_nucl(i, k, it) + &  
                         (1 - frac_nucl(i, k))*tr_seri(i, k, it)  
                    d_tr_lessi_impa(i, k, it) = d_tr_lessi_impa(i, k, it) + &  
                         (1 - frac_impa(i, k))*tr_seri(i, k, it)  
                 ENDDO  
              ENDDO  
           ENDIF  
        ENDDO  
338    
339         ! Mises a jour des traceurs + calcul des flux de lessivage      ! tendance des aerosols nuclees et impactes
        ! Mise a jour due a l'impaction et a la nucleation  
340    
341         DO it = 1, nqmx - 2      DO it = 1, nqmx - 2
342            IF (aerosol(it)) THEN         IF (aerosol(it)) THEN
343               DO k = 1, llm            DO k = 1, llm
344                  DO i = 1, klon               DO i = 1, klon
345                     tr_seri(i, k, it) = tr_seri(i, k, it) * frac_impa(i, k) &                  d_tr_lessi_nucl(i, k, it) = d_tr_lessi_nucl(i, k, it) + &
346                          * frac_nucl(i, k)                       (1 - frac_nucl(i, k))*tr_seri(i, k, it)
347                  ENDDO                  d_tr_lessi_impa(i, k, it) = d_tr_lessi_impa(i, k, it) + &
348                         (1 - frac_impa(i, k))*tr_seri(i, k, it)
349               ENDDO               ENDDO
350            ENDIF            ENDDO
351         ENDDO         ENDIF
352        ENDDO
353    
354         ! Flux lessivage total      ! Mises a jour des traceurs + calcul des flux de lessivage
355        ! Mise a jour due a l'impaction et a la nucleation
356    
357         DO it = 1, nqmx - 2      DO it = 1, nqmx - 2
358           IF (aerosol(it)) THEN
359            DO k = 1, llm            DO k = 1, llm
360               DO i = 1, klon               DO i = 1, klon
361                  flestottr(i, k, it) = flestottr(i, k, it) &                  tr_seri(i, k, it) = tr_seri(i, k, it) * frac_impa(i, k) &
362                       - (d_tr_lessi_nucl(i, k, it) + d_tr_lessi_impa(i, k, it)) &                       * frac_nucl(i, k)
                      * (paprs(i, k)-paprs(i, k+1)) / (RG * pdtphys)  
363               ENDDO               ENDDO
364            ENDDO            ENDDO
365           ENDIF
366        ENDDO
367    
368        ! Flux lessivage total
369        DO it = 1, nqmx - 2
370           DO k = 1, llm
371              DO i = 1, klon
372                 flestottr(i, k, it) = flestottr(i, k, it) &
373                      - (d_tr_lessi_nucl(i, k, it) + d_tr_lessi_impa(i, k, it)) &
374                      * (paprs(i, k)-paprs(i, k+1)) / (RG * pdtphys)
375              ENDDO
376         ENDDO         ENDDO
377      ENDIF      ENDDO
378    
379      ! Ecriture des sorties      ! Ecriture des sorties
380      call write_histrac(lessivage, itap, nid_tra)      CALL histwrite_phy("zmasse", zmasse)
381        DO it=1, nqmx - 2
382           CALL histwrite_phy(tname(it+2), tr_seri(:, :, it))
383           CALL histwrite_phy("fl"//tname(it+2), flestottr(:, :, it))
384           CALL histwrite_phy("d_tr_th_"//tname(it+2), d_tr_th(:, :, it))
385           CALL histwrite_phy("d_tr_cv_"//tname(it+2), d_tr_cv(:, :, it))
386           CALL histwrite_phy("d_tr_cl_"//tname(it+2), d_tr_cl(:, :, it))
387        ENDDO
388    
389      if (lafin) then      if (lafin) then
390         print *, "C'est la fin de la physique."         call nf95_inq_varid(ncid_restartphy, "trs", varid)
391         open(unit=99, file='restarttrac', form='formatted')         call nf95_put_var(ncid_restartphy, varid, trs(:, 1))
        do i=1, klon  
           write(unit=99, fmt=*) trs(i, 1)  
        enddo  
        PRINT *, 'Ecriture du fichier restarttrac'  
        close(unit=99)  
392      endif      endif
393    
   contains  
   
     subroutine write_histrac(lessivage, itap, nid_tra)  
   
       ! From phylmd/write_histrac.h, version 1.9 2006/02/21 08:08:30  
   
       use dimens_m, only: iim, jjm, llm  
       use histsync_m, only: histsync  
       use histwrite_m, only: histwrite  
       use temps, only: itau_phy  
       use iniadvtrac_m, only: tnom  
       use comgeomphy, only: airephy  
       use dimphy, only: klon  
       use grid_change, only: gr_phy_write_2d  
       use gr_phy_write_3d_m, only: gr_phy_write_3d  
   
       logical, intent(in):: lessivage  
       integer, intent(in):: itap ! number of calls to "physiq"  
       integer, intent(in):: nid_tra  
   
       ! Variables local to the procedure:  
       integer it  
       integer itau_w ! pas de temps ecriture  
       logical, parameter:: ok_sync = .true.  
   
       !-----------------------------------------------------  
   
       itau_w = itau_phy + itap  
   
       CALL histwrite(nid_tra, "phis", itau_w, gr_phy_write_2d(pphis))  
       CALL histwrite(nid_tra, "aire", itau_w, gr_phy_write_2d(airephy))  
       CALL histwrite(nid_tra, "zmasse", itau_w, gr_phy_write_3d(zmasse))  
   
       DO it=1, nqmx - 2  
          CALL histwrite(nid_tra, tnom(it+2), itau_w, &  
               gr_phy_write_3d(tr_seri(:, :, it)))  
          if (lessivage) THEN  
             CALL histwrite(nid_tra, "fl"//tnom(it+2), itau_w, &  
                  gr_phy_write_3d(flestottr(:, :, it)))  
          endif  
          CALL histwrite(nid_tra, "d_tr_th_"//tnom(it+2), itau_w, &  
               gr_phy_write_3d(d_tr_th(:, :, it)))  
          CALL histwrite(nid_tra, "d_tr_cv_"//tnom(it+2), itau_w, &  
               gr_phy_write_3d(d_tr_cv(:, :, it)))  
          CALL histwrite(nid_tra, "d_tr_cl_"//tnom(it+2), itau_w, &  
               gr_phy_write_3d(d_tr_cl(:, :, it)))  
       ENDDO  
   
       CALL histwrite(nid_tra, "pplay", itau_w, gr_phy_write_3d(pplay))  
       CALL histwrite(nid_tra, "T", itau_w, gr_phy_write_3d(t_seri))  
   
       if (ok_sync) then  
          call histsync(nid_tra)  
       endif  
   
     end subroutine write_histrac  
   
394    END SUBROUTINE phytrac    END SUBROUTINE phytrac
395    
396  end module phytrac_m  end module phytrac_m

Legend:
Removed from v.118  
changed lines
  Added in v.244

  ViewVC Help
Powered by ViewVC 1.1.21