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

Diff of /trunk/Sources/phylmd/phytrac.f

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

trunk/libf/phylmd/phytrac.f90 revision 15 by guez, Fri Aug 1 15:24:12 2008 UTC trunk/phylmd/phytrac.f revision 99 by guez, Wed Jul 2 18:39:15 2014 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 9  module phytrac_m Line 7  module phytrac_m
7    
8  contains  contains
9    
10    SUBROUTINE phytrac(rnpb, itap, lmt_pas, julien, gmtime, firstcal, lafin, &    SUBROUTINE phytrac(itap, lmt_pas, julien, gmtime, firstcal, lafin, pdtphys, &
11         nqmax, pdtphys, u, v, t_seri, paprs, pplay, pmfu, pmfd, pen_u, &         u, t_seri, paprs, pplay, pmfu, pmfd, pde_u, pen_d, coefh, fm_therm, &
12         pde_u, pen_d, pde_d, coefh, fm_therm, entr_therm, yu1, yv1, ftsol, &         entr_therm, yu1, yv1, ftsol, pctsrf, frac_impa, frac_nucl, pphis, &
13         pctsrf, frac_impa, frac_nucl, presnivs, pphis, &         albsol, rh, cldfra, rneb, diafra, cldliq, pmflxr, pmflxs, prfl, psfl, &
14         pphi, albsol, rh, cldfra, rneb, diafra, cldliq, itop_con, &         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\'ed\'eric Hourdin, Abderrahmane Idelkadi, Marie-Alice
19      ! Foujols, Olivia      ! Foujols, Olivia
     ! Objet : moniteur général des tendances des traceurs  
20    
21      ! Remarques :      ! Objet : moniteur g\'en\'eral des tendances des traceurs
     ! 1/ L'appel de "phytrac" se fait avec "nq-2" donc nous avons bien  
     ! les vrais traceurs (en nombre "nbtr", sans la vapeur d'eau ni l'eau  
     ! 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 ?  
22    
23      use dimens_m, only: iim, jjm, llm      ! L'appel de "phytrac" se fait avec "nqmx - 2" donc nous avons
24      use indicesol, only: nbsrf      ! bien les vrais traceurs, sans la vapeur d'eau ni l'eau liquide.
25      use dimphy, only: klon, nbtr  
26        ! Modifications pour les traceurs :
27        ! - uniformisation des parametrisations dans phytrac
28        ! - stockage des moyennes des champs n\'ecessaires en mode traceur off-line
29    
30        use abort_gcm_m, only: abort_gcm
31      use clesphys, only: ecrit_tra      use clesphys, only: ecrit_tra
32      use clesphys2, only: iflag_con      use clesphys2, only: iflag_con
33      use abort_gcm_m, only: abort_gcm      use cltracrn_m, only: cltracrn
     use YOMCST, only: rg  
34      use ctherm, only: iflag_thermals      use ctherm, only: iflag_thermals
35      use regr_pr_comb_coefoz_m, only: regr_pr_comb_coefoz      use dimens_m, only: llm, nqmx
36      use phyetat0_m, only: rlat      use dimphy, only: klon
37        use indicesol, only: nbsrf
38        use ini_histrac_m, only: ini_histrac
39        use initrrnpb_m, only: initrrnpb
40        use minmaxqfi_m, only: minmaxqfi
41        use nflxtr_m, only: nflxtr
42        use nr_util, only: assert
43      use o3_chem_m, only: o3_chem      use o3_chem_m, only: o3_chem
44        use phyetat0_m, only: rlat
45        use press_coefoz_m, only: press_coefoz
46        use radiornpb_m, only: radiornpb
47        use regr_pr_comb_coefoz_m, only: regr_pr_comb_coefoz
48        use SUPHEC_M, only: rg
49    
50      ! Arguments:      integer, intent(in):: itap ! number of calls to "physiq"
   
     !   EN ENTREE:  
   
     !   divers:  
   
     logical, intent(in):: rnpb  
   
     integer, intent(in):: nqmax  
     ! (nombre de traceurs auxquels on applique la physique)  
   
     integer, intent(in):: itap  ! number of calls to "physiq"  
51      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
52      integer, intent(in):: julien !jour julien, 1 <= julien <= 360      integer, intent(in):: julien !jour julien, 1 <= julien <= 360
53      integer itop_con(klon)      real, intent(in):: gmtime ! heure de la journ\'ee en fraction de jour
54      integer ibas_con(klon)      logical, intent(in):: firstcal ! first call to "calfis"
55      real, intent(in):: gmtime ! heure de la journée en fraction de jour      logical, intent(in):: lafin ! fin de la physique
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):: u(klon, llm)
58      real, intent(in):: t_seri(klon, llm) ! temperature, in K      real, intent(in):: t_seri(klon, llm) ! temperature, in K
59    
     real tr_seri(klon, llm, nbtr)  
     ! (mass fractions of tracers, excluding water, at mid-layers)  
   
     real u(klon, llm)  
     real v(klon, llm)  
     real rh(klon, llm)     ! humidite relative  
     real cldliq(klon, llm) ! eau liquide nuageuse  
     real cldfra(klon, llm) ! fraction nuageuse (tous les nuages)  
   
     real diafra(klon, llm)  
     ! (fraction nuageuse (convection ou stratus artificiels))  
   
     real rneb(klon, llm)   ! fraction nuageuse (grande echelle)  
     real albsol(klon)  ! albedo surface  
   
60      real, intent(in):: paprs(klon, llm+1)      real, intent(in):: paprs(klon, llm+1)
61      ! (pression pour chaque inter-couche, en Pa)      ! (pression pour chaque inter-couche, en Pa)
62    
63      real, intent(in):: pplay(klon, llm)      real, intent(in):: pplay(klon, llm)
64      ! (pression pour le mileu de chaque couche, en Pa)      ! (pression pour le mileu de chaque couche, en Pa)
65    
66      real pphi(klon, llm) ! geopotentiel      ! convection:
     real pphis(klon)  
     REAL, intent(in):: presnivs(llm)  
     logical, intent(in):: firstcal ! first call to "calfis"  
     logical, intent(in):: lafin ! fin de la physique  
   
     integer nsplit  
     REAL pmflxr(klon, llm+1), pmflxs(klon, llm+1)   !--lessivage convection  
     REAL prfl(klon, llm+1),   psfl(klon, llm+1)     !--lessivage large-scale  
67    
68      !   convection:      REAL, intent(in):: pmfu(klon, llm) ! flux de masse dans le panache montant
69    
70      REAL pmfu(klon, llm)  ! flux de masse dans le panache montant      REAL, intent(in):: pmfd(klon, llm)
71      REAL pmfd(klon, llm)  ! flux de masse dans le panache descendant      ! flux de masse dans le panache descendant
     REAL pen_u(klon, llm) ! flux entraine dans le panache montant  
72    
73      !   thermiques:      REAL pde_u(klon, llm) ! flux detraine dans le panache montant
74        REAL pen_d(klon, llm) ! flux entraine dans le panache descendant
75        REAL coefh(klon, llm) ! coeff melange couche limite
76    
77        ! thermiques:
78      real fm_therm(klon, llm+1), entr_therm(klon, llm)      real fm_therm(klon, llm+1), entr_therm(klon, llm)
79    
80      REAL pde_u(klon, llm) ! flux detraine dans le panache montant      ! Couche limite:
81      REAL pen_d(klon, llm) ! flux entraine dans le panache descendant      REAL yu1(klon) ! vents au premier niveau
82      REAL pde_d(klon, llm) ! flux detraine dans le panache descendant      REAL yv1(klon) ! vents au premier niveau
     ! KE  
     real da(klon, llm), phi(klon, llm, llm), mp(klon, llm)  
     REAL upwd(klon, llm)      ! saturated updraft mass flux  
     REAL dnwd(klon, llm)      ! saturated downdraft mass flux  
83    
84      !   Couche limite:      ! Arguments n\'ecessaires pour les sources et puits de traceur :
85        real ftsol(klon, nbsrf) ! Temperature du sol (surf)(Kelvin)
86        real pctsrf(klon, nbsrf) ! Pourcentage de sol f(nature du sol)
87    
88        ! Lessivage pour le on-line
89        REAL frac_impa(klon, llm) ! fraction d'aerosols impactes
90        REAL frac_nucl(klon, llm) ! fraction d'aerosols nuclees
91    
92        real, intent(in):: pphis(klon)
93        real albsol(klon) ! albedo surface
94        real rh(klon, llm) ! humidite relative
95        real cldfra(klon, llm) ! fraction nuageuse (tous les nuages)
96        real rneb(klon, llm) ! fraction nuageuse (grande echelle)
97    
98      REAL coefh(klon, llm) ! coeff melange CL      real diafra(klon, llm)
99      REAL yu1(klon)        ! vents au premier niveau      ! (fraction nuageuse (convection ou stratus artificiels))
     REAL yv1(klon)        ! vents au premier niveau  
100    
101      !   Lessivage:      real cldliq(klon, llm) ! eau liquide nuageuse
102        REAL pmflxr(klon, llm+1), pmflxs(klon, llm+1) !--lessivage convection
103        REAL prfl(klon, llm+1), psfl(klon, llm+1) !--lessivage large-scale
104    
105      ! pour le ON-LINE      ! Kerry Emanuel
106        real, intent(in):: da(klon, llm), phi(klon, llm, llm), mp(klon, llm)
107        REAL, intent(in):: upwd(klon, llm) ! saturated updraft mass flux
108        REAL, intent(in):: dnwd(klon, llm) ! saturated downdraft mass flux
109    
110      REAL frac_impa(klon, llm)  ! fraction d'aerosols impactes      real, intent(inout):: tr_seri(:, :, :) ! (klon, llm, nqmx - 2)
111      REAL frac_nucl(klon, llm)  ! fraction d'aerosols nuclees      ! (mass fractions of tracers, excluding water, at mid-layers)
112    
113      ! Arguments necessaires pour les sources et puits de traceur:      real, intent(in):: zmasse(:, :) ! (klon, llm)
114        ! (column-density of mass of air in a cell, in kg m-2)
115    
116      real ftsol(klon, nbsrf)  ! Temperature du sol (surf)(Kelvin)      ! Variables local to the procedure:
     real pctsrf(klon, nbsrf) ! Pourcentage de sol f(nature du sol)  
117    
118      real pftsol1(klon), pftsol2(klon), pftsol3(klon), pftsol4(klon)      integer nsplit
     real ppsrf1(klon), ppsrf2(klon), ppsrf3(klon), ppsrf4(klon)  
119    
120      !  VARIABLES LOCALES TRACEURS      ! TRACEURS
121    
122      ! Sources et puits des traceurs:      ! Sources et puits des traceurs:
123    
124      ! Pour l'instant seuls les cas du rn et du pb ont ete envisages.      ! Pour l'instant seuls les cas du rn et du pb ont ete envisages.
125    
126      REAL source(klon)       ! a voir lorsque le flux est prescrit      REAL source(klon) ! a voir lorsque le flux est prescrit
127      !      !
128      ! Pour la source de radon et son reservoir de sol      ! Pour la source de radon et son reservoir de sol
129    
130      REAL, save:: trs(klon, nbtr)    ! Concentration de radon dans le sol      REAL, save:: trs(klon, nqmx - 2) ! Concentration de radon dans le sol
131    
132      REAL masktr(klon, nbtr) ! Masque reservoir de sol traceur      REAL masktr(klon, nqmx - 2) ! Masque reservoir de sol traceur
133      !                            Masque de l'echange avec la surface      ! Masque de l'echange avec la surface
134      !                           (1 = reservoir) ou (possible => 1 )      ! (1 = reservoir) ou (possible => 1)
135      SAVE masktr      SAVE masktr
136      REAL fshtr(klon, nbtr)  ! Flux surfacique dans le reservoir de sol      REAL fshtr(klon, nqmx - 2) ! Flux surfacique dans le reservoir de sol
137      SAVE fshtr      SAVE fshtr
138      REAL hsoltr(nbtr)      ! Epaisseur equivalente du reservoir de sol      REAL hsoltr(nqmx - 2) ! Epaisseur equivalente du reservoir de sol
139      SAVE hsoltr      SAVE hsoltr
140      REAL tautr(nbtr)       ! Constante de decroissance radioactive      REAL tautr(nqmx - 2) ! Constante de decroissance radioactive
141      SAVE tautr      SAVE tautr
142      REAL vdeptr(nbtr)      ! Vitesse de depot sec dans la couche Brownienne      REAL vdeptr(nqmx - 2) ! Vitesse de depot sec dans la couche Brownienne
143      SAVE vdeptr      SAVE vdeptr
144      REAL scavtr(nbtr)      ! Coefficient de lessivage      REAL scavtr(nqmx - 2) ! Coefficient de lessivage
145      SAVE scavtr      SAVE scavtr
146    
147      CHARACTER itn      CHARACTER itn
# Line 164  contains Line 149  contains
149    
150      ! nature du traceur      ! nature du traceur
151    
152      logical aerosol(nbtr)  ! Nature du traceur      logical aerosol(nqmx - 2) ! Nature du traceur
153      !                            ! aerosol(it) = true  => aerosol      ! ! aerosol(it) = true => aerosol
154      !                            ! aerosol(it) = false => gaz      ! ! aerosol(it) = false => gaz
155      logical clsol(nbtr)    ! couche limite sol calculée      logical clsol(nqmx - 2) ! couche limite sol calcul\'ee
156      logical radio(nbtr)    ! décroisssance radioactive      logical radio(nqmx - 2) ! d\'ecroisssance radioactive
157      save aerosol, clsol, radio      save aerosol, clsol, radio
158    
159      ! convection tiedtke      ! convection tiedtke
# Line 180  contains Line 165  contains
165      ! Variables locales pour effectuer les appels en serie      ! Variables locales pour effectuer les appels en serie
166    
167      REAL d_tr(klon, llm), d_trs(klon) ! tendances de traceurs      REAL d_tr(klon, llm), d_trs(klon) ! tendances de traceurs
168      REAL d_tr_cl(klon, llm, nbtr) ! tendance de traceurs  couche limite      REAL d_tr_cl(klon, llm, nqmx - 2) ! tendance de traceurs couche limite
169      REAL d_tr_cv(klon, llm, nbtr) ! tendance de traceurs  conv pour chq traceur      REAL d_tr_cv(klon, llm, nqmx - 2) ! tendance de traceurs conv pour chq traceur
170      REAL d_tr_th(klon, llm, nbtr) ! la tendance des thermiques      REAL d_tr_th(klon, llm, nqmx - 2) ! la tendance des thermiques
171      REAL d_tr_dec(klon, llm, 2) ! la tendance de la decroissance      REAL d_tr_dec(klon, llm, 2) ! la tendance de la decroissance
172      !                                   ! radioactive du rn - > pb      ! ! radioactive du rn - > pb
173      REAL d_tr_lessi_impa(klon, llm, nbtr) ! la tendance du lessivage      REAL d_tr_lessi_impa(klon, llm, nqmx - 2) ! la tendance du lessivage
174      !                                          ! par impaction      ! ! par impaction
175      REAL d_tr_lessi_nucl(klon, llm, nbtr) ! la tendance du lessivage      REAL d_tr_lessi_nucl(klon, llm, nqmx - 2) ! la tendance du lessivage
176      !                                          ! par nucleation      ! ! par nucleation
177      REAL flestottr(klon, llm, nbtr) ! flux de lessivage      REAL flestottr(klon, llm, nqmx - 2) ! flux de lessivage
178      !                                    ! dans chaque couche      ! ! dans chaque couche
   
     real zmasse(klon, llm)  
     ! (column-density of mass of air in a layer, in kg m-2)  
179    
180      real ztra_th(klon, llm)      real ztra_th(klon, llm)
   
     character(len=20) modname  
     character(len=80) abort_message  
181      integer isplit      integer isplit
182    
183      ! Controls:      ! Controls:
# Line 209  contains Line 188  contains
188    
189      !--------------------------------------      !--------------------------------------
190    
191      modname='phytrac'      call assert(shape(zmasse) == (/klon, llm/), "phytrac zmasse")
192        call assert(shape(tr_seri) == (/klon, llm, nqmx - 2/), "phytrac tr_seri")
193    
194      if (firstcal) then      if (firstcal) then
195         print *, 'phytrac: pdtphys = ', pdtphys         print *, 'phytrac: pdtphys = ', pdtphys
196         PRINT *, 'Fréquence de sortie des traceurs : ecrit_tra = ', ecrit_tra         PRINT *, 'Frequency of tracer output: ecrit_tra = ', ecrit_tra
197         if (nbtr < nqmax) then         inirnpb = .true.
           abort_message='See above'  
           call abort_gcm(modname, abort_message, 1)  
        endif  
        inirnpb=rnpb  
198    
199         ! Initialisation des sorties :         ! Initialisation des sorties :
200         call ini_histrac(nid_tra, pdtphys, presnivs, nqmax, lessivage)         call ini_histrac(nid_tra, pdtphys, nqmx - 2, lessivage)
201    
202         ! Initialisation de certaines variables pour le radon et le plomb         ! Initialisation de certaines variables pour le radon et le plomb
203         ! Initialisation du traceur dans le sol (couche limite radonique)         ! Initialisation du traceur dans le sol (couche limite radonique)
# Line 235  contains Line 211  contains
211    
212         ! Initialisation de la fraction d'aerosols lessivee         ! Initialisation de la fraction d'aerosols lessivee
213    
214         d_tr_lessi_impa(:, :, :) = 0.         d_tr_lessi_impa = 0.
215         d_tr_lessi_nucl(:, :, :) = 0.         d_tr_lessi_nucl = 0.
216    
217         ! Initialisation de la nature des traceurs         ! Initialisation de la nature des traceurs
218    
219         DO it = 1, nqmax         DO it = 1, nqmx - 2
220            aerosol(it) = .FALSE.  ! Tous les traceurs sont des gaz par defaut            aerosol(it) = .FALSE. ! Tous les traceurs sont des gaz par defaut
221            radio(it) = .FALSE. ! par défaut pas de passage par "radiornpb"            radio(it) = .FALSE. ! par d\'efaut pas de passage par "radiornpb"
222            clsol(it) = .FALSE.  ! Par defaut couche limite avec flux prescrit            clsol(it) = .FALSE. ! Par defaut couche limite avec flux prescrit
223         ENDDO         ENDDO
224    
225           if (nqmx >= 5) then
226              call press_coefoz ! read input pressure levels for ozone coefficients
227           end if
228      ENDIF      ENDIF
229    
     ! Initialisation du traceur dans le sol (couche limite radonique)  
230      if (inirnpb) THEN      if (inirnpb) THEN
231           ! Initialisation du traceur dans le sol (couche limite radonique)
232         radio(1)= .true.         radio(1)= .true.
233         radio(2)= .true.         radio(2)= .true.
234         clsol(1)= .true.         clsol(1)= .true.
235         clsol(2)= .true.         clsol(2)= .true.
236         aerosol(2) = .TRUE. ! le Pb est un aerosol         aerosol(2) = .TRUE. ! le Pb est un aerosol
237           call initrrnpb(pctsrf, masktr, fshtr, hsoltr, tautr, vdeptr, scavtr)
        call initrrnpb(ftsol, pctsrf, masktr, fshtr, hsoltr, tautr, vdeptr, &  
             scavtr)  
238         inirnpb=.false.         inirnpb=.false.
239      endif      endif
240    
     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  
   
241      if (convection) then      if (convection) then
242         DO it=1, nqmax         ! Calcul de l'effet de la convection
243            if (iflag_con.eq.2) then         DO it=1, nqmx - 2
244               ! tiedke            if (iflag_con == 2) then
245               CALL nflxtr(pdtphys, pmfu, pmfd, pen_u, pde_u, pen_d, pde_d, &               ! Tiedke
246                    paprs, tr_seri(1, 1, it), d_tr_cv(1, 1, it))               CALL nflxtr(pdtphys, pmfu, pmfd, pde_u, pen_d, paprs, &
247            else if (iflag_con.eq.3) then                    tr_seri(:, :, it), d_tr_cv(:, :, it))
248               ! KE            else if (iflag_con == 3) then
249               call cvltr(pdtphys, da, phi, mp, paprs, &               ! Emanuel
250                    tr_seri(1, 1, it), upwd, dnwd, d_tr_cv(1, 1, it))               call cvltr(pdtphys, da, phi, mp, paprs, tr_seri(1, 1, it), upwd, &
251                      dnwd, d_tr_cv(1, 1, it))
252            endif            endif
253    
254            DO k = 1, llm            DO k = 1, llm
# Line 294  contains Line 257  contains
257               ENDDO               ENDDO
258            ENDDO            ENDDO
259            WRITE(unit=itn, fmt='(i1)') it            WRITE(unit=itn, fmt='(i1)') it
260            CALL minmaxqfi(tr_seri(:, :, it), 0., 1.e33, &            CALL minmaxqfi(tr_seri(:, :, it), 0., 1e33, &
261                 'convection, tracer index = ' // itn)                 'convection, tracer index = ' // itn)
262         ENDDO         ENDDO
263      endif      endif
264    
     forall (k=1: llm) zmasse(:, k) = (paprs(:, k)-paprs(:, k+1)) / rg  
   
265      ! Calcul de l'effet des thermiques      ! Calcul de l'effet des thermiques
266    
267      do it=1, nqmax      do it=1, nqmx - 2
268         do k=1, llm         do k=1, llm
269            do i=1, klon            do i=1, klon
270               d_tr_th(i, k, it)=0.               d_tr_th(i, k, it)=0.
271               tr_seri(i, k, it)=max(tr_seri(i, k, it), 0.)               tr_seri(i, k, it)=max(tr_seri(i, k, it), 0.)
272               tr_seri(i, k, it)=min(tr_seri(i, k, it), 1.e10)               tr_seri(i, k, it)=min(tr_seri(i, k, it), 1e10)
273            enddo            enddo
274         enddo         enddo
275      enddo      enddo
276    
277      if (iflag_thermals > 0) then      if (iflag_thermals > 0) then
278         nsplit=10         nsplit=10
279         DO it=1, nqmax         DO it=1, nqmx - 2
280            do isplit=1, nsplit            do isplit=1, nsplit
281               ! Thermiques               ! Thermiques
282               call dqthermcell(klon, llm, pdtphys/nsplit &               call dqthermcell(klon, llm, pdtphys/nsplit &
# Line 333  contains Line 294  contains
294         ENDDO         ENDDO
295      endif      endif
296    
297      !   Calcul de l'effet de la couche limite      ! Calcul de l'effet de la couche limite
298    
299      if (couchelimite) then      if (couchelimite) then
   
300         DO k = 1, llm         DO k = 1, llm
301            DO i = 1, klon            DO i = 1, klon
302               delp(i, k) = paprs(i, k)-paprs(i, k+1)               delp(i, k) = paprs(i, k)-paprs(i, k+1)
303            ENDDO            ENDDO
304         ENDDO         ENDDO
305    
306         ! MAF modif pour tenir compte du cas rnpb + traceur         ! MAF modif pour tenir compte du cas traceur
307         DO it=1, nqmax         DO it=1, nqmx - 2
308            if (clsol(it)) then            if (clsol(it)) then
309               ! couche limite avec quantite dans le sol calculee               ! couche limite avec quantite dans le sol calculee
310               CALL cltracrn(it, pdtphys, yu1, yv1, &               CALL cltracrn(it, pdtphys, yu1, yv1, &
311                    coefh, t_seri, ftsol, pctsrf, &                    coefh, t_seri, ftsol, pctsrf, &
312                    tr_seri(1, 1, it), trs(1, it), &                    tr_seri(:, :, it), trs(1, it), &
313                    paprs, pplay, delp, &                    paprs, pplay, delp, &
314                    masktr(1, it), fshtr(1, it), hsoltr(it), &                    masktr(1, it), fshtr(1, it), hsoltr(it), &
315                    tautr(it), vdeptr(it), &                    tautr(it), vdeptr(it), &
# Line 383  contains Line 343  contains
343               ENDDO               ENDDO
344            endif            endif
345         ENDDO         ENDDO
346        endif
347    
348      endif ! couche limite      ! Calcul de l'effet du puits radioactif
   
     !   Calcul de l'effet du puits radioactif  
349    
350      ! MAF il faudrait faire une modification pour passer dans radiornpb      ! MAF il faudrait faire une modification pour passer dans radiornpb
351      ! si radio=true mais pour l'instant radiornpb propre au cas rnpb      ! si radio=true
352      if (rnpb) then      d_tr_dec = radiornpb(tr_seri, pdtphys, tautr)
353         d_tr_dec(:, :, :) = radiornpb(tr_seri, pdtphys, tautr)      DO it = 1, nqmx - 2
354         DO it=1, nqmax         if (radio(it)) then
355            if (radio(it)) then            tr_seri(:, :, it) = tr_seri(:, :, it) + d_tr_dec(:, :, it)
356               tr_seri(:, :, it) = tr_seri(:, :, it) + d_tr_dec(:, :, it)            WRITE(unit=itn, fmt='(i1)') it
357               WRITE(unit=itn, fmt='(i1)') it            CALL minmaxqfi(tr_seri(:, :, it), 0., 1e33, 'puits rn it='//itn)
358               CALL minmaxqfi(tr_seri(:, :, it), 0., 1.e33, 'puits rn it='//itn)         endif
359            endif      ENDDO
        ENDDO  
     endif ! rnpb decroissance  radioactive  
360    
361      if (nqmax >= 3) then      if (nqmx >= 5) then
362         ! Ozone as a tracer:         ! Ozone as a tracer:
363         if (mod(itap - 1, lmt_pas) == 0) then         if (mod(itap - 1, lmt_pas) == 0) then
364            ! Once per day, update the coefficients for ozone chemistry:            ! Once per day, update the coefficients for ozone chemistry:
# Line 413  contains Line 370  contains
370      ! Calcul de l'effet de la precipitation      ! Calcul de l'effet de la precipitation
371    
372      IF (lessivage) THEN      IF (lessivage) THEN
373         d_tr_lessi_nucl(:, :, :) = 0.         d_tr_lessi_nucl = 0.
374         d_tr_lessi_impa(:, :, :) = 0.         d_tr_lessi_impa = 0.
375         flestottr(:, :, :) = 0.         flestottr = 0.
376    
377         ! tendance des aerosols nuclees et impactes         ! tendance des aerosols nuclees et impactes
378    
379         DO it = 1, nqmax         DO it = 1, nqmx - 2
380            IF (aerosol(it)) THEN            IF (aerosol(it)) THEN
381               DO k = 1, llm               DO k = 1, llm
382                  DO i = 1, klon                  DO i = 1, klon
383                     d_tr_lessi_nucl(i, k, it) = d_tr_lessi_nucl(i, k, it) + &                     d_tr_lessi_nucl(i, k, it) = d_tr_lessi_nucl(i, k, it) + &
384                          ( 1 - frac_nucl(i, k) )*tr_seri(i, k, it)                          (1 - frac_nucl(i, k))*tr_seri(i, k, it)
385                     d_tr_lessi_impa(i, k, it) = d_tr_lessi_impa(i, k, it) + &                     d_tr_lessi_impa(i, k, it) = d_tr_lessi_impa(i, k, it) + &
386                          ( 1 - frac_impa(i, k) )*tr_seri(i, k, it)                          (1 - frac_impa(i, k))*tr_seri(i, k, it)
387                  ENDDO                  ENDDO
388               ENDDO               ENDDO
389            ENDIF            ENDIF
# Line 435  contains Line 392  contains
392         ! Mises a jour des traceurs + calcul des flux de lessivage         ! Mises a jour des traceurs + calcul des flux de lessivage
393         ! Mise a jour due a l'impaction et a la nucleation         ! Mise a jour due a l'impaction et a la nucleation
394    
395         DO it = 1, nqmax         DO it = 1, nqmx - 2
396            IF (aerosol(it)) THEN            IF (aerosol(it)) THEN
397               DO k = 1, llm               DO k = 1, llm
398                  DO i = 1, klon                  DO i = 1, klon
399                     tr_seri(i, k, it)=tr_seri(i, k, it) &                     tr_seri(i, k, it) = tr_seri(i, k, it) * frac_impa(i, k) &
400                          *frac_impa(i, k)*frac_nucl(i, k)                          * frac_nucl(i, k)
401                  ENDDO                  ENDDO
402               ENDDO               ENDDO
403            ENDIF            ENDIF
# Line 448  contains Line 405  contains
405    
406         ! Flux lessivage total         ! Flux lessivage total
407    
408         DO it = 1, nqmax         DO it = 1, nqmx - 2
409            DO k = 1, llm            DO k = 1, llm
410               DO i = 1, klon               DO i = 1, klon
411                  flestottr(i, k, it) = flestottr(i, k, it) - &                  flestottr(i, k, it) = flestottr(i, k, it) &
412                       ( d_tr_lessi_nucl(i, k, it)   + &                       - (d_tr_lessi_nucl(i, k, it) + d_tr_lessi_impa(i, k, it)) &
413                       d_tr_lessi_impa(i, k, it) ) * &                       * (paprs(i, k)-paprs(i, k+1)) / (RG * pdtphys)
                      ( paprs(i, k)-paprs(i, k+1) ) /  &  
                      (RG * pdtphys)  
414               ENDDO               ENDDO
415            ENDDO            ENDDO
416         ENDDO         ENDDO
417      ENDIF      ENDIF
418    
419      !   Ecriture des sorties      ! Ecriture des sorties
420      call write_histrac(lessivage, nqmax, itap, nid_tra)      call write_histrac(lessivage, itap, nid_tra)
421    
422      if (lafin) then      if (lafin) then
423         print *, "C'est la fin de la physique."         print *, "C'est la fin de la physique."
424         open (unit=99, file='restarttrac',  form='formatted')         open(unit=99, file='restarttrac', form='formatted')
425         do i=1, klon         do i=1, klon
426            write(unit=99, fmt=*) trs(i, 1)            write(unit=99, fmt=*) trs(i, 1)
427         enddo         enddo
428         PRINT *, 'Ecriture du fichier restarttrac'         PRINT *, 'Ecriture du fichier restarttrac'
429         close(99)         close(unit=99)
430      endif      endif
431    
432    contains    contains
433    
434      subroutine write_histrac(lessivage, nqmax, itap, nid_tra)      subroutine write_histrac(lessivage, itap, nid_tra)
435    
436        ! 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
437    
438        use dimens_m, only: iim, jjm, llm        use dimens_m, only: iim, jjm, llm
439        use ioipsl, only: histwrite, histsync        use histsync_m, only: histsync
440          use histwrite_m, only: histwrite
441        use temps, only: itau_phy        use temps, only: itau_phy
442        use advtrac_m, only: tnom        use iniadvtrac_m, only: tnom
443        use comgeomphy, only: airephy        use comgeomphy, only: airephy
444        use dimphy, only: klon        use dimphy, only: klon
445          use grid_change, only: gr_phy_write_2d
446          use gr_phy_write_3d_m, only: gr_phy_write_3d
447    
448        logical, intent(in):: lessivage        logical, intent(in):: lessivage
449          integer, intent(in):: itap ! number of calls to "physiq"
       integer, intent(in):: nqmax  
       ! (nombre de traceurs auxquels on applique la physique)  
   
       integer, intent(in):: itap  ! number of calls to "physiq"  
450        integer, intent(in):: nid_tra        integer, intent(in):: nid_tra
451    
452        ! Variables local to the procedure:        ! Variables local to the procedure:
       INTEGER ndex2d(iim*(jjm+1)), ndex3d(iim*(jjm+1)*llm)  
453        integer it        integer it
454        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)  
455        logical, parameter:: ok_sync = .true.        logical, parameter:: ok_sync = .true.
456    
457        !-----------------------------------------------------        !-----------------------------------------------------
458    
       ndex2d = 0  
       ndex3d = 0  
459        itau_w = itau_phy + itap        itau_w = itau_phy + itap
460    
461        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))
462        CALL histwrite(nid_tra, "phis", itau_w, zx_tmp_2d)        CALL histwrite(nid_tra, "aire", itau_w, gr_phy_write_2d(airephy))
463          CALL histwrite(nid_tra, "zmasse", itau_w, gr_phy_write_3d(zmasse))
464        CALL gr_fi_ecrit(1, klon, iim, jjm+1, airephy, zx_tmp_2d)        
465        CALL histwrite(nid_tra, "aire", itau_w, zx_tmp_2d)        DO it=1, nqmx - 2
466             CALL histwrite(nid_tra, tnom(it+2), itau_w, &
467        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)  
468           if (lessivage) THEN           if (lessivage) THEN
469              CALL gr_fi_ecrit(llm, klon, iim, jjm+1, flestottr(1, 1, it), &              CALL histwrite(nid_tra, "fl"//tnom(it+2), itau_w, &
470                   zx_tmp_3d)                   gr_phy_write_3d(flestottr(:, :, it)))
             CALL histwrite(nid_tra, "fl"//tnom(it+2), itau_w, zx_tmp_3d)  
471           endif           endif
472             CALL histwrite(nid_tra, "d_tr_th_"//tnom(it+2), itau_w, &
473           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)))
474           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, &
475           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)))
476           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, &
477           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)  
478        ENDDO        ENDDO
479    
480        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))
481        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)  
482    
483        if (ok_sync) then        if (ok_sync) then
484           call histsync(nid_tra)           call histsync(nid_tra)
# Line 548  contains Line 488  contains
488    
489    END SUBROUTINE phytrac    END SUBROUTINE phytrac
490    
   !*************************************************  
   
   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  
   
491  end module phytrac_m  end module phytrac_m

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

  ViewVC Help
Powered by ViewVC 1.1.21