Ignore:
Timestamp:
Apr 3, 2014, 9:09:47 AM (11 years ago)
Author:
emillour
Message:

Generic model:
Major cleanup, in order to ease the use of LMDZ.GENERIC with (parallel) dynamics
in LMDZ.COMMON: (NB: this will break LMDZ.UNIVERSAL, which should be thrashed
in the near future)

  • Updated makegcm_* scripts (and makdim) and added the "-full" (to enforce full recomputation of the model) option
  • In dyn3d: converted control.h to module control_mod.F90 and converted iniadvtrac.F to module infotrac.F90
  • Added module mod_const_mpi.F90 in dyn3d (not used in serial mode)
  • Rearanged input/outputs routines everywhere to handle serial/MPI cases. physdem.F => phyredem.F90 , phyetat0.F => phyetat0.F90 ; all read/write routines for startfi files are gathered in module iostart.F90
  • added parallelism related routines init_phys_lmdz.F90, comgeomphy.F90, dimphy.F90, iniphysiq.F90, mod_grid_phy_lmdz.F90, mod_phys_lmdz_mpi_data.F90, mod_phys_lmdz_mpi_transfert.F90, mod_phys_lmdz_omp_data.F90, mod_phys_lmdz_omp_transfert.F90, mod_phys_lmdz_para.F90, mod_phys_lmdz_transfert_para.F90 in phymars and mod_const_mpi.F90 in dyn3d (for compliance with parallelism)
  • added created generic routines 'planetwide_maxval' and 'planetwide_minval', in module "planetwide_mod", that enable obtaining the max and min of a field over the whole planet. This should be further imroved with computation of means (possibly area weighed), etc.

EM

Location:
trunk/LMDZ.GENERIC/libf/dyn3d
Files:
1 added
9 edited
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.GENERIC/libf/dyn3d/calfis.F

    r787 r1216  
    66c    Auteur :  P. Le Van, F. Hourdin
    77c   .........
    8 
     8      USE infotrac, ONLY: tname, nqtot
    99      IMPLICIT NONE
    1010c=======================================================================
     
    7171#include "comvert.h"
    7272#include "comgeom2.h"
    73 #include "control.h"
    74 
    75 #include "advtrac.h"
     73!#include "control.h"
     74
     75!#include "advtrac.h"
    7676!! this is to get tnom (tracers name)
    7777
     
    8585      REAL pteta(iip1,jjp1,llm)
    8686      REAL pmasse(iip1,jjp1,llm)
    87       REAL pq(iip1,jjp1,llm,nqmx)
     87      REAL pq(iip1,jjp1,llm,nqtot)
    8888      REAL pphis(iip1,jjp1)
    8989      REAL pphi(iip1,jjp1,llm)
     
    9292      REAL pducov(iip1,jjp1,llm)
    9393      REAL pdteta(iip1,jjp1,llm)
    94       REAL pdq(iip1,jjp1,llm,nqmx)
     94      REAL pdq(iip1,jjp1,llm,nqtot)
    9595c
    9696      REAL pw(iip1,jjp1,llm)
     
    103103      REAL pdufi(iip1,jjp1,llm)
    104104      REAL pdhfi(iip1,jjp1,llm)
    105       REAL pdqfi(iip1,jjp1,llm,nqmx)
     105      REAL pdqfi(iip1,jjp1,llm,nqtot)
    106106      REAL pdpsfi(iip1,jjp1)
    107107      logical tracer
     
    116116c
    117117      REAL zufi(ngridmx,llm), zvfi(ngridmx,llm)
    118       REAL ztfi(ngridmx,llm),zqfi(ngridmx,llm,nqmx)
     118      REAL ztfi(ngridmx,llm),zqfi(ngridmx,llm,nqtot)
    119119c
    120120      REAL zvervel(ngridmx,llm)
    121121c
    122122      REAL zdufi(ngridmx,llm),zdvfi(ngridmx,llm)
    123       REAL zdtfi(ngridmx,llm),zdqfi(ngridmx,llm,nqmx)
     123      REAL zdtfi(ngridmx,llm),zdqfi(ngridmx,llm,nqtot)
    124124      REAL zdpsrf(ngridmx)
    125125c
     
    170170
    171171c
    172       IF (firstcal) THEN
    173          latfi(1)=rlatu(1)
    174          lonfi(1)=0.
    175          DO j=2,jjm
    176             DO i=1,iim
    177                latfi((j-2)*iim+1+i)= rlatu(j)
    178                lonfi((j-2)*iim+1+i)= rlonv(i)
    179             ENDDO
    180          ENDDO
    181          latfi(ngridmx)= rlatu(jjp1)
    182          lonfi(ngridmx)= 0.
    183 
    184          ! build airefi(), mesh area on physics grid
    185          CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,aire,airefi)
    186          ! Poles are single points on physics grid
    187          airefi(1)=airefi(1)*iim
    188          airefi(ngridmx)=airefi(ngridmx)*iim
    189 
    190          CALL inifis(ngridmx,llm,day_ini,daysec,dtphys,
    191      .                latfi,lonfi,airefi,rad,g,r,cpp)
    192       ENDIF
     172!      IF (firstcal) THEN
     173!         latfi(1)=rlatu(1)
     174!         lonfi(1)=0.
     175!         DO j=2,jjm
     176!            DO i=1,iim
     177!               latfi((j-2)*iim+1+i)= rlatu(j)
     178!               lonfi((j-2)*iim+1+i)= rlonv(i)
     179!            ENDDO
     180!         ENDDO
     181!         latfi(ngridmx)= rlatu(jjp1)
     182!         lonfi(ngridmx)= 0.
     183!
     184!         ! build airefi(), mesh area on physics grid
     185!         CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,aire,airefi)
     186!         ! Poles are single points on physics grid
     187!         airefi(1)=airefi(1)*iim
     188!         airefi(ngridmx)=airefi(ngridmx)*iim
     189!
     190!         CALL inifis(ngridmx,llm,day_ini,daysec,dtphys,
     191!     .                latfi,lonfi,airefi,rad,g,r,cpp)
     192!      ENDIF
    193193
    194194c
     
    278278c   43.bis Taceurs (en kg/kg)
    279279c   --------------------------
    280       DO iq=1,nqmx
     280      DO iq=1,nqtot
    281281         DO l=1,llm
    282282            zqfi(1,l,iq) = pq(1,1,l,iq)
     
    425425
    426426      CALL physiq (ngridmx,llm,nq,
    427      .     tnom,
     427     .     tname,
    428428     ,     debut,lafin,
    429429     ,     rday_ecri,heure,dtphys,
     
    467467
    468468
    469 c   62. humidite specifique
     469c   62. traceurs
    470470c   ---------------------
    471471
    472       DO iq=1,nqmx
     472      DO iq=1,nqtot
    473473         DO l=1,llm
    474474            DO i=1,iip1
  • trunk/LMDZ.GENERIC/libf/dyn3d/control_mod.F90

    r1214 r1216  
    1 !-----------------------------------------------------------------------
    2 ! INCLUDE 'control.h'
    3 ! For Fortran 77/Fortran 90 compliance always use line continuation
    4 ! symbols '&' in columns 73 and 6
    5 !
    61
    7       COMMON/control/nday,day_step,                                     &
    8      &              iperiod,iconser,idissip,iphysiq ,                   &
    9      &              periodav,ecritphy,anneeref
     2module control_mod
    103
    11       INTEGER   nday,day_step,iperiod,iconser,                          &
    12      &          idissip,iphysiq,anneeref
    13       REAL periodav, ecritphy
     4  implicit none
    145
    15 !-----------------------------------------------------------------------
     6  integer,save :: nday ! # of days to run
     7  integer,save :: day_step ! # of dynamical time steps per day
     8  integer,save :: iperiod  ! make a Matsuno step before avery iperiod-1 LF steps
     9  integer,save :: iconser !
     10  integer,save :: idissip ! apply dissipation every idissip dynamical step
     11  integer,save :: iphysiq ! call physics every iphysiq dynamical steps
     12  integer,save :: anneeref ! reference year # ! not used
     13  real,save :: periodav
     14  integer,save :: ecritphy ! output data in "diagfi.nc" every ecritphy dynamical steps
     15
     16end module control_mod
  • trunk/LMDZ.GENERIC/libf/dyn3d/defrun_new.F

    r1006 r1216  
    3838      USE ioipsl_getincom
    3939      use sponge_mod,only: callsponge,nsponge,mode_sponge,tetasponge
     40      use control_mod,only: nday, day_step, iperiod, anneeref,
     41     &                      iconser, idissip, iphysiq, ecritphy
    4042      IMPLICIT NONE
    4143
    4244#include "dimensions.h"
    4345#include "paramet.h"
    44 #include "control.h"
     46!#include "control.h"
    4547#include "logic.h"
    4648#include "serre.h"
  • trunk/LMDZ.GENERIC/libf/dyn3d/dynetat0.F

    r993 r1216  
    11      SUBROUTINE dynetat0(fichnom,nq,vcov,ucov,
    22     .                    teta,q,masse,ps,phis,time)
     3      use infotrac, only: tname, nqtot
    34      IMPLICIT NONE
    45
     
    3031#include "serre.h"
    3132#include "logic.h"
    32 #include"advtrac.h"
     33!#include"advtrac.h"
    3334
    3435c   Arguments:
     
    328329!           WRITE(str3(2:3),'(i2.2)') iq
    329330!           ierr =  NF_INQ_VARID (nid, str3, nvarid)
    330 ! NB: tracers are now read in using their name ('tnom' from advtrac.h)
    331 !           write(*,*) "  loading tracer:",trim(tnom(iq))
    332            ierr=NF_INQ_VARID(nid,tnom(iq),nvarid)
     331! NB: tracers are now read in using their name ('tname' from infotrac)
     332!           write(*,*) "  loading tracer:",trim(tname(iq))
     333           ierr=NF_INQ_VARID(nid,tname(iq),nvarid)
    333334           IF (ierr .NE. NF_NOERR) THEN
    334335!              PRINT*, "dynetat0: Le champ <"//str3//"> est absent"
    335               PRINT*, "dynetat0: Le champ <"//trim(tnom(iq))//
     336              PRINT*, "dynetat0: Le champ <"//trim(tname(iq))//
    336337     &                "> est absent"
    337338              PRINT*, "          Il est donc initialise a zero"
     
    346347             IF (ierr .NE. NF_NOERR) THEN
    347348!                 PRINT*, "dynetat0: Lecture echouee pour "//str3
    348                PRINT*, "dynetat0: Lecture echouee pour "//trim(tnom(iq))
     349               PRINT*,"dynetat0: Lecture echouee pour "//trim(tname(iq))
    349350               CALL abort
    350351             ENDIF
     
    354355c        case when new tracer are added in addition to old ones
    355356             write(*,*)'tracers 1 to ', nqold,'were already present'
    356              write(*,*)'tracers ', nqold+1,' to ', nqmx,'are new'
     357             write(*,*)'tracers ', nqold+1,' to ', nqtot,'are new'
    357358             write(*,*)' and initialized to zero'
    358              q(:,:,:,nqold+1:nqmx)=0.0
     359             q(:,:,:,nqold+1:nqtot)=0.0
    359360!             yes=' '
    360361!            do while ((yes.ne.'y').and.(yes.ne.'n'))
  • trunk/LMDZ.GENERIC/libf/dyn3d/dynredem.F

    r993 r1216  
    11      SUBROUTINE dynredem0(fichnom,idayref,anneeref,phis,nq)
     2      use infotrac, only: tname
    23      IMPLICIT NONE
    34c=======================================================================
     
    1617#include "netcdf.inc"
    1718#include "serre.h"
    18 #include "advtrac.h"
     19!#include "advtrac.h"
    1920c   Arguments:
    2021c   ----------
     
    902903!               ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 12,
    903904!     .                          "Traceurs "//str3)
    904              txt="Traceur "//trim(tnom(iq))
    905 #ifdef NC_DOUBLE
    906                ierr=NF_DEF_VAR(nid,tnom(iq),NF_DOUBLE,4,dims4,nvarid)
    907 #else
    908                ierr=NF_DEF_VAR(nid,tnom(iq),NF_FLOAT,4,dims4,nvarid)
     905             txt="Traceur "//trim(tname(iq))
     906#ifdef NC_DOUBLE
     907               ierr=NF_DEF_VAR(nid,tname(iq),NF_DOUBLE,4,dims4,nvarid)
     908#else
     909               ierr=NF_DEF_VAR(nid,tname(iq),NF_FLOAT,4,dims4,nvarid)
    909910#endif
    910911               ierr=NF_PUT_ATT_TEXT(nid,nvarid,"title",
     
    954955      SUBROUTINE dynredem1(fichnom,time,
    955956     .                     vcov,ucov,teta,q,nq,masse,ps)
     957      use infotrac, only: nqtot, tname
    956958      IMPLICIT NONE
    957959c=================================================================
     
    963965#include "comvert.h"
    964966#include "comgeom.h"
    965 #include"advtrac.h"
     967!#include"advtrac.h"
    966968
    967969      INTEGER nq, l
     
    969971      REAL teta(ip1jmp1,llm)                   
    970972      REAL ps(ip1jmp1),masse(ip1jmp1,llm)                   
    971       REAL q(iip1,jjp1,llm,nqmx)
     973      REAL q(iip1,jjp1,llm,nqtot)
    972974      REAL q3d(iip1,jjp1,llm) !temporary variable
    973975      CHARACTER*(*) fichnom
     
    10521054!            WRITE(str3(2:3),'(i2.2)') iq
    10531055!            ierr = NF_INQ_VARID(nid, str3, nvarid)
    1054             ierr=NF_INQ_VARID(nid,tnom(iq),nvarid)
     1056            ierr=NF_INQ_VARID(nid,tname(iq),nvarid)
    10551057            IF (ierr .NE. NF_NOERR) THEN
    10561058!               PRINT*, "Variable "//str3//" n est pas definie"
    1057               PRINT*, "Variable "//trim(tnom(iq))//" n est pas definie"
     1059              PRINT*,"Variable "//trim(tname(iq))//" n est pas definie"
    10581060              CALL abort
    10591061            ENDIF
  • trunk/LMDZ.GENERIC/libf/dyn3d/gcm.F

    r1006 r1216  
    11      PROGRAM gcm
    22
     3      use infotrac, only: iniadvtrac, nqtot, iadv
    34      use sponge_mod,only: callsponge,mode_sponge,sponge
     5      use control_mod, only: nday, day_step, iperiod, iphysiq,
     6     &                       iconser, ecritphy, idissip
     7      use comgeomphy, only: initcomgeomphy
    48      IMPLICIT NONE
    59
     
    4246#include "logic.h"
    4347#include "temps.h"
    44 #include "control.h"
     48!#include "control.h"
    4549#include "ener.h"
    4650#include "netcdf.inc"
    4751#include "serre.h"
    4852#include "tracstoke.h"
    49 #include"advtrac.h"
     53!#include"advtrac.h"
    5054
    5155      INTEGER*4  iday ! jour julien
     
    5660      REAL vcov(ip1jm,llm),ucov(ip1jmp1,llm) ! vents covariants
    5761      real, dimension(ip1jmp1,llm) :: teta   ! temperature potentielle
    58       REAL q(ip1jmp1,llm,nqmx)               ! champs advectes
     62      REAL,allocatable :: q(:,:,:)           ! champs advectes
    5963      REAL ps(ip1jmp1)                       ! pression  au sol
    6064      REAL pext(ip1jmp1)                     ! pression  extensive
     
    7983c   tendances dynamiques
    8084      REAL dv(ip1jm,llm),du(ip1jmp1,llm)
    81       REAL dteta(ip1jmp1,llm),dq(ip1jmp1,llm,nqmx),dp(ip1jmp1)
     85      REAL dteta(ip1jmp1,llm),dp(ip1jmp1)
     86      REAL,ALLOCATABLE :: dq(:,:,:)
    8287
    8388c   tendances de la dissipation
     
    8792c   tendances physiques
    8893      REAL dvfi(ip1jm,llm),dufi(ip1jmp1,llm)
    89       REAL dhfi(ip1jmp1,llm),dqfi(ip1jmp1,llm,nqmx),dpfi(ip1jmp1)
     94      REAL dhfi(ip1jmp1,llm),dpfi(ip1jmp1)
     95      REAL,ALLOCATABLE :: dqfi(:,:,:)
    9096
    9197c   variables pour le fichier histoire
     
    123129      LOGICAL tracer
    124130          data tracer/.true./
    125       INTEGER nq
     131!      INTEGER nq
    126132
    127133C Calendrier
     
    150156      REAL vnat(ip1jm,llm),unat(ip1jmp1,llm)
    151157
     158c-----------------------------------------------------------------------
     159c    variables pour l'initialisation de la physique :
     160c    ------------------------------------------------
     161      INTEGER ngridmx
     162      PARAMETER( ngridmx = 2+(jjm-1)*iim - 1/jjm   )
     163      REAL zcufi(ngridmx),zcvfi(ngridmx)
     164      REAL latfi(ngridmx),lonfi(ngridmx)
     165      REAL airefi(ngridmx)
     166      SAVE latfi, lonfi, airefi
     167      INTEGER i,j
    152168
    153169c-----------------------------------------------------------------------
     
    159175
    160176c-----------------------------------------------------------------------
    161 c  Initialize tracers using iniadvtrac (Ehouarn, oct 2008)
    162       CALL iniadvtrac(nq,numvanle)
    163 
    164 
    165       CALL dynetat0("start.nc",nqmx,vcov,ucov,
     177      CALL defrun_new( 99, .TRUE. )
     178
     179!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     180! FH 2008/05/02
     181! A nettoyer. On ne veut qu'une ou deux routines d'interface
     182! dynamique -> physique pour l'initialisation
     183!#ifdef CPP_PHYS
     184      CALL init_phys_lmdz(iim,jjp1,llm,1,(/(jjm-1)*iim+2/))
     185      call initcomgeomphy
     186!#endif
     187!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     188
     189! Initialize tracers
     190      CALL iniadvtrac(nqtot,numvanle)
     191! Allocation de la tableau q : champs advectes   
     192      allocate(q(ip1jmp1,llm,nqtot))
     193      allocate(dq(ip1jmp1,llm,nqtot))
     194      allocate(dqfi(ip1jmp1,llm,nqtot))
     195
     196      CALL dynetat0("start.nc",nqtot,vcov,ucov,
    166197     .              teta,q,masse,ps,phis, time_0)
    167 
    168       CALL defrun_new( 99, .TRUE. )
    169198
    170199c  on recalcule eventuellement le pas de temps
     
    196225     *                tetagdiv, tetagrot , tetatemp              )
    197226c
     227
     228c-----------------------------------------------------------------------
     229c   Initialisation de la physique :
     230c   -------------------------------
     231
     232!      IF (call_iniphys.and.(iflag_phys==1.or.iflag_phys>=100)) THEN
     233         latfi(1)=rlatu(1)
     234         lonfi(1)=0.
     235         zcufi(1) = cu(1)
     236         zcvfi(1) = cv(1)
     237         DO j=2,jjm
     238            DO i=1,iim
     239               latfi((j-2)*iim+1+i)= rlatu(j)
     240               lonfi((j-2)*iim+1+i)= rlonv(i)
     241               zcufi((j-2)*iim+1+i) = cu((j-1)*iip1+i)
     242               zcvfi((j-2)*iim+1+i) = cv((j-1)*iip1+i)
     243            ENDDO
     244         ENDDO
     245         latfi(ngridmx)= rlatu(jjp1)
     246         lonfi(ngridmx)= 0.
     247         zcufi(ngridmx) = cu(ip1jm+1)
     248         zcvfi(ngridmx) = cv(ip1jm-iim)
     249
     250         ! build airefi(), mesh area on physics grid
     251         CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,aire,airefi)
     252         ! Poles are single points on physics grid
     253         airefi(1)=airefi(1)*iim
     254         airefi(ngridmx)=airefi(ngridmx)*iim
     255
     256! Initialisation de la physique: pose probleme quand on tourne
     257! SANS physique, car iniphysiq.F est dans le repertoire phy[]...
     258! Il faut une cle CPP_PHYS
     259!#ifdef CPP_PHYS
     260!         CALL iniphysiq(ngridmx,llm,daysec,day_ini,dtphys/nsplit_phys,
     261         CALL iniphysiq(ngridmx,llm,daysec,day_ini,dtphys,
     262     &                latfi,lonfi,airefi,zcufi,zcvfi,rad,g,r,cpp,
     263     &                1)
     264!     &                iflag_phys)
     265!#endif
     266!         call_iniphys=.false.
     267!      ENDIF ! of IF (call_iniphys.and.(iflag_phys.eq.1))
    198268
    199269      CALL pression ( ip1jmp1, ap, bp, ps, p       )
     
    229299     . 'c''est a dire du jour',i7,3x,'au jour',i7//)
    230300
    231       CALL dynredem0("restart.nc",day_end,anne_ini,phis,nqmx)
     301      CALL dynredem0("restart.nc",day_end,anne_ini,phis,nqtot)
    232302
    233303      ecripar = .TRUE.
     
    237307
    238308c   Quelques initialisations pour les traceurs
    239       call initial0(ijp1llm*nqmx,dq)
     309      call initial0(ijp1llm*nqtot,dq)
    240310c     istdyn=day_step/4     ! stockage toutes les 6h=1jour/4
    241311c     istphy=istdyn/iphysiq
     
    328398       IF( forward. OR . leapf )  THEN
    329399
    330         DO iq = 1, nqmx
     400        DO iq = 1, nqtot
    331401c
    332402         IF ( iadv(iq).EQ.1.OR.iadv(iq).EQ.2 )  THEN
    333403            CALL traceur( iq,iadv,q,teta,pk,w, pbaru, pbarv, dq )
    334404
    335          ELSE IF( iq.EQ. nqmx )   THEN
     405         ELSE IF( iq.EQ. nqtot )   THEN
    336406c
    337407            iapp_tracvl = 5
     
    341411c
    342412
    343             CALL vanleer(numvanle,iapp_tracvl,nqmx,q,pbaru,pbarv,
     413            CALL vanleer(numvanle,iapp_tracvl,nqtot,q,pbaru,pbarv,
    344414     *                      p, masse, dq,  iadv(1), teta, pk     )
    345415
     
    413483
    414484
    415         CALL calfis( nqmx, lafin ,rdayvrai,rday_ecri,time  ,
     485        CALL calfis( nqtot, lafin ,rdayvrai,rday_ecri,time  ,
    416486     $                 ucov,vcov,teta,q,masse,ps,p,pk,phis,phi ,
    417487     $     du,dv,dteta,dq,w, dufi,dvfi,dhfi,dqfi,dpfi,tracer)
     
    421491c      ------------------------------
    422492!        if(1.eq.2)then
    423           CALL addfi( nqmx, dtphys, leapf, forward   ,
     493          CALL addfi( nqtot, dtphys, leapf, forward   ,
    424494     $                  ucov, vcov, teta , q   ,ps , masse,
    425495     $                 dufi, dvfi, dhfi , dqfi ,dpfi  )
     
    556626c                 iav=0
    557627c              ENDIF
    558 c              CALL writedynav(histaveid, nqmx, itau,vcov ,
     628c              CALL writedynav(histaveid, nqtot, itau,vcov ,
    559629c    ,                          ucov,teta,pk,phi,q,masse,ps,phis)
    560630c           ENDIF
     
    569639       CALL test_period ( ucov,vcov,teta,q,p,phis )
    570640       CALL dynredem1("restart.nc",0.0,
    571      .                     vcov,ucov,teta,q,nqmx,masse,ps)
     641     .                     vcov,ucov,teta,q,nqtot,masse,ps)
    572642
    573643              CLOSE(99)
     
    636706                  iav=0
    637707               ENDIF
    638 c              CALL writedynav(histaveid, nqmx, itau,vcov ,
     708c              CALL writedynav(histaveid, nqtot, itau,vcov ,
    639709c    ,                          ucov,teta,pk,phi,q,masse,ps,phis)
    640710
     
    644714                 IF(itau.EQ.itaufin)
    645715     . CALL dynredem1("restart.nc",0.0,
    646      .                     vcov,ucov,teta,q,nqmx,masse,ps)
     716     .                     vcov,ucov,teta,q,nqtot,masse,ps)
    647717
    648718                 forward = .TRUE.
  • trunk/LMDZ.GENERIC/libf/dyn3d/infotrac.F90

    r1214 r1216  
     1MODULE infotrac
     2
     3IMPLICIT NONE
     4! nqtot : total number of tracers and higher order of moment, water vapor and liquid included
     5  INTEGER, SAVE :: nqtot
     6  INTEGER,allocatable :: iadv(:)   ! tracer advection scheme number
     7  CHARACTER(len=20),allocatable ::  tname(:) ! tracer name
     8
     9CONTAINS
     10
    111      subroutine iniadvtrac(nq,numvanle)
    212!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     
    818      IMPLICIT NONE
    919
    10 #include "dimensions.h"
    11 #include "advtrac.h"
    12 #include "control.h"
     20!#include "dimensions.h"
     21!#include "advtrac.h"
     22!#include "control.h"
    1323
    1424! routine arguments:
     
    2030      INTEGER :: iq
    2131      INTEGER :: ierr
    22 
    23 
    24       if (nqmx > 0) then
     32      CHARACTER(len=3) :: qname
    2533
    2634! Look for file traceur.def
    27       OPEN(90,file='traceur.def',form='formatted',status='old',
    28      &        iostat=ierr)
     35      OPEN(90,file='traceur.def',form='formatted',status='old', &
     36              iostat=ierr)
    2937      IF (ierr.eq.0) THEN
    3038        write(*,*) "iniadvtrac: Reading file traceur.def"
     
    3543          write(*,*) "   (first line of traceur.def) "
    3644          stop
    37         else
    38           ! check that the number of tracers is indeed nqmx
    39           if (nq.ne.nqmx) then
    40             write(*,*) "iniadvtrac: error, wrong number of tracers:"
    41             write(*,*) "nq=",nq," whereas nqmx=",nqmx
    42             stop
    43           endif
    4445        endif
     46       
     47        ! allocate arrays:
     48        allocate(iadv(nq))
     49        allocate(tname(nq))
    4550       
    4651        ! initialize advection schemes to Van-Leer for all tracers
     
    4954        enddo
    5055       
    51 
    52 
    53 !     MODIFICATION TO TEST OTHER SCHEMES BY RDW
    54 !        do iq=1,nq
    55 !           iadv(iq)=1
    56 !        enddo
    57 !        print*,'IADV SET TO 1 IN iniadvtrac!!!!'
    58 
    5956        do iq=1,nq
    6057        ! minimal version, just read in the tracer names, 1 per line
    61           read(90,*,iostat=ierr) tnom(iq)
     58          read(90,*,iostat=ierr) tname(iq)
    6259          if (ierr.ne.0) then
    6360            write(*,*) 'iniadvtrac: error reading tracer names...'
     
    6562          endif
    6663        enddo !of do iq=1,nq
    67       ELSE
    68         write(*,*) "iniadvtrac: can't find file traceur.def..."
    69         stop
     64        close(90) ! done reading tracer names, close file
    7065      ENDIF ! of IF (ierr.eq.0)
    7166
    72 c  ....  Choix  des shemas d'advection pour l'eau et les traceurs  ...
    73 c  ...................................................................
    74 c
    75 c     iadv = 1    shema  transport type "humidite specifique LMD" 
    76 c     iadv = 2    shema   amont
    77 c     iadv = 3    shema  Van-leer
    78 c     iadv = 4    schema  Van-leer + humidite specifique
    79 c                        Modif F.Codron
    80 c
    81 c
    82       DO  iq = 1, nqmx
    83        IF( iadv(iq).EQ.1 ) PRINT *,' Choix du shema humidite specifique'
    84      * ,' pour le traceur no ', iq
    85        IF( iadv(iq).EQ.2 ) PRINT *,' Choix du shema  amont',' pour le'
    86 
    87      * ,' traceur no ', iq
    88        IF( iadv(iq).EQ.3 ) PRINT *,' Choix du shema  Van-Leer ',' pour'
    89      * ,'le traceur no ', iq
     67!  ....  Choix  des shemas d'advection pour l'eau et les traceurs  ...
     68!  ...................................................................
     69!
     70!     iadv = 1    shema  transport type "humidite specifique LMD" 
     71!     iadv = 2    shema   amont
     72!     iadv = 3    shema  Van-leer
     73!     iadv = 4    schema  Van-leer + humidite specifique
     74!                        Modif F.Codron
     75!
     76!
     77      DO  iq = 1, nq-1
     78       IF( iadv(iq).EQ.1 ) PRINT *,' Choix du shema humidite specifique'&
     79       ,' pour le traceur no ', iq
     80       IF( iadv(iq).EQ.2 ) PRINT *,' Choix du shema  amont',' pour le'  &
     81       ,' traceur no ', iq
     82       IF( iadv(iq).EQ.3 ) PRINT *,' Choix du shema  Van-Leer ',' pour' &
     83       ,'le traceur no ', iq
    9084
    9185       IF( iadv(iq).EQ.4 )  THEN
    92          PRINT *,' Le shema  Van-Leer + humidite specifique ',
    93      * ' est  uniquement pour la vapeur d eau .'
     86         PRINT *,' Le shema  Van-Leer + humidite specifique ',          &
     87       ' est  uniquement pour la vapeur d eau .'
    9488         PRINT *,' Corriger iadv( ',iq, ')  et repasser ! '
    9589         CALL ABORT
     
    9791
    9892       IF( iadv(iq).LE.0.OR.iadv(iq).GT.4 )   THEN
    99         PRINT *,' Erreur dans le choix de iadv (nqmx).Corriger et '
    100      * ,' repasser car  iadv(iq) = ', iadv(iq)
     93        PRINT *,' Erreur dans le choix de iadv (nqtot).Corriger et '    &
     94       ,' repasser car  iadv(iq) = ', iadv(iq)
    10195         CALL ABORT
    10296       ENDIF
    10397      ENDDO
    10498
    105 !!!! AS: compiler complains about iadv(nqmx) when there is nqmx=0
    106 !!!! AS: so I commented those lines and changed nqmx-1 for nqmx above
    107 !       IF( iadv(nqmx).EQ.1 ) PRINT *,' Choix du shema humidite '
    108 !     * ,'specifique pour la vapeur d''eau'
    109 !       IF( iadv(nqmx).EQ.2 ) PRINT *,' Choix du shema  amont',' pour la'
    110 !     * ,' vapeur d''eau '
    111 !       IF( iadv(nqmx).EQ.3 ) PRINT *,' Choix du shema  Van-Leer '
    112 !     * ,' pour la vapeur d''eau'
    113 !       IF( iadv(nqmx).EQ.4 ) PRINT *,' Choix du shema  Van-Leer + '
    114 !     * ,' humidite specifique pour la vapeur d''eau'
     99       IF( iadv(nq).EQ.1 ) PRINT *,' Choix du shema humidite '          &
     100       ,'specifique pour la vapeur d''eau'
     101       IF( iadv(nq).EQ.2 ) PRINT *,' Choix du shema  amont',' pour la'  &
     102       ,' vapeur d''eau '
     103       IF( iadv(nq).EQ.3 ) PRINT *,' Choix du shema  Van-Leer '         &
     104       ,' pour la vapeur d''eau'
     105       IF( iadv(nq).EQ.4 ) PRINT *,' Choix du shema  Van-Leer + '       &
     106       ,' humidite specifique pour la vapeur d''eau'
    115107!
    116 !c
    117 !!       IF( (iadv(nqmx).LE.0).OR.(iadv(nqmx).GT.4) )   THEN
    118 !!     MODIFICATION TO TEST WITHOUT TRACER ADVECTION BY RDW
    119 !       IF( (iadv(nqmx).LT.0).OR.(iadv(nqmx).GT.4) )   THEN
    120 !        PRINT *,' Erreur dans le choix de iadv (nqmx).Corriger et '
    121 !     * ,' repasser car  iadv(nqmx) = ', iadv(nqmx)
    122 !         CALL ABORT
    123 !       ENDIF
     108       IF( (iadv(nq).LE.0).OR.(iadv(nq).GT.4) )   THEN
     109        PRINT *,' Erreur dans le choix de iadv (nqtot).Corriger et '    &
     110       ,' repasser car  iadv(nqtot) = ', iadv(nqtot)
     111         CALL ABORT
     112       ENDIF
    124113
    125114      first = .TRUE.
    126       numvanle = nqmx + 1
    127       DO  iq = 1, nqmx
     115      numvanle = nq + 1
     116      DO  iq = 1, nq
    128117        IF(((iadv(iq).EQ.3).OR.(iadv(iq).EQ.4)).AND.first ) THEN
    129118          numvanle = iq
     
    131120        ENDIF
    132121      ENDDO
    133 c
    134       DO  iq = 1, nqmx
     122!
     123      DO  iq = 1, nq
    135124
    136125      IF( (iadv(iq).NE.3.AND.iadv(iq).NE.4).AND.iq.GT.numvanle )  THEN
    137           PRINT *,' Il y a discontinuite dans le choix du shema de ',
    138      *    'Van-leer pour les traceurs . Corriger et repasser . '
     126          PRINT *,' Il y a discontinuite dans le choix du shema de ',   &
     127          'Van-leer pour les traceurs . Corriger et repasser . '
    139128           CALL ABORT
    140129      ENDIF
    141130
    142131      ENDDO
    143 c
    144       endif ! of if nqmx > 0
     132!
     133      end subroutine iniadvtrac
    145134
    146       end
     135END MODULE infotrac
  • trunk/LMDZ.GENERIC/libf/dyn3d/iniconst.F

    r135 r1216  
    11      SUBROUTINE iniconst
    22
     3      use control_mod, only: iphysiq, idissip
    34      IMPLICIT NONE
    45c
     
    1314#include "comconst.h"
    1415#include "temps.h"
    15 #include "control.h"
     16!#include "control.h"
    1617#include "comvert.h"
    1718
  • trunk/LMDZ.GENERIC/libf/dyn3d/inidissip.F

    r253 r1216  
    88c   -------------
    99
     10      use control_mod, only: idissip, iperiod
    1011      IMPLICIT NONE
    1112#include "dimensions.h"
     
    1415#include "comconst.h"
    1516#include "comvert.h"
    16 #include "control.h"
     17!#include "control.h"
    1718
    1819      LOGICAL lstardis
  • trunk/LMDZ.GENERIC/libf/dyn3d/logic.h

    r253 r1216  
    33
    44      COMMON/logic/ purmats,physic,forward,leapf,apphys,grireg,
    5      *  statcl,conser,apdiss,apdelq,saison,ecripar,fxyhypb,ysinus,hybrid,autozlevs
     5     *  statcl,conser,apdiss,apdelq,saison,ecripar,fxyhypb,ysinus,
     6     &  hybrid,autozlevs
    67
    78      LOGICAL purmats,physic,forward,leapf,apphys,grireg,statcl,conser,
  • trunk/LMDZ.GENERIC/libf/dyn3d/test_period.F

    r135 r1216  
    11      SUBROUTINE test_period ( ucov, vcov, teta, q, p, phis )
     2     
     3      USE infotrac, ONLY: nqtot
     4      IMPLICIT NONE
    25c
    36c     Auteur : P. Le Van 
     
    1417c
    1518      REAL ucov(ip1jmp1,llm), vcov(ip1jm,llm), teta(ip1jmp1,llm) ,
    16      ,      q(ip1jmp1,llm,nqmx), p(ip1jmp1,llmp1), phis(ip1jmp1)
     19     ,      q(ip1jmp1,llm,nqtot), p(ip1jmp1,llmp1), phis(ip1jmp1)
    1720c
    1821c   .....  Variables  locales  .....
     
    5154     
    5255c
    53       DO nq =1, nqmx
     56      DO nq =1, nqtot
    5457        DO l =1, llm
    5558          DO ij = 1, ip1jmp1, iip1
Note: See TracChangeset for help on using the changeset viewer.