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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.
Note: See TracChangeset for help on using the changeset viewer.