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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.MARS/makegcm_g95

    r1246 r1403  
    88set physique=mars
    99set phys="PHYS=$physique"
    10 set include='-I$(LIBF)/grid -I$(LIBF)/bibio -I. -I$(LIBF)/aeronomars'
     10set include='-I$(LIBF)/grid -I$(LIBF)/misc -I. -I$(LIBF)/dynlonlat_phylonlat'
    1111set ntrac = 1
    1212set filtre=filtrez
     
    1414set dyntype="dyn"
    1515set full=""
     16#src_dirs: directories containing source files
     17set src_dirs="grid misc"
     18
    1619########################################################################
    1720# path a changer contenant les sources et les objets du modele
    1821########################################################################
    1922
    20 ##### If you want you can set environment variables here (instead of
    21 #####  relying on the C-shell environment variables)
    22 ## default LMDGCM to where makegcm script is located:
    23 #set scriptdir=`dirname $0`
    24 #setenv LMDGCM `readlink -f $scriptdir`
    25 ## You may set LIBOGCM to something else; otherwise we default to:
    26 #setenv LIBOGCM $LMDGCM/libo
    27 ### NetCDF Libraries: what follows is OK for LMD 32 and 64bit Linux Machines
    28 ##if ( `uname -m` == "x86_64" ) then
    29 ### 64 bit machines
    30 #  setenv NCDFLIB /donnees/emlmd/netcdf64-4.0.1_g95/lib
    31 #  setenv NCDFINC /donnees/emlmd/netcdf64-4.0.1_g95/include
    32 ##else
    33 ##  setenv NCDFLIB /donnees/emlmd/netcdf-4.0.1_g95/lib
    34 ##  setenv NCDFINC /donnees/emlmd/netcdf-4.0.1_g95/include
    35 ##endif
    36 #####
     23#### If you want you can set environment variables here (instead of
     24####  relying on the C-shell environment variables)
     25# default LMDGCM to where makegcm script is located:
     26set scriptdir=`dirname $0`
     27setenv LMDGCM `readlink -f $scriptdir`
     28# You may set LIBOGCM to something else; otherwise we default to:
     29setenv LIBOGCM $LMDGCM/libo
     30## NetCDF Libraries: what follows is OK for LMD 32 and 64bit Linux Machines
     31#if ( `uname -m` == "x86_64" ) then
     32# 64 bit machines
     33  setenv NCDFLIB /donnees/emlmd/netcdf64-4.0.1_g95/lib
     34  setenv NCDFINC /donnees/emlmd/netcdf64-4.0.1_g95/include
     35#else
     36#  setenv NCDFLIB /donnees/emlmd/netcdf-4.0.1_g95/lib
     37#  setenv NCDFINC /donnees/emlmd/netcdf-4.0.1_g95/include
     38#endif
     39####
    3740
    3841setenv localdir "`pwd`"
     
    183186# Ehouarn 'g95' compiler
    184187   set optim="-O3 -fstatic -funroll-loops "
    185    set optim90=" -O3 -fstatic -funroll-loops "
    186    set optimtru90=" -O3 -fstatic -funroll-loops "
    187 #   set opt_link=" -Mfree -L/usr/local/pgi/linux86/lib -lpgf90 -lpgftnrtl -lpghpf -lpghpf2 -L$NCDFLIB -lnetcdf -Wl,-Bstatic "
    188 # Ehouarn: there is no /usr/local/pgi/linux86/lib, but it doesn't matter
    189 #          also changed -Wl,-Bstatic to -Bstatic
     188   set optim90="-O3 -fstatic -funroll-loops "
     189   set optimtru90="-O3 -fstatic -funroll-loops "
     190#
    190191   set opt_link=" -L$NCDFLIB -lnetcdf "
    191192   set mod_loc_dir=$localdir
     
    217218endif
    218219
    219 # Ehouarn: add 'g95' string to pathname
     220# Ehouarn: add 'g9fortran' string to pathname
    220221set nomlib=${machine}_g95
    221222
     
    405406if ( "$physique" == 'nophys' ) then
    406407   set phys="L_PHY= LIBPHY="
    407 endif
    408 
     408else
     409   set src_dirs="$src_dirs aerono$physique phy$physique"
     410   set include="$include "'-I$(LIBF)/aerono'"$physique"' -I$(LIBF)/phy'"$physique"
     411endif
     412set libdyn_phy=""
     413set LIBDYN_PHYS=""
    409414########################################################################
    410415# choix du nombre de traceur par defaut si il n'a pas ete choisi,
     
    488493  set include="$include "'-I$(LIBF)/dyn2d '
    489494  set dimh=$dim
    490 else
     495endif
     496if ( "$dimc" == "3" ) then
    491497  if ( "$dyntype" == "olddyn" ) then
    492498    set include="$include "'-I$(LIBF)/olddyn3d '
     499    set src_dirs="$src_dirs olddyn3d dynlonlat_phylonlat dynlonlat_phylonlat/phy$physique"
    493500  else
    494501    set include="$include "'-I$(LIBF)/dyn3d '
     502    set src_dirs="$src_dirs dyn3d dynlonlat_phylonlat dynlonlat_phylonlat/phy$physique"
    495503  endif
     504  set libdyn_phy="-ldynlonlat_phylonlat"
     505  set LIBDYN_PHYS='$(LIBO)/libdynlonlat_phylonlat.a'
    496506  set dimh=`echo $dim | awk ' { print $1 "." $2 } '`
    497507endif
     
    532542cat $libf/grid/dimensions.h
    533543
    534 #
    535544cd $LMDGCM
    536545# set path to objects directory
     
    553562## NB: we still need to have L_DYN=libdyn3d to reach routines and module
    554563## objects which are located in dyn3d
    555   set dyn="L_DYN=-ldyn3d DYN= L_FILTRE= DIRMAIN=phy$physique "
     564  set dyntype=""
     565  set filtre="L_DYN= DYN= FILTRE= L_FILTRE= "
     566  set dyn="L_DYN= DYN= L_FILTRE= "
     567  set dirmain="phy$physique/dyn1d"
     568  set src_dirs="$src_dirs phy$physique/dyn1d "
     569  set include="$include "' -I$(LIBF)/phy'"$physique"'/dyn1d'
    556570endif
    557571endif
     
    593607if ( `expr $dimc \> 2` == 1 ) then
    594608   set filtre="FILTRE=$filtre"
     609   if ( "$dyntype" == "olddyn" ) then
     610     set src_dirs="$src_dirs oldfiltrez"
     611   else
     612     set src_dirs="$src_dirs filtrez"
     613   endif
    595614else
    596    set filtre="FILTRE= L_FILTRE= "
     615   set filtre="FILTRE= L_FILTRE= L_DYN= "
    597616endif
    598617echo "MACRO FILTRE $filtre"
     
    636655        \cp tmp90 liste_des_sources_f90
    637656        echo "On recree le makefile"
    638         if ("$dyntype" == "olddyn") then
    639           ./create_make_gcm olddyn3d grid bibio aeronomars phy$physique >! tmp
    640         else
    641           ./create_make_gcm dyn3d grid bibio aeronomars phy$physique >! tmp
    642         endif
     657        echo "src_dirs: $src_dirs"
     658        create_make_gcm $src_dirs >! tmp
    643659        \mv tmp makefile
    644660        echo "Nouveau makefile cree."
     
    721737else if $LINUX then
    722738# Ehouarn : adapt to g95
    723  set optim="$optim -fmod=$libo"
    724  set optim90="$optim90 -fmod=$libo"
    725  set optimtru90="$optimtru90 -fmod=$libo"
     739 set optim="$optim -fmod=${libo}"
     740 set optim90="$optim90 -fmod=${libo}"
     741 set optimtru90="$optimtru90 -fmod=${libo}"
    726742# Ehouarn: remove set mod_loc_dir def below; mod_loc_dir=$localdir (set above)
    727743# set mod_loc_dir=$libo
     
    741757cd $localdir
    742758
    743 ## locate main program (could be in dyn3d or phy$physique
    744 ##                      and could be .F or .F90)
     759## locate main program (could be in dyn3d or dynlonlat_phylonlat/phy$physique
     760##  or phy$physique/dyn1d   and could be .F or .F90)
    745761set source_code=${code}.F
     762set dirmain=dyn${dimc}d
    746763if ( -f $LMDGCM/libf/dyn3d/${code}.F90 ) then
    747764  set source_code=${code}.F90
    748765endif
    749 if ( -f $LMDGCM/libf/phy${physique}/${code}.F ) then
     766if ( -f $LMDGCM/libf/phy${physique}/dyn1d/${code}.F ) then
     767  set dirmain=phy${physique}/dyn1d
    750768  set source_code=${code}.F
    751769endif
    752 if ( -f $LMDGCM/libf/phy${physique}/${code}.F90 ) then
     770if ( -f $LMDGCM/libf/phy${physique}/dyn1d/${code}.F90 ) then
     771  set dirmain=phy${physique}/dyn1d
    753772  set source_code=${code}.F90
    754773endif
    755 
    756 ## locate directory where main program is located
    757 if ( $dimension == 3 ) then
    758   if ( -f $LMDGCM/libf/dyn3d/${source_code} ) then
    759     set dyn="DIRMAIN=dyn3d "
    760   endif
    761   if ( -f $LMDGCM/libf/phy${physique}/${source_code} ) then
    762     set dyn="DIRMAIN=phy${physique} "
    763   endif
     774if ( -f $LMDGCM/libf/dynlonlat_phylonlat/phy${physique}/${code}.F ) then
     775  set dirmain=dynlonlat_phylonlat/phy${physique}
     776  set source_code=${code}.F
     777endif
     778if ( -f $LMDGCM/libf/dynlonlat_phylonlat/phy${physique}/${code}.F90 ) then
     779  set dirmain=dynlonlat_phylonlat/phy${physique}
     780  set source_code=${code}.F90
    764781endif
    765782
     
    772789$filtre \
    773790LIBO=$libo \
    774 $dyn \
    775791$phys \
     792LIBDYN_PHYS=${LIBDYN_PHYS} \
    776793DIM=$dimc \
    777794DYNTYPE="$dyntype" \
     795L_DYN_PHY="$libdyn_phy" \
    778796L_ADJNT="$adjnt" \
    779797LOCAL_DIR="$localdir"  \
     
    786804MOD_SUFFIX=$mod_suffix \
    787805AR=$ar \
     806DIRMAIN=$dirmain \
    788807SOURCE=$source_code \
    789808PROG=$code
     
    798817$filtre \
    799818LIBO=$libo \
    800 $dyn \
    801819$phys \
     820LIBDYN_PHYS=${LIBDYN_PHYS} \
    802821DIM=$dimc \
    803822DYNTYPE="$dyntype" \
     823L_DYN_PHY="$libdyn_phy" \
    804824L_ADJNT="$adjnt" \
    805825LOCAL_DIR="$localdir"  \
     
    812832MOD_SUFFIX=$mod_suffix \
    813833AR=$ar \
     834DIRMAIN=$dirmain \
    814835SOURCE=$source_code \
    815836PROG=$code
    816837
    817 # cleanup, remove dimensions.h 
     838# cleanup, remove dimensions.h
    818839\rm -f $libf/grid/dimensions.h
Note: See TracChangeset for help on using the changeset viewer.