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

Diff of /trunk/dyn3d/iniadvtrac.f

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

revision 38 by guez, Thu Jan 6 17:52:19 2011 UTC revision 62 by guez, Thu Jul 26 14:37:37 2012 UTC
# Line 1  Line 1 
1  module iniadvtrac_m  module iniadvtrac_m
2    
3    ! From advtrac.h, v 1.1.1.1 2004/05/19 12:53:06    ! From advtrac.h, version 1.1.1.1 2004/05/19 12:53:06
4    
5      ! iq = 1 pour l'eau vapeur
6      ! iq = 2 pour l'eau liquide
7      ! Et éventuellement iq = 3, nqmx pour les autres traceurs
8    
9    use dimens_m, only: nqmx    use dimens_m, only: nqmx
10    
# Line 8  module iniadvtrac_m Line 12  module iniadvtrac_m
12    
13    private nqmx    private nqmx
14    
15    INTEGER iadv(nqmx) ! indice schema de transport    INTEGER iadv(nqmx) ! indice schéma d'advection pour l'eau et les traceurs
16    INTEGER hadv(nqmx) ! indice schema transport horizontal    ! 11 means schema Van-Leer pour hadv et version PPM (Monotone) pour vadv
17    INTEGER vadv(nqmx) ! indice schema transport vertical  
18    INTEGER niadv(nqmx) ! equivalent dyn / physique    integer, parameter:: allowed_adv(10) = (/0, 1, 2, 10, 12, 13, 14, 16, 17, 18/)
19      ! Allowed values for hadv and vadv:
20      ! 1: schema transport type "humidite specifique LMD"
21      ! 2: schema amont
22      ! 10: schema Van-leer (retenu pour l'eau vapeur et liquide)
23      ! 12: schema Frederic Hourdin I
24      ! 13: schema Frederic Hourdin II
25      ! 14: schema Van-leer + humidite specifique
26      ! 16: schema PPM Monotone(Collela & Woodward 1984)
27      ! 17: schema PPM Semi Monotone (overshoots autorisés)
28      ! 18: schema PPM Positif Defini (overshoots undershoots autorisés)
29      ! Pour Van-Leer plus vapeur d'eau saturée : iadv(1)=4
30    
31      INTEGER hadv(nqmx) ! indice schéma transport horizontal
32      INTEGER vadv(nqmx) ! indice schéma transport vertical
33      INTEGER niadv(nqmx) ! équivalent dynamique / physique
34    character(len=8) tnom(nqmx) ! nom court du traceur    character(len=8) tnom(nqmx) ! nom court du traceur
35    character(len=10) tname(nqmx) ! nom du traceur pour restart    character(len=10) tname(nqmx) ! nom du traceur pour restart
36    character(len=13) ttext(nqmx) ! nom long du traceur pour sorties    character(len=13) ttext(nqmx) ! nom long du traceur pour sorties
# Line 22  contains Line 41  contains
41    
42      ! From dyn3d/iniadvtrac.F, version 1.3 2005/04/13 08:58:34      ! From dyn3d/iniadvtrac.F, version 1.3 2005/04/13 08:58:34
43    
44      ! Authors :  P. Le Van, L. Fairhead, F. Hourdin      ! Authors : P. Le Van, L. Fairhead, F. Hourdin, F. Codron,
45      ! Modification spéciale traceur F. Forget 05/94      ! F. Forget, M.-A. Filiberti
     ! Modification M.-A. Filiberti 02/02 lecture de "traceur.def"  
     ! Modification de l'intégration de "q" (26/04/94)  
     ! Pour Van-Leer plus vapeur d'eau saturée : iadv(1)=4  
     ! Pour Van-Leer : iadv=10  
46    
47      use nr_util, only: assert      use nr_util, only: assert
48        use jumble, only: new_unit
49    
50      ! Variables local to the procedure:      ! Variables local to the procedure:
51    
52      character(len=3) descrq(30)      character(len=3) descrq(18)
     character:: txts(3) = (/'x', 'y', 'z'/)  
     character(len=2) txtp(9)  
     character(len=13) str1, str2  
53    
54      integer iq, iiq, iiiq, ierr, ii, nq_local      integer iq, iostat, nq_local, unit
   
     data txtp/'x', 'y', 'z', 'xx', 'xy', 'xz', 'yy', 'yz', 'zz'/  
55    
56      !-----------------------------------------------------------------------      !-----------------------------------------------------------------------
57    
58      print *, "Call sequence information: iniadvtrac"      print *, "Call sequence information: iniadvtrac"
59    
60      ! Initializations:      ! Initializations:
     descrq(14)='VLH'  
61      descrq(10)='VL1'      descrq(10)='VL1'
62      descrq(11)='VLP'      descrq(11)='VLP'
63      descrq(12)='FH1'      descrq(12)='FH1'
64      descrq(13)='FH2'      descrq(13)='FH2'
65        descrq(14)='VLH'
66      descrq(16)='PPM'      descrq(16)='PPM'
67      descrq(17)='PPS'      descrq(17)='PPS'
68      descrq(18)='PPP'      descrq(18)='PPP'
     descrq(20)='SLP'  
     descrq(30)='PRA'  
   
     !        Choix  des schemas d'advection pour l'eau et les traceurs  
   
     ! iadv = 1    schema  transport type "humidite specifique LMD"  
     ! iadv = 2    schema   amont  
     ! iadv = 14    schema  Van-leer + humidite specifique  
     !                        Modif F.Codron  
     ! iadv = 10   schema  Van-leer (retenu pour l'eau vapeur et liquide)  
     ! iadv = 11 schema Van-Leer pour hadv et version PPM (Monotone)  
     !           pour vadv  
     ! iadv = 12   schema  Frederic Hourdin I  
     ! iadv = 13   schema  Frederic Hourdin II  
     ! iadv = 16   schema  PPM Monotone(Collela & Woodward 1984)  
     ! iadv = 17   schema  PPM Semi Monotone (overshoots autorisés)  
     ! iadv = 18   schema  PPM Positif Defini (overshoots undershoots autorisés)  
     ! iadv = 20   schema  Slopes  
     ! iadv = 30   schema  Prather  
   
     !    Dans le tableau q(ij, l, iq) : iq = 1  pour l'eau vapeur  
     !                                 iq = 2  pour l'eau liquide  
     !    Et éventuellement            iq = 3, nqmx pour les autres traceurs  
   
     !    iadv(1): choix pour l'eau vap. et  iadv(2) : choix pour l'eau liq.  
   
     ! Choix du schema d'advection  
     ! choix par defaut = van leer pour tous les traceurs  
     do iq=1, nqmx  
        iadv(iq)=10  
        str1(1:1)='q'  
        if (nqmx.le.99) then  
           WRITE(str1(2:3), '(i2.2)') iq  
        else  
           WRITE(str1(2:4), '(i3.3)') iq  
        endif  
        tnom(iq)=str1  
        tname(iq)=tnom(iq)  
        str2=tnom(iq)  
        ttext(iq) = trim(str2) // descrq(iadv(iq))  
     end do  
69    
70      ! Choix du schema pour l'advection dans fichier "traceur.def"      ! Choix du schéma pour l'advection dans fichier "traceur.def"
71        call new_unit(unit)
72      open(unit=90, file='traceur.def', form='formatted', status='old', &      open(unit, file='traceur.def', status='old', action="read", &
73           iostat=ierr)           position="rewind", iostat=iostat)
74      if (ierr == 0) then      if (iostat == 0) then
75         print *, 'Ouverture de "traceur.def" ok'         print *, 'Ouverture de "traceur.def" ok'
76         read(unit=90, fmt=*) nq_local         read(unit, fmt=*) nq_local
77         print *, 'nombre de traceurs ', nq_local         print *, 'nombre de traceurs ', nq_local
78         call assert(nq_local == nqmx, "iniadvtrac nq_local")         call assert(nq_local == nqmx, "iniadvtrac nq_local")
79    
80         do iq=1, nqmx         do iq=1, nqmx
81            read(90, 999) hadv(iq), vadv(iq), tnom(iq)            read(unit, fmt=*) hadv(iq), vadv(iq), tnom(iq)
82         end do            if (.not. any(hadv(iq) == allowed_adv) &
83         close(90)                   .or. .not. any(vadv(iq) == allowed_adv)) then
84         PRINT *, 'lecture de traceur.def :'                 print *, "bad number for advection scheme"
85         do iq=1, nqmx               stop 1
86            write(*, *) hadv(iq), vadv(iq), tnom(iq)            end if
87         end do         end do
88           close(unit)
89      else      else
90         print *, 'Problème à l''ouverture de "traceur.def"'         print *, 'Problème à l''ouverture de "traceur.def"'
91         print *, 'Attention : on prend des valeurs par défaut.'         print *, 'Attention : on prend des valeurs par défaut.'
# Line 131  contains Line 102  contains
102         hadv(4) = 10         hadv(4) = 10
103         vadv(4) = 10         vadv(4) = 10
104         tnom(4) = 'PB'         tnom(4) = 'PB'
105           do iq = 1, nqmx
106              print *, hadv(iq), vadv(iq), tnom(iq)
107           end do
108      ENDIF      ENDIF
109      PRINT *, 'Valeur de traceur.def :'  
110      do iq=1, nqmx      tname = tnom
        write(*, *) hadv(iq), vadv(iq), tnom(iq)  
     end do  
111    
112      ! À partir du nom court du traceur et du schéma d'advection, on      ! À partir du nom court du traceur et du schéma d'advection, on
113      ! détemine le nom long :      ! détermine le nom long :
     iiq=0  
     ii=0  
114      do iq=1, nqmx      do iq=1, nqmx
        iiq=iiq+1  
115         if (hadv(iq) /= vadv(iq)) then         if (hadv(iq) /= vadv(iq)) then
116            if (hadv(iq) == 10.and.vadv(iq) == 16) then            if (hadv(iq) == 10 .and. vadv(iq) == 16) then
117               iadv(iiq)=11               iadv(iq)=11
118            else            else
119               print *, 'le choix des schemas d''advection H et V'               print *, "Bad combination for hozizontal and vertical schemes."
120               print *, 'est non disponible actuellement'               stop 1
              stop  
121            endif            endif
122         else         else
123            iadv(iiq)=hadv(iq)            iadv(iq)=hadv(iq)
        endif  
        ! verification nombre de traceurs  
        if (iadv(iiq).lt.20) then  
           ii=ii+1  
        elseif (iadv(iiq) == 20) then  
           ii=ii+4  
        elseif (iadv(iiq) == 30) then  
           ii=ii+10  
124         endif         endif
125    
126         str1=tnom(iq)         IF (iadv(iq) == 0) THEN
127         tname(iiq)=tnom(iq)            ttext(iq) = tnom(iq)
        IF (iadv(iiq) == 0) THEN  
           ttext(iiq)=trim(str1)  
128         ELSE         ELSE
129            ttext(iiq)=trim(str1)//descrq(iadv(iiq))            ttext(iq)=trim(tnom(iq)) // descrq(iadv(iq))
        endif  
        str2=ttext(iiq)  
        !   schemas tenant compte des moments d'ordre superieur.  
        if (iadv(iiq) == 20) then  
           do iiiq=1, 3  
              iiq=iiq+1  
              iadv(iiq)=-20  
              ttext(iiq)=trim(str2)//txts(iiiq)  
              tname(iiq)=trim(str1)//txts(iiiq)  
           enddo  
        elseif (iadv(iiq) == 30) then  
           do iiiq=1, 9  
              iiq=iiq+1  
              iadv(iiq)=-30  
              ttext(iiq)=trim(str2)//txtp(iiiq)  
              tname(iiq)=trim(str1)//txtp(iiiq)  
           enddo  
        endif  
     end do  
     if (ii /= nqmx) then  
        print *, 'WARNING'  
        print *, 'le nombre de traceurs et de moments eventuels'  
        print *, 'est inferieur a nqmx '  
     endif  
     if (iiq > nqmx) then  
        print *, 'le choix des schemas est incompatible avec '  
        print *, 'la dimension nqmx (nombre de traceurs)'  
        print *, 'verifier traceur.def ou la namelist INCA'  
        print *, 'ou recompiler avec plus de traceurs'  
        stop  
     endif  
     iiq=0  
     do iq=1, nqmx  
        if (iadv(iq).ge.0) then  
           iiq=iiq+1  
           niadv(iiq)=iq  
130         endif         endif
131      end do      end do
132    
133  999 format (i2, 1x, i2, 1x, a8)      forall (iq = 1: nqmx) niadv(iq)=iq
134    
135    END subroutine iniadvtrac    END subroutine iniadvtrac
136    

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

  ViewVC Help
Powered by ViewVC 1.1.21