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

Diff of /trunk/dyn3d/infotrac_init.f

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

trunk/libf/dyn3d/iniadvtrac.f90 revision 38 by guez, Thu Jan 6 17:52:19 2011 UTC trunk/dyn3d/infotrac_init.f revision 321 by guez, Tue Dec 11 22:48:09 2018 UTC
# Line 1  Line 1 
1  module iniadvtrac_m  module infotrac_init_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    use dimens_m, only: nqmx    ! iq = 1 pour l'eau vapeur
6      ! iq = 2 pour l'eau liquide
7      ! et \'eventuellement iq = 3, ..., nqmx pour les autres traceurs
8    
9      use dimensions, only: nqmx
10    
11    implicit none    implicit none
12    
13    private nqmx    private nqmx
14    
15    INTEGER iadv(nqmx) ! indice schema de transport    INTEGER, protected:: iadv(nqmx)
16    INTEGER hadv(nqmx) ! indice schema transport horizontal    ! indice du sch\'ema d'advection pour l'eau et les traceurs
   INTEGER vadv(nqmx) ! indice schema transport vertical  
   INTEGER niadv(nqmx) ! equivalent dyn / physique  
   character(len=8) tnom(nqmx) ! nom court du traceur  
   character(len=10) tname(nqmx) ! nom du traceur pour restart  
   character(len=13) ttext(nqmx) ! nom long du traceur pour sorties  
17    
18  contains    character(len = 10), protected:: tname(nqmx)
19      ! nom du traceur pour fichiers restart et historiques
20    
21    subroutine iniadvtrac    character(len = 13), protected:: ttext(nqmx)
22      ! nom long du traceur pour sorties
23    
24      ! From dyn3d/iniadvtrac.F, version 1.3 2005/04/13 08:58:34  contains
25    
26      ! Authors :  P. Le Van, L. Fairhead, F. Hourdin    subroutine infotrac_init
     ! Modification spéciale traceur F. Forget 05/94  
     ! 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  
27    
28      use nr_util, only: assert      ! From dyn3d/iniadvtrac.F, version 1.3 2005/04/13 08:58:34
29    
30      ! Variables local to the procedure:      ! Authors: P. Le Van, L. Fairhead, F. Hourdin, F. Codron,
31        ! F. Forget, M.-A. Filiberti
32    
33      character(len=3) descrq(30)      ! Initialisation des traceurs
34      character:: txts(3) = (/'x', 'y', 'z'/)      ! Choix du sch\'ema pour l'advection dans le fichier "traceur.def"
     character(len=2) txtp(9)  
     character(len=13) str1, str2  
35    
36      integer iq, iiq, iiiq, ierr, ii, nq_local      use nr_util, only: assert
37        use jumble, only: new_unit
38    
39      data txtp/'x', 'y', 'z', 'xx', 'xy', 'xz', 'yy', 'yz', 'zz'/      ! Local:
40        character(len = 3) descrq(0:14)
41        integer iq, iostat, nq_local, unit
42    
43        integer, parameter:: allowed_adv(5) = (/0, 10, 12, 13, 14/)
44        ! Allowed values for iadv:
45        ! 10: schema Van-leer (retenu pour l'eau vapeur et liquide)
46        ! 12: schema Frederic Hourdin I
47        ! 13: schema Frederic Hourdin II
48        ! 14: schema Van-leer + humidite specifique
49    
50      !-----------------------------------------------------------------------      !-----------------------------------------------------------------------
51    
52      print *, "Call sequence information: iniadvtrac"      print *, "Call sequence information: infotrac_init"
53    
54      ! Initializations:      ! Initializations:
55      descrq(14)='VLH'      descrq(0) = ''
56      descrq(10)='VL1'      descrq(10) = 'VL1'
57      descrq(11)='VLP'      descrq(12) = 'FH1'
58      descrq(12)='FH1'      descrq(13) = 'FH2'
59      descrq(13)='FH2'      descrq(14) = 'VLH'
60      descrq(16)='PPM'  
61      descrq(17)='PPS'      ! Choix du sch\'ema pour l'advection dans fichier "traceur.def"
62      descrq(18)='PPP'      call new_unit(unit)
63      descrq(20)='SLP'      open(unit, file = 'traceur.def', status = 'old', action = "read", &
64      descrq(30)='PRA'           position = "rewind", iostat = iostat)
65        if (iostat == 0) then
     !        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  
   
     ! Choix du schema pour l'advection dans fichier "traceur.def"  
   
     open(unit=90, file='traceur.def', form='formatted', status='old', &  
          iostat=ierr)  
     if (ierr == 0) then  
66         print *, 'Ouverture de "traceur.def" ok'         print *, 'Ouverture de "traceur.def" ok'
67         read(unit=90, fmt=*) nq_local         read(unit, fmt = *) nq_local
68         print *, 'nombre de traceurs ', nq_local         print *, 'nombre de traceurs ', nq_local
69         call assert(nq_local == nqmx, "iniadvtrac nq_local")         call assert(nq_local == nqmx, "infotrac_init nq_local")
70    
71         do iq=1, nqmx         do iq = 1, nqmx
72            read(90, 999) hadv(iq), vadv(iq), tnom(iq)            read(unit, fmt = *) iadv(iq), tname(iq)
73         end do            if (.not. any(iadv(iq) == allowed_adv)) then
74         close(90)                 print *, "bad number for advection scheme"
75         PRINT *, 'lecture de traceur.def :'                 stop 1
76         do iq=1, nqmx            end if
           write(*, *) hadv(iq), vadv(iq), tnom(iq)  
77         end do         end do
78           close(unit)
79      else      else
80         print *, 'Problème à l''ouverture de "traceur.def"'         print *, 'Could not open "traceur.def".'
81         print *, 'Attention : on prend des valeurs par défaut.'         print *, 'Using default values.'
82         call assert(nqmx == 4, "iniadvtrac nqmx")         call assert(nqmx == 4, "infotrac_init nqmx")
83         hadv(1) = 14         iadv(:4) = (/14, 10, 10, 10/)
84         vadv(1) = 14         tname(1) = 'H2Ov'
85         tnom(1) = 'H2Ov'         tname(2) = 'H2Ol'
86         hadv(2) = 10         tname(3) = 'RN'
87         vadv(2) = 10         tname(4) = 'PB'
88         tnom(2) = 'H2Ol'         do iq = 1, nqmx
89         hadv(3) = 10            print *, iadv(iq), tname(iq)
90         vadv(3) = 10         end do
        tnom(3) = 'RN'  
        hadv(4) = 10  
        vadv(4) = 10  
        tnom(4) = 'PB'  
91      ENDIF      ENDIF
     PRINT *, 'Valeur de traceur.def :'  
     do iq=1, nqmx  
        write(*, *) hadv(iq), vadv(iq), tnom(iq)  
     end do  
92    
93      ! À partir du nom court du traceur et du schéma d'advection, on      ! \`A partir du nom court du traceur et du sch\'ema d'advection, on
94      ! détemine le nom long :      ! d\'etermine le nom long :
95      iiq=0      do iq = 1, nqmx
96      ii=0         ttext(iq) = trim(tname(iq)) // descrq(iadv(iq))
     do iq=1, nqmx  
        iiq=iiq+1  
        if (hadv(iq) /= vadv(iq)) then  
           if (hadv(iq) == 10.and.vadv(iq) == 16) then  
              iadv(iiq)=11  
           else  
              print *, 'le choix des schemas d''advection H et V'  
              print *, 'est non disponible actuellement'  
              stop  
           endif  
        else  
           iadv(iiq)=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  
        endif  
   
        str1=tnom(iq)  
        tname(iiq)=tnom(iq)  
        IF (iadv(iiq) == 0) THEN  
           ttext(iiq)=trim(str1)  
        ELSE  
           ttext(iiq)=trim(str1)//descrq(iadv(iiq))  
        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  
        endif  
97      end do      end do
98    
99  999 format (i2, 1x, i2, 1x, a8)    END subroutine infotrac_init
   
   END subroutine iniadvtrac  
100    
101  end module iniadvtrac_m  end module infotrac_init_m

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

  ViewVC Help
Powered by ViewVC 1.1.21