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

Diff of /trunk/phylmd/phytrac.f

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

revision 15 by guez, Fri Aug 1 15:24:12 2008 UTC revision 62 by guez, Thu Jul 26 14:37:37 2012 UTC
# Line 1  Line 1 
1  module phytrac_m  module phytrac_m
2    
   ! This module is clean: no C preprocessor directive, no include line.  
   
3    IMPLICIT none    IMPLICIT none
4    
5    private    private
# Line 10  module phytrac_m Line 8  module phytrac_m
8  contains  contains
9    
10    SUBROUTINE phytrac(rnpb, itap, lmt_pas, julien, gmtime, firstcal, lafin, &    SUBROUTINE phytrac(rnpb, itap, lmt_pas, julien, gmtime, firstcal, lafin, &
11         nqmax, pdtphys, u, v, t_seri, paprs, pplay, pmfu, pmfd, pen_u, &         nq_phys, pdtphys, u, t_seri, paprs, pplay, pmfu, pmfd, pen_u, pde_u, &
12         pde_u, pen_d, pde_d, coefh, fm_therm, entr_therm, yu1, yv1, ftsol, &         pen_d, pde_d, coefh, fm_therm, entr_therm, yu1, yv1, ftsol, pctsrf, &
13         pctsrf, frac_impa, frac_nucl, presnivs, pphis, &         frac_impa, frac_nucl, pphis, albsol, rh, cldfra, rneb, diafra, cldliq, &
14         pphi, albsol, rh, cldfra, rneb, diafra, cldliq, itop_con, &         pmflxr, pmflxs, prfl, psfl, da, phi, mp, upwd, dnwd, tr_seri, zmasse)
        ibas_con, pmflxr, pmflxs, prfl, psfl, da, phi, mp, upwd, dnwd, tr_seri)  
15    
16      ! From phylmd/phytrac.F, version 1.15 2006/02/21 08:08:30      ! From phylmd/phytrac.F, version 1.15 2006/02/21 08:08:30 (SVN revision 679)
17    
18      ! Authors : Frédéric Hourdin, Abderrahmane Idelkadi, Marie-Alice      ! Authors: Frédéric Hourdin, Abderrahmane Idelkadi, Marie-Alice
19      ! Foujols, Olivia      ! Foujols, Olivia
20      ! Objet : moniteur général des tendances des traceurs      ! Objet : moniteur général des tendances des traceurs
21    
22      ! Remarques :      ! L'appel de "phytrac" se fait avec "nqmx-2" donc nous avons bien
     ! 1/ L'appel de "phytrac" se fait avec "nq-2" donc nous avons bien  
23      ! les vrais traceurs (en nombre "nbtr", sans la vapeur d'eau ni l'eau      ! les vrais traceurs (en nombre "nbtr", sans la vapeur d'eau ni l'eau
24      ! liquide) dans "phytrac".      ! liquide) dans "phytrac".
     ! 2/ Le choix du radon et du plomb se fait juste avec un "data"  
     ! (peu propre).  
     ! Pourrait-on avoir une variable qui indiquerait le type de traceur ?  
25    
26      use dimens_m, only: iim, jjm, llm      ! Modifications pour les traceurs :
27        ! - uniformisation des parametrisations dans phytrac
28        ! - stockage des moyennes des champs nécessaires en mode traceur off-line
29    
30        use dimens_m, only: llm
31      use indicesol, only: nbsrf      use indicesol, only: nbsrf
32      use dimphy, only: klon, nbtr      use dimphy, only: klon, nbtr
33      use clesphys, only: ecrit_tra      use clesphys, only: ecrit_tra
34      use clesphys2, only: iflag_con      use clesphys2, only: iflag_con
35      use abort_gcm_m, only: abort_gcm      use abort_gcm_m, only: abort_gcm
36      use YOMCST, only: rg      use SUPHEC_M, only: rg
37      use ctherm, only: iflag_thermals      use ctherm, only: iflag_thermals
38      use regr_pr_comb_coefoz_m, only: regr_pr_comb_coefoz      use regr_pr_comb_coefoz_m, only: regr_pr_comb_coefoz
39      use phyetat0_m, only: rlat      use phyetat0_m, only: rlat
40      use o3_chem_m, only: o3_chem      use o3_chem_m, only: o3_chem
41        use ini_histrac_m, only: ini_histrac
42      ! Arguments:      use radiornpb_m, only: radiornpb
43        use minmaxqfi_m, only: minmaxqfi
44      !   EN ENTREE:      use nr_util, only: assert
45        use press_coefoz_m, only: press_coefoz
     !   divers:  
46    
47      logical, intent(in):: rnpb      logical, intent(in):: rnpb
48    
49      integer, intent(in):: nqmax      integer, intent(in):: nq_phys
50      ! (nombre de traceurs auxquels on applique la physique)      ! (nombre de traceurs auxquels on applique la physique)
51    
52      integer, intent(in):: itap  ! number of calls to "physiq"      integer, intent(in):: itap  ! number of calls to "physiq"
53      integer, intent(in):: lmt_pas ! number of time steps of "physics" per day      integer, intent(in):: lmt_pas ! number of time steps of "physics" per day
54      integer, intent(in):: julien !jour julien, 1 <= julien <= 360      integer, intent(in):: julien !jour julien, 1 <= julien <= 360
     integer itop_con(klon)  
     integer ibas_con(klon)  
55      real, intent(in):: gmtime ! heure de la journée en fraction de jour      real, intent(in):: gmtime ! heure de la journée en fraction de jour
56      real, intent(in):: pdtphys  ! pas d'integration pour la physique (s)      real, intent(in):: pdtphys  ! pas d'integration pour la physique (s)
57      real, intent(in):: t_seri(klon, llm) ! temperature, in K      real, intent(in):: t_seri(klon, llm) ! temperature, in K
58    
59      real tr_seri(klon, llm, nbtr)      real, intent(inout):: tr_seri(:, :, :) ! (klon, llm, nbtr)
60      ! (mass fractions of tracers, excluding water, at mid-layers)      ! (mass fractions of tracers, excluding water, at mid-layers)
61    
62      real u(klon, llm)      real, intent(in):: u(klon, llm)
     real v(klon, llm)  
63      real rh(klon, llm)     ! humidite relative      real rh(klon, llm)     ! humidite relative
64      real cldliq(klon, llm) ! eau liquide nuageuse      real cldliq(klon, llm) ! eau liquide nuageuse
65      real cldfra(klon, llm) ! fraction nuageuse (tous les nuages)      real cldfra(klon, llm) ! fraction nuageuse (tous les nuages)
# Line 83  contains Line 76  contains
76      real, intent(in):: pplay(klon, llm)      real, intent(in):: pplay(klon, llm)
77      ! (pression pour le mileu de chaque couche, en Pa)      ! (pression pour le mileu de chaque couche, en Pa)
78    
79      real pphi(klon, llm) ! geopotentiel      real, intent(in):: pphis(klon)
     real pphis(klon)  
     REAL, intent(in):: presnivs(llm)  
80      logical, intent(in):: firstcal ! first call to "calfis"      logical, intent(in):: firstcal ! first call to "calfis"
81      logical, intent(in):: lafin ! fin de la physique      logical, intent(in):: lafin ! fin de la physique
82    
     integer nsplit  
83      REAL pmflxr(klon, llm+1), pmflxs(klon, llm+1)   !--lessivage convection      REAL pmflxr(klon, llm+1), pmflxs(klon, llm+1)   !--lessivage convection
84      REAL prfl(klon, llm+1),   psfl(klon, llm+1)     !--lessivage large-scale      REAL prfl(klon, llm+1),   psfl(klon, llm+1)     !--lessivage large-scale
85    
86      !   convection:      !   convection:
87        REAL, intent(in):: pmfu(klon, llm) ! flux de masse dans le panache montant
     REAL pmfu(klon, llm)  ! flux de masse dans le panache montant  
88      REAL pmfd(klon, llm)  ! flux de masse dans le panache descendant      REAL pmfd(klon, llm)  ! flux de masse dans le panache descendant
89      REAL pen_u(klon, llm) ! flux entraine dans le panache montant      REAL pen_u(klon, llm) ! flux entraine dans le panache montant
90    
# Line 106  contains Line 95  contains
95      REAL pde_u(klon, llm) ! flux detraine dans le panache montant      REAL pde_u(klon, llm) ! flux detraine dans le panache montant
96      REAL pen_d(klon, llm) ! flux entraine dans le panache descendant      REAL pen_d(klon, llm) ! flux entraine dans le panache descendant
97      REAL pde_d(klon, llm) ! flux detraine dans le panache descendant      REAL pde_d(klon, llm) ! flux detraine dans le panache descendant
98      ! KE      ! Kerry Emanuel
99      real da(klon, llm), phi(klon, llm, llm), mp(klon, llm)      real da(klon, llm), phi(klon, llm, llm), mp(klon, llm)
100      REAL upwd(klon, llm)      ! saturated updraft mass flux      REAL, intent(in):: upwd(klon, llm) ! saturated updraft mass flux
101      REAL dnwd(klon, llm)      ! saturated downdraft mass flux      REAL, intent(in):: dnwd(klon, llm) ! saturated downdraft mass flux
102    
103      !   Couche limite:      !   Couche limite:
104    
# Line 129  contains Line 118  contains
118      real ftsol(klon, nbsrf)  ! Temperature du sol (surf)(Kelvin)      real ftsol(klon, nbsrf)  ! Temperature du sol (surf)(Kelvin)
119      real pctsrf(klon, nbsrf) ! Pourcentage de sol f(nature du sol)      real pctsrf(klon, nbsrf) ! Pourcentage de sol f(nature du sol)
120    
121      real pftsol1(klon), pftsol2(klon), pftsol3(klon), pftsol4(klon)      real, intent(in):: zmasse(:, :)  ! (klon, llm)
122      real ppsrf1(klon), ppsrf2(klon), ppsrf3(klon), ppsrf4(klon)      ! (column-density of mass of air in a cell, in kg m-2)
123    
124        ! Variables local to the procedure:
125    
126        integer nsplit
127    
128      !  VARIABLES LOCALES TRACEURS      !  TRACEURS
129    
130      ! Sources et puits des traceurs:      ! Sources et puits des traceurs:
131    
# Line 192  contains Line 185  contains
185      REAL flestottr(klon, llm, nbtr) ! flux de lessivage      REAL flestottr(klon, llm, nbtr) ! flux de lessivage
186      !                                    ! dans chaque couche      !                                    ! dans chaque couche
187    
     real zmasse(klon, llm)  
     ! (column-density of mass of air in a layer, in kg m-2)  
   
188      real ztra_th(klon, llm)      real ztra_th(klon, llm)
   
     character(len=20) modname  
     character(len=80) abort_message  
189      integer isplit      integer isplit
190    
191      ! Controls:      ! Controls:
# Line 209  contains Line 196  contains
196    
197      !--------------------------------------      !--------------------------------------
198    
199      modname='phytrac'      call assert(shape(zmasse) == (/klon, llm/), "phytrac zmasse")
200        call assert(shape(tr_seri) == (/klon, llm, nbtr/), "phytrac tr_seri")
201    
202      if (firstcal) then      if (firstcal) then
203         print *, 'phytrac: pdtphys = ', pdtphys         print *, 'phytrac: pdtphys = ', pdtphys
204         PRINT *, 'Fréquence de sortie des traceurs : ecrit_tra = ', ecrit_tra         PRINT *, 'Fréquence de sortie des traceurs : ecrit_tra = ', ecrit_tra
205         if (nbtr < nqmax) then         if (nbtr < nq_phys) call abort_gcm('phytrac', 'nbtr < nq_phys', 1)
           abort_message='See above'  
           call abort_gcm(modname, abort_message, 1)  
        endif  
206         inirnpb=rnpb         inirnpb=rnpb
207    
208         ! Initialisation des sorties :         ! Initialisation des sorties :
209         call ini_histrac(nid_tra, pdtphys, presnivs, nqmax, lessivage)         call ini_histrac(nid_tra, pdtphys, nq_phys, lessivage)
210    
211         ! Initialisation de certaines variables pour le radon et le plomb         ! Initialisation de certaines variables pour le radon et le plomb
212         ! Initialisation du traceur dans le sol (couche limite radonique)         ! Initialisation du traceur dans le sol (couche limite radonique)
# Line 240  contains Line 225  contains
225    
226         ! Initialisation de la nature des traceurs         ! Initialisation de la nature des traceurs
227    
228         DO it = 1, nqmax         DO it = 1, nq_phys
229            aerosol(it) = .FALSE.  ! Tous les traceurs sont des gaz par defaut            aerosol(it) = .FALSE.  ! Tous les traceurs sont des gaz par defaut
230            radio(it) = .FALSE. ! par défaut pas de passage par "radiornpb"            radio(it) = .FALSE. ! par défaut pas de passage par "radiornpb"
231            clsol(it) = .FALSE.  ! Par defaut couche limite avec flux prescrit            clsol(it) = .FALSE.  ! Par defaut couche limite avec flux prescrit
232         ENDDO         ENDDO
233    
234           if (nq_phys >= 3) then
235              call press_coefoz ! read input pressure levels for ozone coefficients
236           end if
237      ENDIF      ENDIF
238    
     ! Initialisation du traceur dans le sol (couche limite radonique)  
239      if (inirnpb) THEN      if (inirnpb) THEN
240           ! Initialisation du traceur dans le sol (couche limite radonique)
241         radio(1)= .true.         radio(1)= .true.
242         radio(2)= .true.         radio(2)= .true.
243         clsol(1)= .true.         clsol(1)= .true.
244         clsol(2)= .true.         clsol(2)= .true.
245         aerosol(2) = .TRUE. ! le Pb est un aerosol         aerosol(2) = .TRUE. ! le Pb est un aerosol
   
246         call initrrnpb(ftsol, pctsrf, masktr, fshtr, hsoltr, tautr, vdeptr, &         call initrrnpb(ftsol, pctsrf, masktr, fshtr, hsoltr, tautr, vdeptr, &
247              scavtr)              scavtr)
248         inirnpb=.false.         inirnpb=.false.
249      endif      endif
250    
     do i=1, klon  
        pftsol1(i) = ftsol(i, 1)  
        pftsol2(i) = ftsol(i, 2)  
        pftsol3(i) = ftsol(i, 3)  
        pftsol4(i) = ftsol(i, 4)  
   
        ppsrf1(i) = pctsrf(i, 1)  
        ppsrf2(i) = pctsrf(i, 2)  
        ppsrf3(i) = pctsrf(i, 3)  
        ppsrf4(i) = pctsrf(i, 4)  
   
     enddo  
   
     ! Calcul de l'effet de la convection  
   
251      if (convection) then      if (convection) then
252         DO it=1, nqmax         ! Calcul de l'effet de la convection
253            if (iflag_con.eq.2) then         DO it=1, nq_phys
254               ! tiedke            if (iflag_con == 2) then
255                 ! Tiedke
256               CALL nflxtr(pdtphys, pmfu, pmfd, pen_u, pde_u, pen_d, pde_d, &               CALL nflxtr(pdtphys, pmfu, pmfd, pen_u, pde_u, pen_d, pde_d, &
257                    paprs, tr_seri(1, 1, it), d_tr_cv(1, 1, it))                    paprs, tr_seri(1, 1, it), d_tr_cv(1, 1, it))
258            else if (iflag_con.eq.3) then            else if (iflag_con == 3) then
259               ! KE               ! Emanuel
260               call cvltr(pdtphys, da, phi, mp, paprs, &               call cvltr(pdtphys, da, phi, mp, paprs, tr_seri(1, 1, it), upwd, &
261                    tr_seri(1, 1, it), upwd, dnwd, d_tr_cv(1, 1, it))                    dnwd, d_tr_cv(1, 1, it))
262            endif            endif
263    
264            DO k = 1, llm            DO k = 1, llm
# Line 299  contains Line 272  contains
272         ENDDO         ENDDO
273      endif      endif
274    
     forall (k=1: llm) zmasse(:, k) = (paprs(:, k)-paprs(:, k+1)) / rg  
   
275      ! Calcul de l'effet des thermiques      ! Calcul de l'effet des thermiques
276    
277      do it=1, nqmax      do it=1, nq_phys
278         do k=1, llm         do k=1, llm
279            do i=1, klon            do i=1, klon
280               d_tr_th(i, k, it)=0.               d_tr_th(i, k, it)=0.
# Line 315  contains Line 286  contains
286    
287      if (iflag_thermals > 0) then      if (iflag_thermals > 0) then
288         nsplit=10         nsplit=10
289         DO it=1, nqmax         DO it=1, nq_phys
290            do isplit=1, nsplit            do isplit=1, nsplit
291               ! Thermiques               ! Thermiques
292               call dqthermcell(klon, llm, pdtphys/nsplit &               call dqthermcell(klon, llm, pdtphys/nsplit &
# Line 344  contains Line 315  contains
315         ENDDO         ENDDO
316    
317         ! MAF modif pour tenir compte du cas rnpb + traceur         ! MAF modif pour tenir compte du cas rnpb + traceur
318         DO it=1, nqmax         DO it=1, nq_phys
319            if (clsol(it)) then            if (clsol(it)) then
320               ! couche limite avec quantite dans le sol calculee               ! couche limite avec quantite dans le sol calculee
321               CALL cltracrn(it, pdtphys, yu1, yv1, &               CALL cltracrn(it, pdtphys, yu1, yv1, &
# Line 392  contains Line 363  contains
363      ! si radio=true mais pour l'instant radiornpb propre au cas rnpb      ! si radio=true mais pour l'instant radiornpb propre au cas rnpb
364      if (rnpb) then      if (rnpb) then
365         d_tr_dec(:, :, :) = radiornpb(tr_seri, pdtphys, tautr)         d_tr_dec(:, :, :) = radiornpb(tr_seri, pdtphys, tautr)
366         DO it=1, nqmax         DO it=1, nq_phys
367            if (radio(it)) then            if (radio(it)) then
368               tr_seri(:, :, it) = tr_seri(:, :, it) + d_tr_dec(:, :, it)               tr_seri(:, :, it) = tr_seri(:, :, it) + d_tr_dec(:, :, it)
369               WRITE(unit=itn, fmt='(i1)') it               WRITE(unit=itn, fmt='(i1)') it
# Line 401  contains Line 372  contains
372         ENDDO         ENDDO
373      endif ! rnpb decroissance  radioactive      endif ! rnpb decroissance  radioactive
374    
375      if (nqmax >= 3) then      if (nq_phys >= 3) then
376         ! Ozone as a tracer:         ! Ozone as a tracer:
377         if (mod(itap - 1, lmt_pas) == 0) then         if (mod(itap - 1, lmt_pas) == 0) then
378            ! Once per day, update the coefficients for ozone chemistry:            ! Once per day, update the coefficients for ozone chemistry:
# Line 419  contains Line 390  contains
390    
391         ! tendance des aerosols nuclees et impactes         ! tendance des aerosols nuclees et impactes
392    
393         DO it = 1, nqmax         DO it = 1, nq_phys
394            IF (aerosol(it)) THEN            IF (aerosol(it)) THEN
395               DO k = 1, llm               DO k = 1, llm
396                  DO i = 1, klon                  DO i = 1, klon
# Line 435  contains Line 406  contains
406         ! Mises a jour des traceurs + calcul des flux de lessivage         ! Mises a jour des traceurs + calcul des flux de lessivage
407         ! Mise a jour due a l'impaction et a la nucleation         ! Mise a jour due a l'impaction et a la nucleation
408    
409         DO it = 1, nqmax         DO it = 1, nq_phys
410            IF (aerosol(it)) THEN            IF (aerosol(it)) THEN
411               DO k = 1, llm               DO k = 1, llm
412                  DO i = 1, klon                  DO i = 1, klon
# Line 448  contains Line 419  contains
419    
420         ! Flux lessivage total         ! Flux lessivage total
421    
422         DO it = 1, nqmax         DO it = 1, nq_phys
423            DO k = 1, llm            DO k = 1, llm
424               DO i = 1, klon               DO i = 1, klon
425                  flestottr(i, k, it) = flestottr(i, k, it) - &                  flestottr(i, k, it) = flestottr(i, k, it) - &
# Line 462  contains Line 433  contains
433      ENDIF      ENDIF
434    
435      !   Ecriture des sorties      !   Ecriture des sorties
436      call write_histrac(lessivage, nqmax, itap, nid_tra)      call write_histrac(lessivage, nq_phys, itap, nid_tra)
437    
438      if (lafin) then      if (lafin) then
439         print *, "C'est la fin de la physique."         print *, "C'est la fin de la physique."
# Line 476  contains Line 447  contains
447    
448    contains    contains
449    
450      subroutine write_histrac(lessivage, nqmax, itap, nid_tra)      subroutine write_histrac(lessivage, nq_phys, itap, nid_tra)
451    
452        ! From phylmd/write_histrac.h, version 1.9 2006/02/21 08:08:30        ! From phylmd/write_histrac.h, version 1.9 2006/02/21 08:08:30
453    
454        use dimens_m, only: iim, jjm, llm        use dimens_m, only: iim, jjm, llm
455        use ioipsl, only: histwrite, histsync        use histsync_m, only: histsync
456          use histwrite_m, only: histwrite
457        use temps, only: itau_phy        use temps, only: itau_phy
458        use advtrac_m, only: tnom        use iniadvtrac_m, only: tnom
459        use comgeomphy, only: airephy        use comgeomphy, only: airephy
460        use dimphy, only: klon        use dimphy, only: klon
461          use grid_change, only: gr_phy_write_2d
462          use gr_phy_write_3d_m, only: gr_phy_write_3d
463    
464        logical, intent(in):: lessivage        logical, intent(in):: lessivage
465    
466        integer, intent(in):: nqmax        integer, intent(in):: nq_phys
467        ! (nombre de traceurs auxquels on applique la physique)        ! (nombre de traceurs auxquels on applique la physique)
468    
469        integer, intent(in):: itap  ! number of calls to "physiq"        integer, intent(in):: itap  ! number of calls to "physiq"
470        integer, intent(in):: nid_tra        integer, intent(in):: nid_tra
471    
472        ! Variables local to the procedure:        ! Variables local to the procedure:
       INTEGER ndex2d(iim*(jjm+1)), ndex3d(iim*(jjm+1)*llm)  
473        integer it        integer it
474        integer itau_w   ! pas de temps ecriture        integer itau_w   ! pas de temps ecriture
       REAL zx_tmp_2d(iim, jjm+1), zx_tmp_3d(iim, jjm+1, llm)  
475        logical, parameter:: ok_sync = .true.        logical, parameter:: ok_sync = .true.
476    
477        !-----------------------------------------------------        !-----------------------------------------------------
478    
       ndex2d = 0  
       ndex3d = 0  
479        itau_w = itau_phy + itap        itau_w = itau_phy + itap
480    
481        CALL gr_fi_ecrit(1, klon, iim, jjm+1, pphis, zx_tmp_2d)        CALL histwrite(nid_tra, "phis", itau_w, gr_phy_write_2d(pphis))
482        CALL histwrite(nid_tra, "phis", itau_w, zx_tmp_2d)        CALL histwrite(nid_tra, "aire", itau_w, gr_phy_write_2d(airephy))
483          CALL histwrite(nid_tra, "zmasse", itau_w, gr_phy_write_3d(zmasse))
484        CALL gr_fi_ecrit(1, klon, iim, jjm+1, airephy, zx_tmp_2d)        
485        CALL histwrite(nid_tra, "aire", itau_w, zx_tmp_2d)        DO it=1, nq_phys
486             CALL histwrite(nid_tra, tnom(it+2), itau_w, &
487        CALL gr_fi_ecrit(llm, klon, iim, jjm+1, zmasse, zx_tmp_3d)                      gr_phy_write_3d(tr_seri(:, :, it)))
       CALL histwrite(nid_tra, "zmasse", itau_w, zx_tmp_3d)  
   
       DO it=1, nqmax  
          CALL gr_fi_ecrit(llm, klon, iim, jjm+1, tr_seri(1, 1, it), zx_tmp_3d)  
          CALL histwrite(nid_tra, tnom(it+2), itau_w, zx_tmp_3d)  
488           if (lessivage) THEN           if (lessivage) THEN
489              CALL gr_fi_ecrit(llm, klon, iim, jjm+1, flestottr(1, 1, it), &              CALL histwrite(nid_tra, "fl"//tnom(it+2), itau_w, &
490                   zx_tmp_3d)                   gr_phy_write_3d(flestottr(:, :, it)))
             CALL histwrite(nid_tra, "fl"//tnom(it+2), itau_w, zx_tmp_3d)  
491           endif           endif
492             CALL histwrite(nid_tra, "d_tr_th_"//tnom(it+2), itau_w, &
493           CALL gr_fi_ecrit(llm, klon, iim, jjm+1, d_tr_th(1, 1, it), zx_tmp_3d)                gr_phy_write_3d(d_tr_th(:, :, it)))
494           CALL histwrite(nid_tra, "d_tr_th_"//tnom(it+2), itau_w, zx_tmp_3d)           CALL histwrite(nid_tra, "d_tr_cv_"//tnom(it+2), itau_w, &
495           CALL gr_fi_ecrit(llm, klon, iim, jjm+1, d_tr_cv(1, 1, it), zx_tmp_3d)                gr_phy_write_3d(d_tr_cv(:, :, it)))
496           CALL histwrite(nid_tra, "d_tr_cv_"//tnom(it+2), itau_w, zx_tmp_3d)           CALL histwrite(nid_tra, "d_tr_cl_"//tnom(it+2), itau_w, &
497           CALL gr_fi_ecrit(llm, klon, iim, jjm+1, d_tr_cl(1, 1, it), zx_tmp_3d)                gr_phy_write_3d(d_tr_cl(:, :, it)))
          CALL histwrite(nid_tra, "d_tr_cl_"//tnom(it+2), itau_w, zx_tmp_3d)  
498        ENDDO        ENDDO
499    
500        CALL gr_fi_ecrit(llm, klon, iim, jjm+1, pplay, zx_tmp_3d)        CALL histwrite(nid_tra, "pplay", itau_w, gr_phy_write_3d(pplay))
501        CALL histwrite(nid_tra, "pplay", itau_w, zx_tmp_3d)        CALL histwrite(nid_tra, "T", itau_w, gr_phy_write_3d(t_seri))
   
       CALL gr_fi_ecrit(llm, klon, iim, jjm+1, t_seri, zx_tmp_3d)  
       CALL histwrite(nid_tra, "t", itau_w, zx_tmp_3d)  
502    
503        if (ok_sync) then        if (ok_sync) then
504           call histsync(nid_tra)           call histsync(nid_tra)
# Line 548  contains Line 508  contains
508    
509    END SUBROUTINE phytrac    END SUBROUTINE phytrac
510    
   !*************************************************  
   
   subroutine ini_histrac(nid_tra, pdtphys, presnivs, nqmax, lessivage)  
   
     ! From phylmd/ini_histrac.h, version 1.10 2006/02/21 08:08:30  
   
     use dimens_m, only: iim, jjm, llm  
     use ioipsl, only: ymds2ju, histbeg_totreg, histvert, histdef, histend  
     use temps, only: annee_ref, day_ref, itau_phy  
     use advtrac_m, only: niadv, tnom, ttext  
     use dimphy, only: klon  
     use clesphys, only: ecrit_tra  
     use grid_change, only: gr_phy_write_2d  
     use phyetat0_m, only: rlon, rlat  
   
     INTEGER, intent(out):: nid_tra  
     real, intent(in):: pdtphys  ! pas d'integration pour la physique (s)  
     REAL, intent(in):: presnivs(:)  
   
     integer, intent(in):: nqmax  
     ! (nombre de traceurs auxquels on applique la physique)  
   
     logical, intent(in):: lessivage  
   
     ! Variables local to the procedure:  
   
     REAL zjulian  
     REAL zx_lat(iim, jjm+1)  
     INTEGER nhori, nvert  
     REAL zsto, zout  
     integer it, iq, iiq  
   
     !---------------------------------------------------------  
   
     CALL ymds2ju(annee_ref, month=1, day=day_ref, sec=0.0, julian=zjulian)  
     zx_lat(:, :) = gr_phy_write_2d(rlat)  
     CALL histbeg_totreg("histrac", rlon(2:iim+1), zx_lat(1, :), &  
          1, iim, 1, jjm+1, itau_phy, zjulian, pdtphys, nhori, nid_tra)  
     CALL histvert(nid_tra, "presnivs", "Vertical levels", "mb", llm, &  
          presnivs, nvert)  
   
     zsto = pdtphys  
     zout = pdtphys * REAL(ecrit_tra)  
   
     CALL histdef(nid_tra, "phis", "Surface geop. height", "-", &  
          iim, jjm+1, nhori, 1, 1, 1, -99, &  
          "once",  zsto, zout)  
     CALL histdef(nid_tra, "aire", "Grid area", "-", &  
          iim, jjm+1, nhori, 1, 1, 1, -99, &  
          "once",  zsto, zout)  
     CALL histdef(nid_tra, "zmasse", "column density of air in cell", &  
          "kg m-2", iim, jjm + 1, nhori, llm, 1, llm, nvert, "ave(X)", &  
          zsto, zout)  
   
     DO it = 1, nqmax  
        ! champ 2D  
        iq=it+2  
        iiq=niadv(iq)  
        CALL histdef(nid_tra, tnom(iq), ttext(iiq), "U/kga", iim, jjm+1, &  
             nhori, llm, 1, llm, nvert, "ave(X)", zsto, zout)  
        if (lessivage) THEN  
           CALL histdef(nid_tra, "fl"//tnom(iq), "Flux "//ttext(iiq), &  
                "U/m2/s", iim, jjm+1, nhori, llm, 1, llm, nvert, &  
                "ave(X)", zsto, zout)  
        endif  
   
        !---Ajout Olivia  
        CALL histdef(nid_tra, "d_tr_th_"//tnom(iq), &  
             "tendance thermique"// ttext(iiq), "?", &  
             iim, jjm+1, nhori, llm, 1, llm, nvert, &  
             "ave(X)", zsto, zout)  
        CALL histdef(nid_tra, "d_tr_cv_"//tnom(iq), &  
             "tendance convection"// ttext(iiq), "?", &  
             iim, jjm+1, nhori, llm, 1, llm, nvert, &  
             "ave(X)", zsto, zout)  
        CALL histdef(nid_tra, "d_tr_cl_"//tnom(iq), &  
             "tendance couche limite"// ttext(iiq), "?", &  
             iim, jjm+1, nhori, llm, 1, llm, nvert, &  
             "ave(X)", zsto, zout)  
        !---fin Olivia      
   
     ENDDO  
   
     CALL histdef(nid_tra, "pplay", "", "-", &  
          iim, jjm+1, nhori, llm, 1, llm, nvert, &  
          "inst(X)", zout, zout)  
     CALL histdef(nid_tra, "t", "", "-", &  
          iim, jjm+1, nhori, llm, 1, llm, nvert, &  
          "inst(X)", zout, zout)  
   
     CALL histend(nid_tra)  
   
   end subroutine ini_histrac  
   
   !*************************************************  
   
   function radiornpb(tr_seri, pdtphys, tautr)  
   
     ! From phylmd/radiornpb.F, v 1.2 2005/05/25 13:10:09  
   
     ! Auteurs: AA + CG (LGGE/CNRS) Date 24-06-94  
     ! Objet: Decroissance radioactive d'un traceur dans l'atmosphere  
     !G 24 06 94 : Pour un traceur, le radon  
     !G 16 12 94 : Plus un 2eme traceur, le 210Pb. Le radon decroit en plomb.  
   
     ! Le pas de temps "pdtphys" est supposé beaucoup plus petit que la  
     ! constante de temps de décroissance.  
   
     use dimens_m, only: llm  
     use dimphy, only: klon, nbtr  
     use numer_rec, only: assert  
   
     IMPLICIT none  
   
     REAL, intent(in):: tr_seri(:, :, :), pdtphys, tautr(:)  
     real radiornpb(klon, llm, 2)  
   
     ! Variable local to the procedure:  
     INTEGER it  
   
     !-----------------------------------------------  
   
     call assert(shape(tr_seri) == (/klon, llm, nbtr/), "radiornpb tr_seri")  
     call assert(size(tautr) == nbtr, "radiornpb tautr")  
   
     DO it = 1, 2  
        IF (tautr(it) > 0.) THEN  
           radiornpb(:, :, it) = - tr_seri(:, :, it) * pdtphys / tautr(it)  
        ELSE  
           radiornpb(:, :, it) = 0.  
        END IF  
     END DO  
   
     !G161294 : Cas particulier radon 1 => plomb 2  
     radiornpb(:, :, 2) = radiornpb(:, :, 2) - radiornpb(:, :, 1)  
   
   END function radiornpb  
   
   !*************************************************  
   
   SUBROUTINE minmaxqfi(zq, qmin, qmax, comment)  
   
     ! From phylmd/minmaxqfi.F, version 1.1.1.1 2004/05/19 12:53:09  
   
     use dimens_m, only: llm  
     use dimphy, only: klon  
     use numer_rec, only: assert  
   
     IMPLICIT none  
   
     real, intent(in):: zq(:, :), qmin, qmax  
     CHARACTER(len=*), intent(in):: comment  
   
     ! Variables local to the procedure:  
   
     INTEGER jadrs(klon), jbad, k, i  
   
     !---------------------------------  
   
     call assert(shape(zq) == (/klon, llm/), "minmaxqfi")  
   
     DO k = 1, llm  
        jbad = 0  
        DO i = 1, klon  
           IF (zq(i, k) > qmax .OR. zq(i, k) < qmin) THEN  
              jbad = jbad + 1  
              jadrs(jbad) = i  
           ENDIF  
        ENDDO  
        IF (jbad > 0) THEN  
           PRINT *, comment  
           DO i = 1, jbad  
              PRINT *, "zq(", jadrs(i), ", ", k, ") = ", zq(jadrs(i), k)  
           ENDDO  
        ENDIF  
     ENDDO  
   
   end SUBROUTINE minmaxqfi  
   
511  end module phytrac_m  end module phytrac_m

Legend:
Removed from v.15  
changed lines
  Added in v.62

  ViewVC Help
Powered by ViewVC 1.1.21