Changeset 1403 for trunk/LMDZ.COMMON


Ignore:
Timestamp:
Mar 31, 2015, 3:49:07 PM (10 years ago)
Author:
emillour
Message:

All models: Reorganizing the physics/dynamics interface.

  • makelmdz and makelmdz_fcm scripts adapted to handle the new directory settings
  • misc: (replaces what was the "bibio" directory)
  • Should only contain extremely generic (and non physics or dynamics-specific) routines
  • Therefore moved initdynav.F90, initfluxsto.F, inithist.F, writedynav.F90, write_field.F90, writehist.F to "dyn3d_common"
  • dynlonlat_phylonlat: (new interface directory)
  • This directory contains routines relevent to physics/dynamics grid interactions, e.g. routines gr_dyn_fi or gr_fi_dyn and calfis
  • Moreover the dynlonlat_phylonlat contains directories "phy*" corresponding to each physics package "phy*" to be used. These subdirectories should only contain specific interfaces (e.g. iniphysiq) or main programs (e.g. newstart)
  • phy*/dyn1d: this subdirectory contains the 1D model using physics from phy*

EM

Location:
trunk/LMDZ.COMMON
Files:
5 added
6 deleted
9 edited
6 copied
31 moved

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.COMMON/bld.cfg

    r1302 r1403  
    2626src::dyn     %SRC_PATH/%DYN
    2727src::phys    %SRC_PATH/%PHYS
     28src::dyn_phys %DYN_PHYS
     29src::dyn_phys_sub %DYN_PHYS_SUB
    2830src::sisvat  %SISVAT
    2931src::rrtm    %RRTM
    3032src::grid    %SRC_PATH/grid
    31 src::filtrez %SRC_PATH/filtrez
    32 src::bibio   %SRC_PATH/bibio
    33 src::dyn3d_common   %SRC_PATH/dyn3d_common
     33src::filtrez %FILTRE
     34src::bibio   %SRC_PATH/misc
     35src::dyn3d_common   %DYN_COMMON
    3436src::cosp    %COSP
    3537src::chem    %CHEM
  • trunk/LMDZ.COMMON/create_make_gcm

    r1391 r1403  
    55#set -xv
    66
     7# arguments given to create_make_gcm are the directories to scan
     8src_dirs=$*
    79
    810machine=`hostname`
     
    4850fi
    4951echo "LOCAL_DIR=`echo $localdir`"
    50 echo 'BIBIO    = $(LIBF)/bibio'
    51 echo 'DYN3D_COMMON   = $(LIBF)/dyn3d_common'
     52echo 'MISC    = $(LIBF)/misc'
     53#echo 'DYN3D_COMMON   = $(LIBF)/dyn3d_common'
    5254echo "FILTRE   = filtre"
    5355echo "PHYS  = "
    5456echo 'LIBPHY = $(LIBO)/libphy$(PHYS).a'
     57echo 'LIBDYN_PHY = $(LIBO)/libdynlmdz_phy$(PHYS).a'
    5558echo 'DIRMAIN=dyn$(DIM)d$(FLAG_PARA)'
    5659echo 'RM=rm'
     
    6164echo 'L_DYN      = -ldyn$(DIM)d$(FLAG_PARA) -ldyn3d_common'
    6265echo 'L_FILTRE   = -l$(FILTRE)'
     66echo 'L_DYN_PHY = -ldynlmdz_phy$(PHYS) '
    6367echo 'L_PHY = -lphy$(PHYS) '
    64 echo 'L_BIBIO    = -lbibio'
     68echo 'L_MISC    = -lmisc'
    6569echo 'L_ADJNT    ='
    6670echo 'L_COSP     = -lcosp'
     
    97101echo
    98102#echo 'main : chimie $(DYN) bibio phys $(OPTION_DEP) '
    99 echo 'main : $(DYN) bibio phys $(OPTION_DEP) '
     103echo 'main : $(DYN) misc phys dyn_phy $(OPTION_DEP) '
    100104echo '  cd $(LIBO) ; $(RANLIB) lib*.a ; cd $(GCM) ;\'
    101105echo '  cd $(LOCAL_DIR); \'
    102106echo '  $(COMPILE90) $(LIBF)/$(DIRMAIN)/$(SOURCE) -o $(PROG).o ; \'
    103 echo '  $(LINK) $(PROG).o -L$(LIBO) $(L_DYN) $(L_ADJNT) $(L_COSP) $(L_AERONOMARS) $(L_PHY) $(L_DYN) $(L_DYN3D_COMMON) $(L_BIBIO) $(L_DYN3D_COMMON) $(L_PHY) $(L_DYN) $(L_FILTRE) $(OPLINK) $(OPTION_LINK) -o $(LOCAL_DIR)/$(PROG).e ; $(RM) $(PROG).o '
     107echo '  $(LINK) $(PROG).o -L$(LIBO) $(L_DYN) $(L_DYN_PHY) $(L_ADJNT) $(L_COSP) $(L_AERONOMARS) $(L_PHY) $(L_DYN) $(L_DYN3D_COMMON) $(L_MISC) $(L_DYN3D_COMMON) $(L_PHY) $(L_DYN_PHY) $(L_DYN) $(L_FILTRE) $(OPLINK) $(OPTION_LINK) -o $(LOCAL_DIR)/$(PROG).e ; $(RM) $(PROG).o '
    104108echo
    105109echo 'phys : $(LIBPHY)'
     
    108112echo 'dyn1d :'
    109113echo
     114echo 'dyn_phy: $(LIBDYN_PHYS)'
    110115echo
    111116#echo 'chimie : $(LIBO)/libchimie.a'
    112117echo
    113 echo 'bibio : $(LIBO)/libbibio.a'
     118echo 'misc : $(LIBO)/libmisc.a'
    114119echo
    115120echo 'adjnt : $(LIBO)/libadjnt.a'
     
    133138echo
    134139cd $libf >/dev/null 2>&1
    135 for diri in ` ls ` ; do
     140
     141for diri in $src_dirs ; do
    136142
    137143   if [ -d $diri ] ; then
    138    if [ "`ls $diri/*.F $diri/*/*.F`" != "" ] || [ "`ls $diri/*.[fF]90 $diri/*/*.[fF]90`" != "" ]  ; then
     144   if [ "`ls $diri/*.F`" != "" ] || [ "`ls $diri/*.[fF]90`" != "" ]  ; then
    139145#      cd $diri >/dev/null 2>&1
    140146      echo
    141147      listlib=""
    142148# Liste des fichiers .F et .F90 n'etant pas des programmes principaux
    143       for fili in `ls $diri/*.[fF] $diri/*/*.[fF]` ; do
     149      for fili in `ls $diri/*.[fF]` ; do
    144150         # Check if file is a routine or main program
    145151         # i.e: look for the "program" keword preceeded by leading spaces
     
    150156         fi
    151157      done
    152       for fili in `ls $diri/*.[fF]90 $diri/*/*.[fF]90` ; do
     158      for fili in `ls $diri/*.[fF]90` ; do
    153159         # Check if file is a routine or main program
    154160         # i.e. look for "program" keyword (with possibly some leading spaces)
     
    163169      echo $listlib >> $logfile
    164170      echo
     171      # topdiri contains main dir name (without trailing "/blabla" for subdirs)
     172      topdiri=${diri%/*}
    165173      echo "#======================================================================="
    166174      echo "# Contenu de la bibliotheque correspondant au Directory "$diri
     
    170178      do
    171179         fili=`echo $trufile | awk -F/ ' { print $NF } ' | cut -d. -f1`
    172          echo '$(LIBO)/lib'$diri".a : " '$(LIBO)/lib'$diri".a("$fili".o)"
     180         echo '$(LIBO)/lib'$topdiri".a : " '$(LIBO)/lib'$topdiri".a("$fili".o)"
    173181         echo
    174182      done
    175       echo '.PRECIOUS   : $(LIBO)/lib'$diri'.a'
    176       echo
    177       echo
    178       echo "# Compilation des membres de la bibliotheque lib"$diri".a"
     183      echo '.PRECIOUS   : $(LIBO)/lib'$topdiri'.a'
     184      echo
     185      echo
     186      echo "# Compilation of elements in $diri of library lib"$topdiri".a"
    179187      echo
    180188      for trufile in $listlib ; do
     
    183191                 egrep -i '^ *module ' $trufile > /dev/null 2>&1 && F90=1
    184192                 egrep -i '#include*.inc ' $trufile > /dev/null 2>&1 && F90=1
    185          str1='$(LIBO)/lib'$diri'.a('$fili'.o) : $(LIBF)/'$trufile
    186          [ "$fili" = "chem.subs" ] && str1=$str1' $(LIBF)/'$diri/chem.mods.F
     193         str1='$(LIBO)/lib'$topdiri'.a('$fili'.o) : $(LIBF)/'$trufile
     194         [ "$fili" = "$diri/chem.subs" ] && str1=$str1' $(LIBF)/'$diri/chem.mods.F
    187195
    188196##########################################################################
     
    199207            strj=`echo $stri | tr [A-Z] [a-z]`
    200208            str2=""
    201             for dirinc in filtrez bibio dyn3d_common grid dyn3d phy* $diri $diri/*/ ; do
     209            for dirinc in $src_dirs ; do
    202210# Recherche dans l'ordre hierarchique inverse car seule la derniere
    203211# ligne est conservee
    204                if [ $dirinc = phydev ] ; then
    205                    dirstr='$(PHYS)'
    206                    libstr='phy$(PHYS)'
    207                else
     212#               if [ $dirinc = phydev ] ; then
     213#                   dirstr='$(PHYS)'
     214#                   libstr='phy$(PHYS)'
     215#               else
    208216                   dirstr=$dirinc
    209217                   libstr=$dirinc
    210                fi
     218#               fi
    211219               echo dirinc $dirinc >> $logfile
    212220               if [ -f $dirinc/$stri ] ; then
     
    238246         # object from library
    239247         echo ' cd $(LIBO); \'
    240          echo ' $(AR) d $(LIBO)/lib'$diri'.a '$fili'.o ; \'
     248         echo ' $(AR) d $(LIBO)/lib'$topdiri'.a '$fili'.o ; \'
    241249         if [ "$F90" -eq '0' ] ; then
    242250         ## Fixed Form Fortran 77
     
    252260         fi
    253261         # Put generated object in library
    254          echo ' $(AR) r $(LIBO)/lib'$diri'.a '$fili'.o ; $(RM) '$fili'.o ; \'
     262         echo ' $(AR) r $(LIBO)/lib'$topdiri'.a '$fili'.o ; $(RM) '$fili'.o ; \'
    255263         echo ' cd $(GCM)'
    256264         echo
     
    303311               str1='$(LIBF)/'$diri'/'$stri
    304312            else
    305                for dirinc in dyn3d grid bibio
     313               for dirinc in dyn3d grid misc
    306314               do
    307315                  if [ -f ../$dirinc/$stri ] ; then
  • trunk/LMDZ.COMMON/libf/dyn3d/leapfrog.F

    r1302 r1403  
    170170      logical ok_sync
    171171      parameter (ok_sync = .true.)
    172       logical physic
     172      logical physics
    173173
    174174      data callinigrads/.true./
     
    251251
    252252      itau = 0
    253       physic=.true.
    254       if (iflag_phys==0.or.iflag_phys==2) physic=.false.
     253      physics=.true.
     254      if (iflag_phys==0.or.iflag_phys==2) physics=.false.
    255255
    256256c      iday = day_ini+itau/day_step
     
    362362     s        apdiss = .TRUE.
    363363         IF( MOD(itau,iphysiq ).EQ.0.AND..NOT.forward
    364      s          .and. physic                        ) apphys = .TRUE.
     364     s          .and. physics                        ) apphys = .TRUE.
    365365      ELSE
    366366      ! Leapfrog/Matsuno time stepping
     
    368368         IF( MOD(itau+1,dissip_period).EQ.0 .AND. .NOT. forward )
    369369     s        apdiss = .TRUE.
    370          IF( MOD(itau+1,iphysiq).EQ.0.AND.physic       ) apphys=.TRUE.
     370         IF( MOD(itau+1,iphysiq).EQ.0.AND.physics       ) apphys=.TRUE.
    371371      END IF
    372372
  • trunk/LMDZ.COMMON/libf/dyn3d/logic.h

    r1302 r1403  
    1212     &  ,read_start,ok_guide,ok_strato,tidal,ok_gradsfile               &
    1313     &  ,ok_limit,ok_etat0,hybrid                                       &
    14      &  ,moyzon_mu,moyzon_ch
     14     &  ,moyzon_mu,moyzon_ch,grireg,physic
    1515
    1616      COMMON/logici/ iflag_phys,iflag_trac
     
    2626
    2727      integer iflag_phys,iflag_trac
     28
     29! stuff for compatibility with Mars/Generic old dyn cores. To be cleaned!
     30      logical grireg,physic
     31
    2832!-----------------------------------------------------------------------
  • trunk/LMDZ.COMMON/libf/dyn3d_common/control_mod.F90

    r1300 r1403  
    5151  real,save :: timestart ! (Mars) time start for run in "start.nc"
    5252
     53  ! stuff for compatibility with Mars/Generic old dyn cores. To be cleaned!
     54  integer,save :: idissip ! (Mars/old dyn) dissipation freq.
     55  real,save :: nday_r ! (Mars/old dyn) number of days to run (possibly including a fraction of day)
     56
     57
    5358END MODULE
  • trunk/LMDZ.COMMON/libf/dyn3d_common/infotrac.F90

    r1391 r1403  
    444444  END SUBROUTINE infotrac_init
    445445
     446! Ehouarn: routine iniadvtrac => from Mars/generic; does essentially the
     447!          same job as infotrac_init. To clean up and merge at some point...
     448      subroutine iniadvtrac(nq,numvanle)
     449!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     450! routine which initializes tracer names and advection schemes
     451! reads these infos from file 'traceur.def' but uses default values
     452! if that file is not found.
     453! Ehouarn Millour. Oct. 2008  (made this LMDZ4-like) for future compatibility
     454!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     455      IMPLICIT NONE
     456
     457!#include "dimensions.h"
     458!#include "advtrac.h"
     459!#include "control.h"
     460
     461! routine arguments:
     462      INTEGER,INTENT(out) :: nq ! number of tracers
     463      INTEGER,INTENT(out) :: numvanle
     464
     465! local variables:
     466      LOGICAL :: first
     467      INTEGER :: iq
     468      INTEGER :: ierr
     469      CHARACTER(len=3) :: qname
     470
     471! Look for file traceur.def
     472      OPEN(90,file='traceur.def',form='formatted',status='old', &
     473              iostat=ierr)
     474      IF (ierr.eq.0) THEN
     475        write(*,*) "iniadvtrac: Reading file traceur.def"
     476        ! read number of tracers:
     477        read(90,*,iostat=ierr) nq
     478        if (ierr.ne.0) then
     479          write(*,*) "iniadvtrac: error reading number of tracers"
     480          write(*,*) "   (first line of traceur.def) "
     481          stop
     482        endif
     483       
     484        ! allocate arrays:
     485        allocate(iadv(nq))
     486        allocate(tname(nq))
     487       
     488        ! initialize advection schemes to Van-Leer for all tracers
     489        do iq=1,nq
     490          iadv(iq)=3 ! Van-Leer
     491        enddo
     492       
     493        do iq=1,nq
     494        ! minimal version, just read in the tracer names, 1 per line
     495          read(90,*,iostat=ierr) tname(iq)
     496          if (ierr.ne.0) then
     497            write(*,*) 'iniadvtrac: error reading tracer names...'
     498            stop
     499          endif
     500        enddo !of do iq=1,nq
     501        close(90) ! done reading tracer names, close file
     502      ENDIF ! of IF (ierr.eq.0)
     503
     504!  ....  Choix  des shemas d'advection pour l'eau et les traceurs  ...
     505!  ...................................................................
     506!
     507!     iadv = 1    shema  transport type "humidite specifique LMD" 
     508!     iadv = 2    shema   amont
     509!     iadv = 3    shema  Van-leer
     510!     iadv = 4    schema  Van-leer + humidite specifique
     511!                        Modif F.Codron
     512!
     513!
     514      DO  iq = 1, nq-1
     515       IF( iadv(iq).EQ.1 ) PRINT *,' Choix du shema humidite specifique'&
     516       ,' pour le traceur no ', iq
     517       IF( iadv(iq).EQ.2 ) PRINT *,' Choix du shema  amont',' pour le'  &
     518       ,' traceur no ', iq
     519       IF( iadv(iq).EQ.3 ) PRINT *,' Choix du shema  Van-Leer ',' pour' &
     520       ,'le traceur no ', iq
     521
     522       IF( iadv(iq).EQ.4 )  THEN
     523         PRINT *,' Le shema  Van-Leer + humidite specifique ',          &
     524       ' est  uniquement pour la vapeur d eau .'
     525         PRINT *,' Corriger iadv( ',iq, ')  et repasser ! '
     526         CALL ABORT
     527       ENDIF
     528
     529       IF( iadv(iq).LE.0.OR.iadv(iq).GT.4 )   THEN
     530        PRINT *,' Erreur dans le choix de iadv (nqtot).Corriger et '    &
     531       ,' repasser car  iadv(iq) = ', iadv(iq)
     532         CALL ABORT
     533       ENDIF
     534      ENDDO
     535
     536       IF( iadv(nq).EQ.1 ) PRINT *,' Choix du shema humidite '          &
     537       ,'specifique pour la vapeur d''eau'
     538       IF( iadv(nq).EQ.2 ) PRINT *,' Choix du shema  amont',' pour la'  &
     539       ,' vapeur d''eau '
     540       IF( iadv(nq).EQ.3 ) PRINT *,' Choix du shema  Van-Leer '         &
     541       ,' pour la vapeur d''eau'
     542       IF( iadv(nq).EQ.4 ) PRINT *,' Choix du shema  Van-Leer + '       &
     543       ,' humidite specifique pour la vapeur d''eau'
     544!
     545       IF( (iadv(nq).LE.0).OR.(iadv(nq).GT.4) )   THEN
     546        PRINT *,' Erreur dans le choix de iadv (nqtot).Corriger et '    &
     547       ,' repasser car  iadv(nqtot) = ', iadv(nqtot)
     548         CALL ABORT
     549       ENDIF
     550
     551      first = .TRUE.
     552      numvanle = nq + 1
     553      DO  iq = 1, nq
     554        IF(((iadv(iq).EQ.3).OR.(iadv(iq).EQ.4)).AND.first ) THEN
     555          numvanle = iq
     556          first    = .FALSE.
     557        ENDIF
     558      ENDDO
     559!
     560      DO  iq = 1, nq
     561
     562      IF( (iadv(iq).NE.3.AND.iadv(iq).NE.4).AND.iq.GT.numvanle )  THEN
     563          PRINT *,' Il y a discontinuite dans le choix du shema de ',   &
     564          'Van-leer pour les traceurs . Corriger et repasser . '
     565           CALL ABORT
     566      ENDIF
     567
     568      ENDDO
     569!
     570      end subroutine iniadvtrac
     571
     572
    446573END MODULE infotrac
  • trunk/LMDZ.COMMON/libf/dyn3dpar/leapfrog_p.F

    r1391 r1403  
    163163      REAL :: secondes
    164164      real :: rdaym_ini
    165       logical :: physic
     165      logical :: physics
    166166      LOGICAL first,callinigrads
    167167
     
    256256
    257257      itau = 0
    258       physic=.true.
    259       if (iflag_phys==0.or.iflag_phys==2) physic=.false.
     258      physics=.true.
     259      if (iflag_phys==0.or.iflag_phys==2) physics=.false.
    260260!      iday = day_ini+itau/day_step
    261261!      time = REAL(itau-(iday-day_ini)*day_step)/day_step+time_0
     
    433433     s        apdiss = .TRUE.
    434434         IF( MOD(itau,iphysiq ).EQ.0.AND..NOT.forward
    435      s          .and. physic                        ) apphys = .TRUE.
     435     s          .and. physics                        ) apphys = .TRUE.
    436436      ELSE
    437437      ! Leapfrog/Matsuno time stepping
     
    439439         IF( MOD(itau+1,dissip_period).EQ.0 .AND. .NOT. forward )
    440440     s        apdiss = .TRUE.
    441          IF( MOD(itau+1,iphysiq).EQ.0.AND.physic) apphys=.TRUE.
     441         IF( MOD(itau+1,iphysiq).EQ.0.AND.physics) apphys=.TRUE.
    442442      END IF
    443443
  • trunk/LMDZ.COMMON/libf/dynlonlat_phylonlat/calfis.F

    r1401 r1403  
    137137      REAL,INTENT(OUT) :: pdpsfi(iip1,jjp1) ! tendency on surface pressure (Pa/s)
    138138
    139 
     139#ifndef CPP_PARA
    140140c    Local variables :
    141141c    -----------------
     
    955955      firstcal = .FALSE.
    956956
    957       RETURN
     957#endif
     958! of #ifndef CPP_PARA
    958959      END
  • trunk/LMDZ.COMMON/libf/dynlonlat_phylonlat/calfis_p.F

    r1401 r1403  
    3333!      USE IOPHY
    3434#endif
     35#ifdef CPP_PARA
    3536      USE parallel_lmdz, ONLY : omp_chunk, using_mpi, AllGather_Field
    3637      USE Write_Field
    3738      Use Write_field_p
    3839      USE Times
     40      USE cpdet_mod, only: tpot2t_p, t2tpot_p
     41! used only for zonal averages
     42      USE moyzon_mod
     43#endif
    3944      USE infotrac, ONLY: nqtot, niadv, tname
    4045      USE control_mod, ONLY: planet_type, nsplit_phys
    41       USE cpdet_mod, only: tpot2t_p, t2tpot_p
    42 
    43 ! used only for zonal averages
    44       USE moyzon_mod
    4546
    4647      IMPLICIT NONE
     
    147148      REAL,INTENT(OUT) :: pdpsfi(iip1,jjp1) ! tendency on surface pressure (Pa/s)
    148149
     150#ifdef CPP_PARA
    149151#ifdef CPP_PHYS
    150152c    Local variables :
     
    895897     .             ztfi_omp,
    896898     .             zqfi_omp,
    897 c#ifdef INCA
    898899     .             flxwfi_omp,
    899 c#endif
    900900     .             zdufi_omp,
    901901     .             zdvfi_omp,
     
    14401440#endif
    14411441! of #ifdef CPP_PHYS
    1442       RETURN
     1442#endif
     1443! of #ifdef CPP_PARA
    14431444      END
  • trunk/LMDZ.COMMON/libf/dynlonlat_phylonlat/gr_dyn_fi_p.F

    r1401 r1403  
    33!
    44      SUBROUTINE gr_dyn_fi_p(nfield,im,jm,ngrid,pdyn,pfi)
    5 #ifdef CPP_PHYS
     5#ifdef CPP_PARA
    66! Interface with parallel physics,
    77      USE mod_interface_dyn_phys
     
    4040c$OMP END DO NOWAIT
    4141#endif
    42 ! of #ifdef CPP_PHYS
     42! of #ifdef CPP_PARA
    4343      RETURN
    4444      END
  • trunk/LMDZ.COMMON/libf/dynlonlat_phylonlat/gr_fi_dyn_p.F

    r1401 r1403  
    33!
    44      SUBROUTINE gr_fi_dyn_p(nfield,ngrid,im,jm,pfi,pdyn)
    5 #ifdef CPP_PHYS
     5#ifdef CPP_PARA
    66! Interface with parallel physics,
    77      USE mod_interface_dyn_phys
    88      USE dimphy
    9       use parallel_lmdz
     9      USE parallel_lmdz
    1010      IMPLICIT NONE
    1111c=======================================================================
     
    5252c$OMP END DO NOWAIT
    5353#endif
    54 ! of #ifdef CPP_PHYS
     54! of #ifdef CPP_PARA
    5555      RETURN
    5656      END
  • trunk/LMDZ.COMMON/makelmdz

    r1391 r1403  
    7979
    8080CPP_KEY=""
    81 INCLUDE='-I$(LIBF)/grid -I$(LIBF)/bibio -I$(LIBF)/filtrez -I. '
     81INCLUDE='-I$(LIBF)/grid -I$(LIBF)/misc -I$(LIBF)/filtrez -I. '
    8282LIB=""
    8383adjnt=""
     
    8686PARA_LD=""
    8787EXT_SRC=""
     88#src_dirs: directories containing source files
     89src_dirs="grid misc"
    8890ccompiler=""
    8991OPTIMC=""
     
    116118[-chimie INCA/false]       : (Earth) with INCA chemistry model or without (default: false)
    117119[-cosp cosp/false]         : (Earth) add the cosp model (default: false)
     120[-sisvat true/false]  : (Earth) compile with/without sisvat package (default: false)
     121[-rrtm true/false]    : (Earth) compile with/without rrtm package (default: false)
    118122[-parallel none/mpi/omp/mpi_omp] : parallelism (default: none) : mpi, openmp or mixted mpi_openmp
    119123[-g GRI]                   : grid configuration in dyn3d/GRI_xy.h  (default: reg, inclues a zoom)
     
    292296for inc in $archfileline ; do INCLUDE="$INCLUDE `echo $inc | grep '\-I'`" ; done
    293297
     298phys_root=$physique
     299if [[ "${physique:0:3}" == "lmd" ]] ; then phys_root=lmd ; fi
     300if [[ "${physique:0:3}" == "mar" ]] ; then phys_root=mar ; fi
     301if [[ "${physique:0:4}" == "mars" ]] ; then phys_root=mars ; fi
     302if [[ "${physique:0:3}" == "std" ]] ; then phys_root=std ; fi
     303if [[ "${physique:0:5}" == "venus" ]] ; then phys_root=venus ; fi
     304if [[ "${physique:0:5}" == "titan" ]] ; then phys_root=titan ; fi
     305if [[ "${physique:0:3}" == "dev" ]] ; then phys_root=dev ; fi
     306
    294307if [[ "$physique" != "nophys" ]]
    295308then
     309   #We'll use some physics
     310   src_dirs="$src_dirs phy$physique"
     311   LIBPHY='$(LIBO)/libphy'"$physique"'.a'
     312   lib_phy='-lphy'"$physique"
    296313   CPP_KEY="$CPP_KEY CPP_PHYS"
    297 fi
    298 
    299 if [[ "$physique" == "lmd" ]]
    300 then
    301    #Default planet type is Earth
     314   if [[ "${phys_root}" == "lmd" ]]
     315   then
     316   #For lmd physics, default planet type is Earth
    302317   CPP_KEY="$CPP_KEY CPP_EARTH"
     318   fi
    303319fi
    304320
     
    309325   LIB="$LIB -l${LIBPREFIX}chim$physique"
    310326   opt_dep="$opt_dep chim$physique"
     327   src_dirs="$src_dirs chim$physique"
    311328# get C compiler name and optim from arch.fcm file
    312329   archfileline=$( grep -i '^%C_COMPILER' arch.fcm )
     
    322339if [[ -d ${LIBFGCM}/aerono${physique} ]]
    323340then
     341   src_dirs="$src_dirs aerono$physique"
    324342   INCLUDE="$INCLUDE -I${LIBFGCM}/aerono${physique}"
    325343   LIB="$LIB -l${LIBPREFIX}aerono$physique"
     
    442460   CPP_KEY="$CPP_KEY CPP_COSP"
    443461   COSP_PATH="$LIBFGCM/cosp"
     462   src_dirs="$src_dirs cosp"
    444463#   LIB="${LIB} -l${LIBPREFIX}cosp"
    445464   opt_dep="$opt_dep cosp"
     
    451470then
    452471   CPP_KEY="$CPP_KEY CPP_SISVAT"
     472   src_dirs="$src_dirs phy${physique}/sisvat"
    453473fi
    454474
     
    456476then
    457477   CPP_KEY="$CPP_KEY CPP_RRTM"
     478   src_dirs="$src_dirs phy${physique}/rrtm"
    458479fi
    459480
     
    507528cd $LIBFGCM/grid/dimension
    508529./makdim $dim
     530if (($? != 0))
     531then
     532    exit 1
     533fi
     534
    509535cat $LIBFGCM/grid/dimensions.h
    510536cd $LMDGCM
     
    534560########################################################################
    535561
    536 dimension=`echo $dim | wc -w`
    537 echo dimension $dimension
    538 
    539 if (( $dimension == 3 )) ; then
     562if (( $dimc == 3 )) ; then
     563   src_dirs="$src_dirs $filtre dyn3d_common dyn3d${FLAG_PARA}"
     564   if [[ $physique != "nophys" ]] ; then
     565     src_dirs="$src_dirs dynlonlat_phylonlat dynlonlat_phylonlat/phy${phys_root}"
     566     libdyn_phy="-ldynlonlat_phylonlat"
     567     LIBDYN_PHYS='$(LIBO)/libdynlonlat_phylonlat.a'
     568     INCLUDE="$INCLUDE "'-I$(LIBF)/dynlonlat_phylonlat'
     569     INCLUDE="$INCLUDE "'-I$(LIBF)/dynlonlat_phylonlat/'"${phys_root}"
     570   fi
    540571  cd $LIBFGCM/grid
    541572  \rm fxyprim.h
     
    543574  filtre="FILTRE=$filtre"
    544575  INCLUDE="$INCLUDE "'-I$(LIBF)/dyn3d${FLAG_PARA} -I$(LIBF)/dyn3d_common '
    545 elif (( $dimension == 2 )) ; then
     576elif (( $dimc == 2 )) ; then
     577   src_dirs="$src_dirs dyn2d"
    546578   filtre="FILTRE= L_FILTRE= "
    547579   INCLUDE="$INCLUDE "'-I$(LIBF)/dyn2d'
    548 elif (( $dimension == 1 )) ; then
     580elif (( $dimc == 1 )) ; then
    549581   echo pas de dynamique
     582   src_dirs="$src_dirs phy${physique}/dyn1d"
    550583   CPP_KEY="$CPP_KEY CPP_1D"
    551    filtre="L_DYN= DYN= FILTRE= L_FILTRE= DIRMAIN=phy$physique "
    552    INCLUDE="$INCLUDE "'-I$(LIBF)/dyn3d -I$(LIBF)/dyn3d_common ' # Pas tres propre
     584   filtre="L_DYN= DYN= FILTRE= L_FILTRE= "
     585   #INCLUDE="$INCLUDE "'-I$(LIBF)/dyn3d -I$(LIBF)/dyn3d_common ' # Pas tres propre
     586   INCLUDE="$INCLUDE "' -I$(LIBF)/phy'"$physique"'/dyn1d'
    553587else
    554588   echo Dimension dimc=$dimc pas prevu ; exit
     
    588622########################################################################
    589623cd $LMDGCM
    590 find libf -name '*.[Fh]' -print | sort > tmp77
    591 find libf -name '*.[Fh]' -exec egrep -i " *use *ioipsl" {} \; -print | sort > tmp90
    592 find libf -name '*.F90' -print | sort >> tmp90
     624
     625
     626if [[ -r .makelmdz ]]
     627then
     628old_lmdz_configuration=$(cat .makelmdz )
     629else
     630old_lmdz_configuration=""
     631fi
     632lmdz_configuration="$src_dirs"
     633if [[ "$lmdz_configuration" != "$old_lmdz_configuration" ]]
     634then
     635  configuration_change="true"
     636else
     637  configuration_change="false"
     638fi
     639
     640mkdir -p make_dir
     641suf_make=`echo $src_dirs | sed -e 's/\//_/g' -e 's/ /_/g'`
     642echo suf_make $suf_make
     643
     644\rm tmp77 tmp90
     645for dir in $src_dirs ; do
     646find libf/$dir -name '*.[Fh]' -print | sort >> tmp77
     647find libf/$dir -name '*.F90' -print | sort >> tmp90
    593648######### CAS PARTICULIER CHIMIE TITAN
    594649if [[ "$physique" == "titan" ]]
     
    597652fi
    598653#########
    599 
    600 if [[ ! ( -r makefile ) || ! ( -r liste_des_sources_f90 ) || ! ( -r liste_des_sources_f77 ) || ` diff tmp77 liste_des_sources_f77 | wc -w ` -ne 0 || ` diff tmp90 liste_des_sources_f90 | wc -w ` -ne 0 ]]
     654done
     655
     656liste77=make_dir/liste_des_sources_f77_$suf_make
     657liste90=make_dir/liste_des_sources_f90_$suf_make
     658if [[ "$physique" == "titan" ]] ; then
     659listeC=make_dir/liste_des_sources_C_$suf_make
     660fi
     661makefile=make_dir/makefile_$suf_make
     662
     663if [[ $configuration_change == "true" || ! ( -r makefile ) || ! ( -r $liste_90 ) || ! ( -r $liste_77 ) || ` diff tmp77 $liste_77 | wc -w ` -ne 0 || ` diff tmp90 $liste_90 | wc -w ` -ne 0 ]]
    601664then
    602665  echo "les fichiers suivants ont ete crees ou detruits"
    603666  echo "ou les fichiers suivants sont passes ou ne sont plus en Fortran 90"
    604   diff liste_des_sources_f77 tmp77
    605   diff liste_des_sources_f90 tmp90
    606   \cp -f tmp77 liste_des_sources_f77
    607   \cp -f tmp90 liste_des_sources_f90
     667  diff $liste77 tmp77
     668  diff $liste90 tmp90
     669  \cp -f tmp77 $liste77
     670  \cp -f tmp90 $liste90
    608671######### CAS PARTICULIER CHIMIE TITAN
    609672  if [[ "$physique" == "titan" ]]
    610673  then
    611   diff liste_des_sources_C tmpC
    612   \cp -f tmpC liste_des_sources_C
     674  diff $listeC tmpC
     675  \cp -f tmpC $listeC
    613676  fi
    614677#########
    615   echo "on recree le makefile"
    616   ./create_make_gcm > tmp
    617   \mv -f tmp makefile
    618   echo "Nouveau makefile cree"
     678  echo "Recreating the makefile"
     679  echo "src_dirs: $src_dirs"
     680  ./create_make_gcm $src_dirs > tmp
     681  \mv -f tmp $makefile
     682  echo "New makefile created"
    619683######### CAS PARTICULIER CHIMIE TITAN
    620684else if [[ "$physique" == "titan" ]]
    621685 then
    622    if [[ ! ( -r liste_des_sources_C ) || ` diff tmpC liste_des_sources_C | wc -w ` -ne 0 ]]
     686   if [[ ! ( -r $listeC ) || ` diff tmpC $listeC | wc -w ` -ne 0 ]]
    623687   then
    624      diff liste_des_sources_C tmpC
    625      \cp -f tmpC liste_des_sources_C
     688     diff $listeC tmpC
     689     \cp -f tmpC $listeC
    626690     echo "on recree le makefile"
    627      ./create_make_gcm > tmp
    628      \mv -f tmp makefile
     691     ./create_make_gcm $src_dirs > tmp
     692     \mv -f tmp $makefile
    629693     echo "Nouveau makefile cree"
    630694   fi
     
    633697fi
    634698
     699ln -sf $makefile makefile
     700
     701#Create a .makelmdz file containing main compilation option for later comparisons
     702echo "$lmdz_configuration" > .makelmdz
     703
    635704#################################################################
    636705# Preparation de l'execution de la commande make
     
    641710then
    642711  source_code=${code}.F
    643   code_dir=dyn${dimc}d${FLAG_PARA}
     712  dirmain=dyn${dimc}d${FLAG_PARA}
    644713else
    645714  if [[ -r $LMDGCM/libf/dyn${dimc}d${FLAG_PARA}/${code}.F90 ]]
    646715  then
    647716    source_code=${code}.F90
    648     code_dir=dyn${dimc}d${FLAG_PARA}
     717    dirmain=dyn${dimc}d${FLAG_PARA}
    649718  else
    650719    if [[ -r $LMDGCM/libf/phy${physique}/${code}.F ]]
    651720    then
    652721      source_code=${code}.F
    653       code_dir=phy${physique}
     722      dirmain=phy${physique}
    654723    else
    655       # last possibility:
    656724      if [[ -r $LMDGCM/libf/phy${physique}/${code}.F90 ]]
    657725      then
    658726        source_code=${code}.F90
    659         code_dir=phy${physique}
     727        dirmain=phy${physique}
    660728      else
    661         echo "Error: cannot find ${code}.F[90]"
    662         echo " neither in dyn${dimc}d${FLAG_PARA} nor in phy${physique}"
    663         exit
     729        if [[ -r $LMDGCM/libf/dynlonlat_phylonlat/phy$phys_root/${code}.F ]]
     730        then
     731          source_code=${code}.F
     732          dirmain="dynlonlat_phylonlat/phy${phys_root}"
     733        else
     734          if [[ -r $LMDGCM/libf/phy$physique/dyn1d/${code}.F ]]
     735          then
     736            source_code=${code}.F
     737            dirmain=phy$physique/dyn1d
     738          else
     739            echo "Error: cannot find ${code}.F[90]"
     740            echo " neither in dyn${dimc}d${FLAG_PARA} nor in phy${physique}"
     741            exit
     742          fi
     743        fi
    664744      fi
    665745    fi
     
    684764then
    685765  INCLUDE="$INCLUDE"' -I$(LIBF)/phy'"$physique"
    686   phys="PHYS=$physique"
    687 else
    688   # trick to avoid having a physics-related library in the makefile
    689   phys="L_PHY= LIBPHY="
    690 fi
    691 if (( $dimension == 1 ))
    692 then
    693  INCLUDE="$INCLUDE"' -I$(LIBF)/dyn3d -I'${LIBOGCM}/${nomlib}
    694 else
    695  INCLUDE="$INCLUDE"' -I$(LIBF)/dyn'${dimc}'d'$FLAG_PARA' -I'${LIBOGCM}/${nomlib}
    696 fi
     766#  phys="PHYS=$physique"
     767#else
     768#  # trick to avoid having a physics-related library in the makefile
     769#  phys="L_PHY= LIBPHY="
     770fi
     771INCLUDE="$INCLUDE"' -I'${LIBOGCM}/${nomlib}
     772#if (( $dimension == 1 ))
     773#then
     774# INCLUDE="$INCLUDE"' -I$(LIBF)/dyn3d -I'${LIBOGCM}/${nomlib}
     775#else
     776#INCLUDE="$INCLUDE"' -I$(LIBF)/dyn'${dimc}'d'$FLAG_PARA' -I'${LIBOGCM}/${nomlib}
     777#fi
    697778
    698779# ranlib utility (check it exists or else default to ls)
     
    727808$filtre \
    728809LIBO=${LIBOGCM}/${nomlib} \
    729 $phys \
     810"PHYS=$physique" \
     811LIBPHY=${LIBPHY} \
     812LIBDYN_PHYS=${LIBDYN_PHYS} \
    730813DIM=$dimc \
    731814FLAG_PARA=$FLAG_PARA \
     815L_PHY="$lib_phy" \
     816L_DYN_PHY="$libdyn_phy" \
    732817L_ADJNT=$adjnt \
    733818L_COSP="$lcosp" \
     
    744829MOD_SUFFIX="mod" \
    745830AR=$arcommand \
    746 DIRMAIN=$code_dir \
     831DIRMAIN=$dirmain \
    747832SOURCE=$source_code \
    748833PROG=$code
     
    758843$filtre \
    759844LIBO=${LIBOGCM}/${nomlib} \
    760 $phys \
     845"PHYS=$physique" \
     846LIBPHY=${LIBPHY} \
     847LIBDYN_PHYS=${LIBDYN_PHYS} \
    761848DIM=$dimc \
    762849FLAG_PARA=$FLAG_PARA \
     850L_PHY="$lib_phy" \
     851L_DYN_PHY="$libdyn_phy" \
    763852L_ADJNT="$adjnt" \
    764853L_COSP="$lcosp" \
     
    775864MOD_SUFFIX="mod" \
    776865AR=$arcommand \
    777 DIRMAIN=$code_dir \
     866DIRMAIN=$dirmain \
    778867SOURCE=$source_code \
    779868PROG=$code
  • trunk/LMDZ.COMMON/makelmdz_fcm

    r1391 r1403  
    4040LIBOGCM=$LMDGCM/libo
    4141LIBFGCM=$LMDGCM/libf
     42DYN_COMMON_PATH=$LIBFGCM/dyn3d_common
    4243# path for optional packages, but default set to ".void_dir"
     44FILTRE_PATH=$LMDGCM/.void_dir
     45DYN_PHYS_PATH=$LMDGCM/.void_dir
     46DYN_PHYS_SUB_PATH=$LMDGCM/.void_dir
    4347RRTM_PATH=$LMDGCM/.void_dir
    4448SISVAT_PATH=$LMDGCM/.void_dir
     
    8791[-chimie INCA/false]       : (Earth) with INCA chemistry model or without (default: false)
    8892[-cosp cosp/false]         : (Earth) add the cosp model (default: false)
     93[-sisvat true/false]  : (Earth) compile with/without sisvat package (default: false)
     94[-rrtm true/false]    : (Earth) compile with/without rrtm package (default: false)
    8995[-parallel none/mpi/omp/mpi_omp] : parallelism (default: none) : mpi, openmp or mixted mpi_openmp
    9096[-g GRI]                   : grid configuration in dyn3d/GRI_xy.h  (default: reg, inclues a zoom)
     
    236242fi
    237243
     244phys_root=$physique
     245if [[ "${physique:0:3}" == "lmd" ]] ; then phys_root=lmd ; fi
     246if [[ "${physique:0:3}" == "mar" ]] ; then phys_root=mar ; fi
     247if [[ "${physique:0:4}" == "mars" ]] ; then phys_root=mars ; fi
     248if [[ "${physique:0:3}" == "std" ]] ; then phys_root=std ; fi
     249if [[ "${physique:0:5}" == "venus" ]] ; then phys_root=venus ; fi
     250if [[ "${physique:0:5}" == "titan" ]] ; then phys_root=titan ; fi
     251if [[ "${physique:0:3}" == "dev" ]] ; then phys_root=dev ; fi
     252
    238253if [[ "$physique" != "nophys" ]]
    239254then
    240255   #We'll use some physics
    241256   CPP_KEY="$CPP_KEY CPP_PHYS"
    242    if [[ "${physique:0:3}" == "lmd" ]]
     257   if [[ "${phys_root}" == "lmd" ]]
    243258   then
    244259   #For lmd physics, default planet type is Earth
    245260   CPP_KEY="$CPP_KEY CPP_EARTH"
    246261   fi
     262   # set the dyn/phys interface path
     263   DYN_PHYS_PATH="${LIBFGCM}/dynlonlat_phylonlat"
     264   DYN_PHYS_SUB_PATH="${LIBFGCM}/dynlonlat_phylonlat/phy${phys_root}"
     265fi
     266
     267if [[ "$filtre" == "filtrez" ]]
     268then
     269   FILTRE_PATH=${LIBFGCM}/$filtre
    247270fi
    248271
     
    360383fi
    361384
    362 if [[ "$physique" == "titan" ]]
     385# for Titan (but could be used by others as well), there is also "chimtitan"
     386if [[ -d ${LIBFGCM}/chim${physique} ]]
    363387then
    364388   CHEM_PATH="${LIBFGCM}/chim${physique}"
     
    463487if (( $dimension == 1 ))
    464488then
     489  CPP_KEY="$CPP_KEY CPP_1D"
    465490##in 1D, add dyn3d to include path (because main prog is in physics)
    466   INCLUDE="$INCLUDE -Ilibf/dyn3d"
    467 #  echo pas de dynamique
    468 #  dyn="DYN= L_DYN=-ldyn3d "
     491  INCLUDE="$INCLUDE -Ilibf/dyn3d -Ilibf/dyn3d_common"
     492## no filtre in 1d:
     493  FILTRE_PATH=$LMDGCM/.void_dir
     494## no need to compile all routines in dyn3d_common either:
     495  DYN_COMMON_PATH=$LMDGCM/.void_dir
     496## no need to compile all routines in dynlmdz_phy... ;
     497## (because key ones are included in 1D main program)
     498  DYN_PHYS_PATH=$LMDGCM/.void_dir
     499  DYN_PHYS_SUB_PATH=$LMDGCM/.void_dir
    469500fi
    470501
     
    523554else
    524555  SUFF_NAME=${SUFF_NAME}_seq
    525   DYN=dyn${dimc}d
    526   ## specific stuff for 1D model (needs includes which are in dyn3d)
    527   if (( $dimension == 1 )) ; then
    528     SUFF_NAME=${SUFF_NAME}
    529     DYN=dyn3d
     556  if (( $dimension == 1 ))
     557  then
     558    # dynamics-related routines in"dyn1d" subdirectory of phy${physique}
     559    DYN=phy${physique}/dyn1d
     560  else
     561    DYN=dyn${dimc}d
    530562  fi
    531563fi
     
    561593echo "%LIBO          $LIBOGCM"       >> $config_fcm
    562594echo "%DYN           $DYN"           >> $config_fcm
     595echo "%DYN_COMMON    $DYN_COMMON_PATH" >> $config_fcm
     596echo "%FILTRE        $FILTRE_PATH"   >> $config_fcm
    563597echo "%PHYS          phy${physique}" >> $config_fcm
     598echo "%DYN_PHYS      $DYN_PHYS_PATH" >> $config_fcm
     599echo "%DYN_PHYS_SUB  $DYN_PHYS_SUB_PATH" >> $config_fcm
    564600echo "%RRTM          $RRTM_PATH"     >> $config_fcm
    565601echo "%SISVAT        $SISVAT_PATH"   >> $config_fcm
     
    594630ln -s $LIBOGCM/${arch}${SUFF_NAME}/.config/tmp tmp_src
    595631
    596 #eventual cleanup for SISVAT
    597 #sed -e 's/^src::sisvat/#src::sisvat/' bld.cfg > bld.tmp
    598 #mv bld.tmp bld.cfg
    599 
    600 #eventual cleanup for RRTM
    601 #sed -e 's/^src::rrtm/#src::rrtm/' bld.cfg > bld.tmp
    602 #mv bld.tmp bld.cfg
    603 
    604632
    605633if [[ -r $LIBFGCM/grid/dimensions.h ]]
Note: See TracChangeset for help on using the changeset viewer.