/[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

revision 17 by guez, Tue Aug 5 13:31:32 2008 UTC revision 30 by guez, Thu Apr 1 09:07:28 2010 UTC
# Line 10  module phytrac_m Line 10  module phytrac_m
10  contains  contains
11    
12    SUBROUTINE phytrac(rnpb, itap, lmt_pas, julien, gmtime, firstcal, lafin, &    SUBROUTINE phytrac(rnpb, itap, lmt_pas, julien, gmtime, firstcal, lafin, &
13         nqmax, pdtphys, u, v, t_seri, paprs, pplay, pmfu, pmfd, pen_u, &         nq_phys, pdtphys, u, v, t_seri, paprs, pplay, pmfu, pmfd, pen_u, &
14         pde_u, pen_d, pde_d, coefh, fm_therm, entr_therm, yu1, yv1, ftsol, &         pde_u, pen_d, pde_d, coefh, fm_therm, entr_therm, yu1, yv1, ftsol, &
15         pctsrf, frac_impa, frac_nucl, presnivs, pphis, &         pctsrf, frac_impa, frac_nucl, pphis, pphi, albsol, rh, cldfra, rneb, &
16         pphi, albsol, rh, cldfra, rneb, diafra, cldliq, itop_con, &         diafra, cldliq, itop_con, ibas_con, pmflxr, pmflxs, prfl, psfl, da, &
17         ibas_con, pmflxr, pmflxs, prfl, psfl, da, phi, mp, upwd, dnwd, &         phi, mp, upwd, dnwd, tr_seri, zmasse)
        tr_seri, zmasse)  
18    
19      ! 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
20    
21      ! Authors : Frédéric Hourdin, Abderrahmane Idelkadi, Marie-Alice      ! Authors: Frédéric Hourdin, Abderrahmane Idelkadi, Marie-Alice
22      ! Foujols, Olivia      ! Foujols, Olivia
23      ! Objet : moniteur général des tendances des traceurs      ! Objet : moniteur général des tendances des traceurs
24    
# Line 56  contains Line 55  contains
55    
56      logical, intent(in):: rnpb      logical, intent(in):: rnpb
57    
58      integer, intent(in):: nqmax      integer, intent(in):: nq_phys
59      ! (nombre de traceurs auxquels on applique la physique)      ! (nombre de traceurs auxquels on applique la physique)
60    
61      integer, intent(in):: itap  ! number of calls to "physiq"      integer, intent(in):: itap  ! number of calls to "physiq"
# Line 68  contains Line 67  contains
67      real, intent(in):: pdtphys  ! pas d'integration pour la physique (s)      real, intent(in):: pdtphys  ! pas d'integration pour la physique (s)
68      real, intent(in):: t_seri(klon, llm) ! temperature, in K      real, intent(in):: t_seri(klon, llm) ! temperature, in K
69    
70      real, intent(inout):: tr_seri(klon, llm, nbtr)      real, intent(inout):: tr_seri(:, :, :) ! (klon, llm, nbtr)
71      ! (mass fractions of tracers, excluding water, at mid-layers)      ! (mass fractions of tracers, excluding water, at mid-layers)
72    
73      real u(klon, llm)      real u(klon, llm)
# Line 91  contains Line 90  contains
90    
91      real pphi(klon, llm) ! geopotentiel      real pphi(klon, llm) ! geopotentiel
92      real pphis(klon)      real pphis(klon)
     REAL, intent(in):: presnivs(llm)  
93      logical, intent(in):: firstcal ! first call to "calfis"      logical, intent(in):: firstcal ! first call to "calfis"
94      logical, intent(in):: lafin ! fin de la physique      logical, intent(in):: lafin ! fin de la physique
95    
# Line 211  contains Line 209  contains
209    
210      !--------------------------------------      !--------------------------------------
211    
212      call assert(shape(zmasse) == (/klon, llm/), "phytrac")      call assert(shape(zmasse) == (/klon, llm/), "phytrac zmasse")
213        call assert(shape(tr_seri) == (/klon, llm, nbtr/), "phytrac tr_seri")
214    
215      if (firstcal) then      if (firstcal) then
216         print *, 'phytrac: pdtphys = ', pdtphys         print *, 'phytrac: pdtphys = ', pdtphys
217         PRINT *, 'Fréquence de sortie des traceurs : ecrit_tra = ', ecrit_tra         PRINT *, 'Fréquence de sortie des traceurs : ecrit_tra = ', ecrit_tra
218         if (nbtr < nqmax) call abort_gcm('phytrac', 'See above', 1)         if (nbtr < nq_phys) call abort_gcm('phytrac', 'nbtr < nq_phys', 1)
219         inirnpb=rnpb         inirnpb=rnpb
220    
221         ! Initialisation des sorties :         ! Initialisation des sorties :
222         call ini_histrac(nid_tra, pdtphys, presnivs, nqmax, lessivage)         call ini_histrac(nid_tra, pdtphys, nq_phys, lessivage)
223    
224         ! Initialisation de certaines variables pour le radon et le plomb         ! Initialisation de certaines variables pour le radon et le plomb
225         ! Initialisation du traceur dans le sol (couche limite radonique)         ! Initialisation du traceur dans le sol (couche limite radonique)
# Line 239  contains Line 238  contains
238    
239         ! Initialisation de la nature des traceurs         ! Initialisation de la nature des traceurs
240    
241         DO it = 1, nqmax         DO it = 1, nq_phys
242            aerosol(it) = .FALSE.  ! Tous les traceurs sont des gaz par defaut            aerosol(it) = .FALSE.  ! Tous les traceurs sont des gaz par defaut
243            radio(it) = .FALSE. ! par défaut pas de passage par "radiornpb"            radio(it) = .FALSE. ! par défaut pas de passage par "radiornpb"
244            clsol(it) = .FALSE.  ! Par defaut couche limite avec flux prescrit            clsol(it) = .FALSE.  ! Par defaut couche limite avec flux prescrit
245         ENDDO         ENDDO
246    
247         if (nqmax >= 3) then         if (nq_phys >= 3) then
248            call press_coefoz ! read input pressure levels for ozone coefficients            call press_coefoz ! read input pressure levels for ozone coefficients
249         end if         end if
250      ENDIF      ENDIF
# Line 267  contains Line 266  contains
266      ! Calcul de l'effet de la convection      ! Calcul de l'effet de la convection
267    
268      if (convection) then      if (convection) then
269         DO it=1, nqmax         DO it=1, nq_phys
270            if (iflag_con.eq.2) then            if (iflag_con.eq.2) then
271               ! tiedke               ! tiedke
272               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, &
# Line 291  contains Line 290  contains
290    
291      ! Calcul de l'effet des thermiques      ! Calcul de l'effet des thermiques
292    
293      do it=1, nqmax      do it=1, nq_phys
294         do k=1, llm         do k=1, llm
295            do i=1, klon            do i=1, klon
296               d_tr_th(i, k, it)=0.               d_tr_th(i, k, it)=0.
# Line 303  contains Line 302  contains
302    
303      if (iflag_thermals > 0) then      if (iflag_thermals > 0) then
304         nsplit=10         nsplit=10
305         DO it=1, nqmax         DO it=1, nq_phys
306            do isplit=1, nsplit            do isplit=1, nsplit
307               ! Thermiques               ! Thermiques
308               call dqthermcell(klon, llm, pdtphys/nsplit &               call dqthermcell(klon, llm, pdtphys/nsplit &
# Line 332  contains Line 331  contains
331         ENDDO         ENDDO
332    
333         ! MAF modif pour tenir compte du cas rnpb + traceur         ! MAF modif pour tenir compte du cas rnpb + traceur
334         DO it=1, nqmax         DO it=1, nq_phys
335            if (clsol(it)) then            if (clsol(it)) then
336               ! couche limite avec quantite dans le sol calculee               ! couche limite avec quantite dans le sol calculee
337               CALL cltracrn(it, pdtphys, yu1, yv1, &               CALL cltracrn(it, pdtphys, yu1, yv1, &
# Line 380  contains Line 379  contains
379      ! si radio=true mais pour l'instant radiornpb propre au cas rnpb      ! si radio=true mais pour l'instant radiornpb propre au cas rnpb
380      if (rnpb) then      if (rnpb) then
381         d_tr_dec(:, :, :) = radiornpb(tr_seri, pdtphys, tautr)         d_tr_dec(:, :, :) = radiornpb(tr_seri, pdtphys, tautr)
382         DO it=1, nqmax         DO it=1, nq_phys
383            if (radio(it)) then            if (radio(it)) then
384               tr_seri(:, :, it) = tr_seri(:, :, it) + d_tr_dec(:, :, it)               tr_seri(:, :, it) = tr_seri(:, :, it) + d_tr_dec(:, :, it)
385               WRITE(unit=itn, fmt='(i1)') it               WRITE(unit=itn, fmt='(i1)') it
# Line 389  contains Line 388  contains
388         ENDDO         ENDDO
389      endif ! rnpb decroissance  radioactive      endif ! rnpb decroissance  radioactive
390    
391      if (nqmax >= 3) then      if (nq_phys >= 3) then
392         ! Ozone as a tracer:         ! Ozone as a tracer:
393         if (mod(itap - 1, lmt_pas) == 0) then         if (mod(itap - 1, lmt_pas) == 0) then
394            ! Once per day, update the coefficients for ozone chemistry:            ! Once per day, update the coefficients for ozone chemistry:
# Line 407  contains Line 406  contains
406    
407         ! tendance des aerosols nuclees et impactes         ! tendance des aerosols nuclees et impactes
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 423  contains Line 422  contains
422         ! Mises a jour des traceurs + calcul des flux de lessivage         ! Mises a jour des traceurs + calcul des flux de lessivage
423         ! Mise a jour due a l'impaction et a la nucleation         ! Mise a jour due a l'impaction et a la nucleation
424    
425         DO it = 1, nqmax         DO it = 1, nq_phys
426            IF (aerosol(it)) THEN            IF (aerosol(it)) THEN
427               DO k = 1, llm               DO k = 1, llm
428                  DO i = 1, klon                  DO i = 1, klon
# Line 436  contains Line 435  contains
435    
436         ! Flux lessivage total         ! Flux lessivage total
437    
438         DO it = 1, nqmax         DO it = 1, nq_phys
439            DO k = 1, llm            DO k = 1, llm
440               DO i = 1, klon               DO i = 1, klon
441                  flestottr(i, k, it) = flestottr(i, k, it) - &                  flestottr(i, k, it) = flestottr(i, k, it) - &
# Line 450  contains Line 449  contains
449      ENDIF      ENDIF
450    
451      !   Ecriture des sorties      !   Ecriture des sorties
452      call write_histrac(lessivage, nqmax, itap, nid_tra)      call write_histrac(lessivage, nq_phys, itap, nid_tra)
453    
454      if (lafin) then      if (lafin) then
455         print *, "C'est la fin de la physique."         print *, "C'est la fin de la physique."
# Line 464  contains Line 463  contains
463    
464    contains    contains
465    
466      subroutine write_histrac(lessivage, nqmax, itap, nid_tra)      subroutine write_histrac(lessivage, nq_phys, itap, nid_tra)
467    
468        ! 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
469    
470        use dimens_m, only: iim, jjm, llm        use dimens_m, only: iim, jjm, llm
471        use ioipsl, only: histwrite, histsync        use histcom, only: histsync
472          use histwrite_m, only: histwrite
473        use temps, only: itau_phy        use temps, only: itau_phy
474        use advtrac_m, only: tnom        use iniadvtrac_m, only: tnom
475        use comgeomphy, only: airephy        use comgeomphy, only: airephy
476        use dimphy, only: klon        use dimphy, only: klon
477          use grid_change, only: gr_phy_write_2d, gr_phy_write_3d
478    
479        logical, intent(in):: lessivage        logical, intent(in):: lessivage
480    
481        integer, intent(in):: nqmax        integer, intent(in):: nq_phys
482        ! (nombre de traceurs auxquels on applique la physique)        ! (nombre de traceurs auxquels on applique la physique)
483    
484        integer, intent(in):: itap  ! number of calls to "physiq"        integer, intent(in):: itap  ! number of calls to "physiq"
# Line 486  contains Line 487  contains
487        ! Variables local to the procedure:        ! Variables local to the procedure:
488        integer it        integer it
489        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)  
490        logical, parameter:: ok_sync = .true.        logical, parameter:: ok_sync = .true.
491    
492        !-----------------------------------------------------        !-----------------------------------------------------
493    
494        itau_w = itau_phy + itap        itau_w = itau_phy + itap
495    
496        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))
497        CALL histwrite(nid_tra, "phis", itau_w, zx_tmp_2d)        CALL histwrite(nid_tra, "aire", itau_w, gr_phy_write_2d(airephy))
498          CALL histwrite(nid_tra, "zmasse", itau_w, gr_phy_write_3d(zmasse))
499        CALL gr_fi_ecrit(1, klon, iim, jjm+1, airephy, zx_tmp_2d)        
500        CALL histwrite(nid_tra, "aire", itau_w, zx_tmp_2d)        DO it=1, nq_phys
501             CALL histwrite(nid_tra, tnom(it+2), itau_w, &
502        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)  
503           if (lessivage) THEN           if (lessivage) THEN
504              CALL gr_fi_ecrit(llm, klon, iim, jjm+1, flestottr(1, 1, it), &              CALL histwrite(nid_tra, "fl"//tnom(it+2), itau_w, &
505                   zx_tmp_3d)                   gr_phy_write_3d(flestottr(:, :, it)))
             CALL histwrite(nid_tra, "fl"//tnom(it+2), itau_w, zx_tmp_3d)  
506           endif           endif
507             CALL histwrite(nid_tra, "d_tr_th_"//tnom(it+2), itau_w, &
508           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)))
509           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, &
510           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)))
511           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, &
512           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)  
513        ENDDO        ENDDO
514    
515        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))
516        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)  
517    
518        if (ok_sync) then        if (ok_sync) then
519           call histsync(nid_tra)           call histsync(nid_tra)

Legend:
Removed from v.17  
changed lines
  Added in v.30

  ViewVC Help
Powered by ViewVC 1.1.21