Changeset 5089 for LMDZ6/branches


Ignore:
Timestamp:
Jul 20, 2024, 5:25:07 PM (5 months ago)
Author:
abarral
Message:

Remove unused (2015+) CPP_EARTH
Start refactoring makelmdz_fcm to prepare investigating fcm upgrade

Location:
LMDZ6/branches/Amaury_dev
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • LMDZ6/branches/Amaury_dev/libf/dyn3d_common/diagedyn.F

    r5082 r5089  
    6262      INCLUDE "iniprint.h"
    6363
    64 !#ifdef CPP_EARTH
    65 !      INCLUDE "../phylmd/YOMCST.h"
    66 !      INCLUDE "../phylmd/YOETHF.h"
    67 !#endif
    6864! Ehouarn: for now set these parameters to what is in Earth physics...
    6965!          (cf ../phylmd/suphel.h)
     
    154150
    155151
    156 !#ifdef CPP_EARTH
    157152      IF (planet_type=="earth") THEN
    158153     
     
    335330      ENDIF ! of if (planet_type=="earth")
    336331!#endif
    337 ! #endif of #ifdef CPP_EARTH
    338       RETURN
     332      RETURN
    339333      END
  • LMDZ6/branches/Amaury_dev/libf/dyn3dmem/parallel_lmdz.F90

    r5082 r5089  
    402402      character(len=6),parameter :: type_ocean="dummy"
    403403#endif
    404 ! #endif of #ifdef CPP_EARTH
    405404
    406405      include "dimensions.h"
  • LMDZ6/branches/Amaury_dev/makelmdz_fcm

    r5048 r5089  
    33# This is a script in Bash.
    44
    5 # FH : on ne cr\'ee plus le fichier arch.mk qui est suppos\'e exister par
     5# FH : on ne crée plus le fichier arch.mk qui est supposé exister par
    66# FH : ailleurs.
    7 # FH : ulterieurement, ce fichier sera pr\'e-existant pour une s\'erie
    8 # FH : de configurations en versions optimis\'ees et debug qui seront
    9 # FH : li\'es (ln -s) avec arch.mk en fonction de l'architecture.
    10 # FH : Pour le moment, cette version est en test et on peut cr\'eer les
    11 # FH : arch.mk en lan\c{}cant une premi\`ere fois makegcm.
     7# FH : ulterieurement, ce fichier sera pré-existant pour une série
     8# FH : de configurations en versions optimisées et debug qui seront
     9# FH : liés (ln -s) avec arch.mk en fonction de l'architecture.
     10# FH : Pour le moment, cette version est en test et on peut créer les
     11# FH : arch.mk en lançant une première fois makegcm.
    1212#
    13 ##set -x
    14 set -e
    15 ########################################################################
    16 # options par defaut pour la commande make
    17 ########################################################################
    18 
    19 dim="96x72x19"
    20 physique=lmd
    21 filtre=filtrez
    22 grille=reg
    23 couple=false
    24 veget=false
    25 inlandsis=false
    26 rrtm=false
    27 rad="oldrad"
    28 dust=false
    29 strataer=false
    30 chimie=false
    31 parallel=none
    32 paramem="mem"
    33 compil_mod=prod
    34 io=ioipsl
    35 LIBPREFIX=""
    36 cosp=false
    37 cosp2=false
    38 cospv2=false
    39 job=1
    40 full=''
    41 libphy=false
    42 isotopes=false
    43 isoverif=false
    44 diagiso=false
    45 isotrac=false
    46 force_compile=false
    47 cplocninca=false
    48 
    49 arch_defined="FALSE"
    50 arch_path="arch"
    51 arch_default_path="arch"
    52 
    53 LMDGCM=`/bin/pwd`
    54 LIBOGCM=$LMDGCM/libo
    55 LIBFGCM=$LMDGCM/libf
    56 DYN_COMMON_PATH=$LIBFGCM/dyn3d_common
    57 # path for optional packages, but default set to ".void_dir"
    58 FILTRE_PATH=$LMDGCM/.void_dir
    59 DYN_PHYS_PATH=$LMDGCM/.void_dir
    60 DYN_PHYS_SUB_PATH=$LMDGCM/.void_dir
    61 PHY_COMMON_PATH=$LMDGCM/.void_dir
    62 RAD_PATH=$LMDGCM/.void_dir
    63 INLANDSIS_PATH=$LMDGCM/.void_dir
    64 DUST_PATH=$LMDGCM/.void_dir
    65 STRATAER_PATH=$LMDGCM/.void_dir
    66 COSP_PATH=$LMDGCM/.void_dir
    67 fcm_path=$LMDGCM/tools/fcm/bin
    68 
    69 ########################################################################
    70 #  Quelques initialisations de variables du shell.
    71 ########################################################################
    72 
    73 CPP_KEY="IN_LMDZ"
    74 INCLUDE=""
    75 LIB=""
    76 adjnt=""
    77 COMPIL_FFLAGS="%PROD_FFLAGS"
    78 PARA_FFLAGS=""
    79 PARA_LD=""
    80 EXT_SRC=""
    81 
    82 ########################################################################
    83 # lecture des options de mymake
    84 ########################################################################
    85 
    86 while (($# > 0))
    87   do
    88   case $1 in
    89       "-h") cat <<fin
    90 Usage :
    91 makelmdz_fcm [options] -arch nom_arch exec
    92 [-h]                       : brief help
    93 [-d [[IMx]JMx]LM]          : IM, JM, LM are the dimensions in x, y, z (default: $dim)
    94 [-p PHYS]                  : set of physical parametrizations (in libf/phyPHYS), (default: lmd)
    95 [-prod / -dev / -debug]    : compilation mode production (default) / developement / debug
    96 [-c false/MPI1/OMCT]       : coupling with ocean model : MPI1/OMCT/false (default: false)
    97 [-v false/orchideetrunk/orchidee2.1/orchidee2.0/orchidee1.9] : version of the vegetation model to include (default: false)
    98           false       : no vegetation model
    99           orchideetrunk : compile using ORCHIDEE trunk from revision 7757 or higher
    100           orchidee2.1 : compile using ORCHIDEE 2.1 until 4.1 included or until revision 7757 on the trunk
    101           orchidee2.0 : compile using ORCHIDEE 2.0
    102           orchidee1.9 : compile using ORCHIDEE up to the version including OpenMP in ORCHIDEE : tag 1.9-1.9.5(version AR5)-1.9.6
    103           true        : (obsolete; for backward compatibility) use ORCHIDEE tag 1.9-1.9.6
    104 [-chimie INCA/false]       : with INCA chemistry model or without (default: false)
    105 [-cplocninca ]        : allow transfer of species from PISCES to INCA (default: false)
    106 [-cosp true/false]    : compile with/without cosp package (default: false)
    107 [-cosp2 true/false]    : compile with/without cosp2 package (default: false)
    108 [-cospv2 true/false]    : compile with/without cospv2 package (default: false)
    109 [-inlandsis true/false]  : compile with/without inlandsis package (default: false)
    110 [-rrtm true/false]    : compile with/without rrtm package (default: false)
    111 [-rad oldrad/rrtm/ecrad]    : compile with oldrad/rrtm/ecrad radiatif code (default: oldrad)
    112 [-dust true/false]    : compile with/without the dust package by Boucher and co (default: false)
    113 [-strataer true/false]    : compile with/without the strat aer package by Boucher and co (default: false)
    114 [-isotopes true/false]    : compile with/without water isotopes in the physics
    115 [-isoverif true/false]    : compile with/without verifications for water isotopes in the physics
    116 [-diagiso true/false]    : compile with/without special diagnostics for water isotopes in the physics
    117 [-isotrac true/false]    : compile with/without tracers of water isotopes in the physics
    118 [-parallel none/mpi/omp/mpi_omp] : parallelism (default: none) : mpi, openmp or mixted mpi_openmp
    119 [-g GRI]                   : grid configuration in dyn3d/GRI_xy.h  (default: reg, inclues a zoom)
    120 [-io ioipsl/mix/xios]                   : Input/Output library (default: ioipsl)
    121 [-include INCLUDES]        : extra include path to add
    122 [-cpp CPP_KEY]             : additional preprocessing definitions
    123 [-adjnt]                   : adjoint model, not operational ...
    124 [-mem]                     : reduced memory dynamics (obsolete flag; always on in parallel mode)
    125 [-filtre NOMFILTRE]        : use filtre from libf/NOMFILTRE (default: filtrez)
    126 [-link LINKS]              : additional links with other libraries
    127 [-j n]                     : active parallel compiling on ntask
    128 [-full]                    : full recompiling
    129 [-libphy]                  : only compile physics package (no dynamics or main program)
    130 [-fcm_path path]           : path to the fcm tool (default: tools/fcm/bin)
    131 [-ext_src path]            : path to an additional set of routines to compile with the model
    132 [-arch_path path]          : path to architecture files (default: $arch_default_path)
    133 [-force_compile]           : recompile although there seems to be an on-going compilation
    134  -arch nom_arch            : target architecture
    135  exec                      : executable to build
     13set -eu
     14
     15function init_vars() {
     16  ########################################################################
     17  # options par defaut pour la commande make
     18  ########################################################################
     19
     20  dim="96x72x19"
     21  physique=lmd
     22  filtre=filtrez
     23  grille=reg
     24  couple=false
     25  veget=false
     26  inlandsis=false
     27  rad="oldrad"
     28  dust=false
     29  strataer=false
     30  chimie=false
     31  parallel=none
     32  paramem="mem"
     33  compil_mod=prod
     34  io=ioipsl
     35  cosp=false
     36  cosp2=false
     37  cospv2=false
     38  job=1
     39  full=''
     40  libphy=false
     41  isotopes=false
     42  isoverif=false
     43  diagiso=false
     44  isotrac=false
     45  force_compile=false
     46  cplocninca=false
     47
     48  arch_defined="FALSE"
     49  arch_path="arch"
     50  arch_default_path="arch"
     51
     52  LMDGCM=$(/bin/pwd)
     53  LIBOGCM=$LMDGCM/libo
     54  LIBFGCM=$LMDGCM/libf
     55  DYN_COMMON_PATH=$LIBFGCM/dyn3d_common
     56  # path for optional packages, but default set to ".void_dir"
     57  FILTRE_PATH=$LMDGCM/.void_dir
     58  DYN_PHYS_PATH=$LMDGCM/.void_dir
     59  DYN_PHYS_SUB_PATH=$LMDGCM/.void_dir
     60  PHY_COMMON_PATH=$LMDGCM/.void_dir
     61  RAD_PATH=$LMDGCM/.void_dir
     62  INLANDSIS_PATH=$LMDGCM/.void_dir
     63  DUST_PATH=$LMDGCM/.void_dir
     64  STRATAER_PATH=$LMDGCM/.void_dir
     65  COSP_PATH=$LMDGCM/.void_dir
     66  fcm_path=$LMDGCM/tools/fcm/bin
     67
     68  ########################################################################
     69  #  Quelques initialisations de variables du shell.
     70  ########################################################################
     71
     72  CPP_KEY="IN_LMDZ"
     73  INCLUDE=""
     74  LIB=""
     75  COMPIL_FFLAGS="%PROD_FFLAGS"
     76  PARA_FFLAGS=""
     77  PARA_LD=""
     78  EXT_SRC=""
     79}
     80
     81function read_cmdline_options() {
     82
     83  ########################################################################
     84  # lecture des options de mymake
     85  ########################################################################
     86
     87  while (($# > 0))
     88    do
     89    case $1 in
     90        "-h") cat <<fin
     91  Usage :
     92  makelmdz_fcm [options] -arch nom_arch exec
     93  [-h]                       : brief help
     94  [-d [[IMx]JMx]LM]          : IM, JM, LM are the dimensions in x, y, z (default: $dim)
     95  [-p PHYS]                  : set of physical parametrizations (in libf/phyPHYS), (default: lmd)
     96  [-prod / -dev / -debug]    : compilation mode production (default) / developement / debug
     97  [-c false/MPI1/OMCT]       : coupling with ocean model : MPI1/OMCT/false (default: false)
     98  [-v false/orchideetrunk/orchidee2.1/orchidee2.0/orchidee1.9] : version of the vegetation model to include (default: false)
     99            false       : no vegetation model
     100            orchideetrunk : compile using ORCHIDEE trunk from revision 7757 or higher
     101            orchidee2.1 : compile using ORCHIDEE 2.1 until 4.1 included or until revision 7757 on the trunk
     102            orchidee2.0 : compile using ORCHIDEE 2.0
     103            orchidee1.9 : compile using ORCHIDEE up to the version including OpenMP in ORCHIDEE : tag 1.9-1.9.5(version AR5)-1.9.6
     104            true        : (obsolete; for backward compatibility) use ORCHIDEE tag 1.9-1.9.6
     105  [-chimie INCA/false]       : with INCA chemistry model or without (default: false)
     106  [-cplocninca ]        : allow transfer of species from PISCES to INCA (default: false)
     107  [-cosp true/false]    : compile with/without cosp package (default: false)
     108  [-cosp2 true/false]    : compile with/without cosp2 package (default: false)
     109  [-cospv2 true/false]    : compile with/without cospv2 package (default: false)
     110  [-inlandsis true/false]  : compile with/without inlandsis package (default: false)
     111  [-rrtm true/false]    : compile with/without rrtm package (default: false)
     112  [-rad oldrad/rrtm/ecrad]    : compile with oldrad/rrtm/ecrad radiatif code (default: oldrad)
     113  [-dust true/false]    : compile with/without the dust package by Boucher and co (default: false)
     114  [-strataer true/false]    : compile with/without the strat aer package by Boucher and co (default: false)
     115  [-isotopes true/false]    : compile with/without water isotopes in the physics
     116  [-isoverif true/false]    : compile with/without verifications for water isotopes in the physics
     117  [-diagiso true/false]    : compile with/without special diagnostics for water isotopes in the physics
     118  [-isotrac true/false]    : compile with/without tracers of water isotopes in the physics
     119  [-parallel none/mpi/omp/mpi_omp] : parallelism (default: none) : mpi, openmp or mixted mpi_openmp
     120  [-g GRI]                   : grid configuration in dyn3d/GRI_xy.h  (default: reg, inclues a zoom)
     121  [-io ioipsl/mix/xios]                   : Input/Output library (default: ioipsl)
     122  [-include INCLUDES]        : extra include path to add
     123  [-cpp CPP_KEY]             : additional preprocessing definitions
     124  [-mem]                     : reduced memory dynamics (obsolete flag; always on in parallel mode)
     125  [-filtre NOMFILTRE]        : use filtre from libf/NOMFILTRE (default: filtrez)
     126  [-link LINKS]              : additional links with other libraries
     127  [-j n]                     : active parallel compiling on ntask
     128  [-full]                    : full recompiling
     129  [-libphy]                  : only compile physics package (no dynamics or main program)
     130  [-fcm_path path]           : path to the fcm tool (default: tools/fcm/bin)
     131  [-ext_src path]            : path to an additional set of routines to compile with the model
     132  [-arch_path path]          : path to architecture files (default: $arch_default_path)
     133  [-force_compile]           : recompile although there seems to be an on-going compilation
     134   -arch nom_arch            : target architecture
     135   exec                      : executable to build
    136136fin
    137           exit;;
    138 
    139       "-d")
    140           dim=$2 ; shift ; shift ;;
    141      
    142       "-p")
    143           physique="$2" ;  shift ; shift ;;
    144 
    145       "-g")
    146           grille="$2" ; shift ; shift ;;
    147 
    148       "-c")
    149           couple="$2" ; shift ; shift ;;
    150 
    151       "-prod")
    152           compil_mod="prod" ; shift ;;
    153 
    154       "-dev")
    155           compil_mod="dev" ; shift ;;
    156 
    157       "-debug")
    158           compil_mod="debug" ; shift ;;
    159 
    160       "-io")
    161           io="$2" ; shift ; shift ;;
    162 
    163       "-v")
    164           veget="$2" ; shift ; shift ;;
    165 
    166       "-inlandsis")
    167           inlandsis="$2" ; shift ; shift ;;
    168 
    169       "-rrtm")
    170           rrtm="$2" ; if [ "$2" = "false" ] ; then rad="oldrad" ; else rad="rrtm" ; fi ; shift ; shift ;;
    171 
    172       "-rad")
    173           rad="$2" ; shift ; shift ;;
    174 
    175       "-dust")
    176           dust="$2" ; shift ; shift ;;
    177 
    178       "-strataer")
    179           strataer="$2" ; shift ; shift ;;
    180 
    181       "-chimie")
    182           chimie="$2" ; shift ; shift ;;
    183 
    184      "-cplocninca")
    185           cplocninca=TRUE ; shift ;;
    186 
    187       "-isotopes")
    188           isotopes="$2" ; shift ; shift ;;
    189 
    190       "-isoverif")
    191           isoverif="$2" ; shift ; shift ;;
    192 
    193       "-diagiso")
    194           diagiso="$2" ; shift ; shift ;;
    195 
    196       "-isotrac")
    197           isotrac="$2" ; shift ; shift ;;
    198 
    199       "-parallel")
    200           parallel="$2" ; shift ; shift ;;
    201      
    202       "-include")
    203           INCLUDE="$INCLUDE -I$2" ; shift ; shift ;;
    204 
    205       "-cpp")
    206           CPP_KEY="$CPP_KEY $2" ; shift ; shift ;;
    207 
    208       "-adjnt")
    209           echo "not operational ... work to be done here ";exit
    210           opt_dep="$opt_dep adjnt" ; adjnt="-ladjnt -ldyn3d "
    211           optim="$optim -Dadj" ; shift ;;
    212 
    213       "-cosp")
    214           cosp="$2" ; shift ; shift ;;
    215 
    216       "-cosp2")
    217           cosp2="$2" ; shift ; shift ;;
    218 
    219       "-cospv2")
    220           cospv2="$2" ; shift ; shift ;;
    221      
    222       "-mem")
    223           echo "option -mem is obsolete (now always on in parallel)"
    224           paramem="mem" ; shift ;;
    225 
    226       "-filtre")
    227           filtre=$2 ; shift ; shift ;;
    228 
    229       "-link")
    230           LIB="$LIB $2" ; shift ; shift ;;
    231 
    232       "-fcm_path")
    233           fcm_path=$2 ; shift ; shift ;;
    234 
    235       "-ext_src")
    236           EXT_SRC=$2 ; shift ; shift ;;
    237 
    238       "-j")
    239           job=$2 ; shift ; shift ;;
    240 
    241       "-full")
    242           full="-full" ; shift ;;
    243 
    244       "-libphy")
    245           libphy="true" ; shift ;;
    246 
    247       "-arch")
    248           arch=$2 ; arch_defined="TRUE" ; shift ; shift ;;
    249 
    250       "-arch_path")
    251           arch_path=$2 ; arch_path_defined="TRUE"; shift ; shift ;;
    252 
    253       "-force_compile")
    254           force_compile=true ; shift ;;
    255 
    256       *)
    257           code="$1" ; shift ;;
    258   esac
    259 done
    260 
    261 ###############################################################
    262 # path to fcm
    263 ###############################################################
    264 # handle case when provided path to fcm was given as a relative
    265 # path (from makelmdz_fcm script directory) and not an absolute path
    266 if [[ ${fcm_path:0:1} != "/" ]] ; then
    267   # prepend with makelmdz_fcm location
    268   fcm_path=$(cd $(dirname $0) ; pwd)"/"${fcm_path}
    269 fi
    270 
    271 # add fcm_path to PATH
    272 export PATH=${fcm_path}:${PATH}
    273 
    274 echo "Path to fcm:"
    275 echo ${fcm_path}
    276 
    277 ###############################################################
    278 # lecture des chemins propres \`a l'architecture de la machine #
    279 ###############################################################
    280 rm -f .void_file
    281 echo > .void_file
    282 rm -rf .void_dir
    283 mkdir .void_dir
    284 
    285 if [[ "$arch_defined" == "TRUE" ]]
    286 then
    287   rm -f arch.path
    288   rm -f arch.fcm
    289   rm -f arch.env
    290 
    291   if test -f $arch_path/arch-${arch}.path
    292   then
    293     ln -s $arch_path/arch-${arch}.path arch.path
    294   elif test -f $arch_default_path/arch-${arch}.path
    295   then
    296     ln -s $arch_default_path/arch-${arch}.path arch.path
    297   fi
    298        
    299   if test -f $arch_path/arch-${arch}.fcm
    300   then
    301     ln -s $arch_path/arch-${arch}.fcm arch.fcm
    302   elif test -f $arch_default_path/arch-${arch}.fcm
    303   then
    304     ln -s $arch_default_path/arch-${arch}.fcm arch.fcm
    305   fi
    306 
    307   if test -f $arch_path/arch-${arch}.env
    308   then
    309     ln -s $arch_path/arch-${arch}.env arch.env
    310   elif test -f $arch_default_path/arch-${arch}.env
    311   then
    312     ln -s $arch_default_path/arch-${arch}.env arch.env
     137      exit 2;;
     138
     139        "-d")
     140      dim=$2; shift; shift;;
     141
     142        "-p")
     143      physique="$2";  shift; shift;;
     144
     145        "-g")
     146      grille="$2"; shift; shift;;
     147
     148        "-c")
     149      couple="$2"; shift; shift;;
     150
     151        "-prod")
     152      compil_mod="prod"; shift;;
     153
     154        "-dev")
     155      compil_mod="dev"; shift;;
     156
     157        "-debug")
     158      compil_mod="debug"; shift;;
     159
     160        "-io")
     161      io="$2"; shift; shift;;
     162
     163        "-v")
     164      veget="$2"; shift; shift;;
     165
     166        "-inlandsis")
     167            inlandsis="$2"; shift; shift;;
     168
     169        "-rrtm")
     170            if [ "$2" = "false" ]; then rad="oldrad"; else rad="rrtm"; fi; shift; shift;;
     171
     172        "-rad")
     173            rad="$2"; shift; shift;;
     174
     175        "-dust")
     176      dust="$2"; shift; shift;;
     177
     178        "-strataer")
     179      strataer="$2"; shift; shift;;
     180
     181        "-chimie")
     182      chimie="$2"; shift; shift;;
     183
     184       "-cplocninca")
     185            cplocninca=TRUE; shift;;
     186
     187        "-isotopes")
     188      isotopes="$2"; shift; shift;;
     189
     190        "-isoverif")
     191      isoverif="$2"; shift; shift;;
     192
     193        "-diagiso")
     194      diagiso="$2"; shift; shift;;
     195
     196        "-isotrac")
     197      isotrac="$2"; shift; shift;;
     198
     199        "-parallel")
     200      parallel="$2"; shift; shift;;
     201
     202        "-include")
     203      INCLUDE="$INCLUDE -I$2"; shift; shift;;
     204
     205        "-cpp")
     206      CPP_KEY="$CPP_KEY $2"; shift; shift;;
     207
     208        "-cosp")
     209            cosp="$2"; shift; shift;;
     210
     211        "-cosp2")
     212            cosp2="$2"; shift; shift;;
     213
     214        "-cospv2")
     215            cospv2="$2"; shift; shift;;
     216
     217        "-mem")
     218            echo "option -mem is obsolete (now always on in parallel)"
     219            paramem="mem"; shift;;
     220
     221        "-filtre")
     222      filtre=$2; shift; shift;;
     223
     224        "-link")
     225      LIB="$LIB $2"; shift; shift;;
     226
     227        "-fcm_path")
     228      fcm_path=$2; shift; shift;;
     229
     230        "-ext_src")
     231      EXT_SRC=$2; shift; shift;;
     232
     233        "-j")
     234      job=$2; shift; shift;;
     235
     236        "-full")
     237      full="-full"; shift;;
     238
     239        "-libphy")
     240      libphy="true"; shift;;
     241
     242        "-arch")
     243      arch=$2; arch_defined="TRUE"; shift; shift;;
     244
     245        "-arch_path")
     246      arch_path=$2; shift; shift;;
     247
     248        "-force_compile")
     249      force_compile=true; shift;;
     250
     251        *)
     252      code="$1"; shift;;
     253    esac
     254  done
     255
     256  ###############################################################
     257  # path to fcm
     258  ###############################################################
     259  # handle case when provided path to fcm was given as a relative
     260  # path (from makelmdz_fcm script directory) and not an absolute path
     261  if [[ ${fcm_path:0:1} != "/" ]]; then
     262    # prepend with makelmdz_fcm location
     263    fcm_path="$(cd "$(dirname "$0")"; pwd)/$fcm_path"
     264  fi
     265
     266  # add fcm_path to PATH
     267  export PATH=$fcm_path:$PATH
     268  echo "Path to fcm: $fcm_path"
     269}
     270
     271function init_arch() {
     272  ###############################################################
     273  # lecture des chemins propres à l'architecture de la machine #
     274  ###############################################################
     275  rm -f .void_file
     276  touch .void_file
     277  rm -rf .void_dir
     278  mkdir .void_dir
     279
     280  if [[ "$arch_defined" == "TRUE" ]]; then
     281    local i
     282    for i in "path" "fcm" "env"; do
     283      rm -f "arch.$i"
     284
     285      if [[ -f "$arch_path/arch-$arch.$i" ]]; then
     286        ln -s "$arch_path/arch-$arch.$i" "arch.$i"
     287      elif [[ -f "$arch_default_path/arch-$arch.$i" ]]; then
     288        ln -s "$arch_default_path/arch-$arch.$i" "arch.$i"
     289      elif [[ $i = "env" ]]; then
     290        ln -s .void_file arch.env
     291      fi
     292    done
     293
     294    # source architecture PATH and ENV files
     295    source arch.env
     296    source arch.path
    313297  else
    314     ln -s .void_file arch.env
    315   fi
    316   # source architecture PATH and ENV files
    317   source arch.env
    318   source arch.path
    319 else
    320   echo "You must define a target architecture"
    321   exit 1
    322 fi
    323 
    324 ########################################################################
    325 # Definition des clefs CPP, des chemins des includes et modules
    326 #  et des libraries
    327 ########################################################################
    328 
    329 if [[ "$compil_mod" == "prod" ]]
    330 then
    331   COMPIL_FFLAGS="%PROD_FFLAGS"
    332 elif [[ "$compil_mod" == "dev" ]]
    333 then
    334   COMPIL_FFLAGS="%DEV_FFLAGS"
    335 elif [[ "$compil_mod" == "debug" ]]
    336 then
    337   COMPIL_FFLAGS="%DEBUG_FFLAGS"
    338 fi
    339 
    340 phys_root=$physique
    341 if [[ "${physique:0:3}" == "lmd" ]] ; then phys_root=lmd ; fi
    342 if [[ "${physique:0:4}" == "mars" ]] ; then phys_root=mars ; fi
    343 if [[ "${physique:0:3}" == "std" ]] ; then phys_root=std ; fi
    344 if [[ "${physique:0:5}" == "venus" ]] ; then phys_root=venus ; fi
    345 if [[ "${physique:0:5}" == "titan" ]] ; then phys_root=titan ; fi
    346 if [[ "${physique:0:3}" == "dev" ]] ; then phys_root=dev ; fi
    347 
    348 if [[ "$physique" != "nophys" ]]
    349 then
    350    #We'll use some physics
    351    CPP_KEY="$CPP_KEY CPP_PHYS"
    352    if [[ "${phys_root}" == "lmd" ]]
    353    then
    354    #For lmd physics, default planet type is Earth
    355    CPP_KEY="$CPP_KEY CPP_EARTH"
    356    fi
    357    # set physics common utilities path
    358    PHY_COMMON_PATH="${LIBFGCM}/phy_common"
    359    # set the dyn/phys interface path
    360    DYN_PHYS_PATH="${LIBFGCM}/dynphy_lonlat"
    361    DYN_PHYS_SUB_PATH="${LIBFGCM}/dynphy_lonlat/phy${phys_root}"
    362 fi
    363 
    364 if [[ "$filtre" == "filtrez" ]]
    365 then
    366    FILTRE_PATH=${LIBFGCM}/$filtre
    367 fi
    368 
    369 if [[ "$chimie" == "INCA" ]]
    370 then
    371    CPP_KEY="$CPP_KEY INCA"
    372    INCLUDE="$INCLUDE ${INCA_INCDIR}"
    373    LIB="$LIB ${INCA_LIBDIR} ${INCA_LIB}"
    374 fi
    375 
    376 if [[ "$isotopes" == "true" ]]
    377 then
    378    CPP_KEY="$CPP_KEY ISO"
    379 fi
    380 
    381 if [[ "$isoverif" == "true" ]]
    382 then
    383    CPP_KEY="$CPP_KEY ISOVERIF"
    384 fi
    385 
    386 if [[ "$diagiso" == "true" ]]
    387 then
    388    CPP_KEY="$CPP_KEY DIAGISO"
    389 fi
    390 
    391 if [[ "$isotrac" == "true" ]]
    392 then
    393    CPP_KEY="$CPP_KEY ISOTRAC"
    394 fi
    395 
    396 if [[ "$couple" != "false" ]]
    397 then
    398     if [[ "$couple" == "MPI1" ]]
    399     then
    400         CPP_KEY="$CPP_KEY CPP_COUPLE"
    401         export OASIS_INCDIR=$LMDGCM/../../prism/X64/build/lib/psmile.MPI1
    402         export OASIS_LIBDIR=$LMDGCM/../../prism/X64/lib
    403         INCLUDE="$INCLUDE -I${OASIS_INCDIR}"
    404         LIB="$LIB -L${OASIS_LIBDIR} -lpsmile.MPI1 -lmpp_io"
    405     else
    406         CPP_KEY="$CPP_KEY CPP_COUPLE CPP_OMCT"
    407         INCLUDE="$INCLUDE ${OASIS_INCDIR}"
    408         LIB="$LIB ${OASIS_LIBDIR} -lpsmile.MPI1 -lscrip -lmct -lmpeu"
    409     fi
    410 fi
    411 
    412 if [[ "$parallel" == "mpi" ]]
    413 then
    414    CPP_KEY="$CPP_KEY CPP_PARA CPP_MPI"
    415    PARA_FFLAGS="%MPI_FFLAGS"
    416    PARA_LD="%MPI_LD"
    417 elif [[ "$parallel" == "omp" ]]
    418 then
    419    CPP_KEY="$CPP_KEY CPP_PARA CPP_OMP"
    420    PARA_FFLAGS="%OMP_FFLAGS"
    421    PARA_LD="%OMP_LD"
    422 elif [[ "$parallel" == "mpi_omp" ]]
    423 then
    424    CPP_KEY="$CPP_KEY CPP_PARA CPP_MPI CPP_OMP"
    425    PARA_FFLAGS="%MPI_FFLAGS %OMP_FFLAGS"
    426    PARA_LD="%MPI_LD %OMP_LD"
    427 fi
    428 
    429 if [[ ( "$parallel" == "omp" || "$parallel" == "mpi_omp" ) \
    430    && "$compil_mod" == "debug" ]]
    431 then
    432     echo "Usually, parallelization with OpenMP requires some optimization."
    433     echo "We suggest switching to \"-dev\"."
    434 fi
    435 
    436 if [ "$veget" = "true" -o "$veget" = "orchidee1.9" -o "$veget" = "orchidee2.0" -o "$veget" = "orchidee2.1" -o "$veget" = "orchideetrunk" ]
    437 then
     298    echo "STOP: You must define a target architecture"; exit 1
     299  fi
     300}
     301
     302init_vars
     303read_cmdline_options "$@"
     304init_arch
     305
     306function cpp_keys_and_include_mod_path() {
     307  ########################################################################
     308  # Definition des clefs CPP, des chemins des includes et modules
     309  #  et des libraries
     310  ########################################################################
     311
     312  if [[ $compil_mod = "prod" ]]; then
     313    COMPIL_FFLAGS="%PROD_FFLAGS"
     314  elif [[ $compil_mod = "dev" ]]; then
     315    COMPIL_FFLAGS="%DEV_FFLAGS"
     316  elif [[ $compil_mod = "debug" ]]; then
     317    COMPIL_FFLAGS="%DEBUG_FFLAGS"
     318  fi
     319
     320  phys_root=$physique
     321  if [[ ${physique:0:3} = "lmd" ]]; then phys_root=lmd; fi
     322  if [[ ${physique:0:4} = "mars" ]]; then phys_root=mars; fi
     323  if [[ ${physique:0:3} = "std" ]]; then phys_root=std; fi
     324  if [[ ${physique:0:5} = "venus" ]]; then phys_root=venus; fi
     325  if [[ ${physique:0:5} = "titan" ]]; then phys_root=titan; fi
     326  if [[ ${physique:0:3} = "dev" ]]; then phys_root=dev; fi
     327
     328  if [[ $physique != "nophys" ]]; then
     329     #We'll use some physics
     330     CPP_KEY="$CPP_KEY CPP_PHYS"
     331     # set physics common utilities path
     332     PHY_COMMON_PATH="${LIBFGCM}/phy_common"
     333     # set the dyn/phys interface path
     334     DYN_PHYS_PATH="${LIBFGCM}/dynphy_lonlat"
     335     DYN_PHYS_SUB_PATH="${LIBFGCM}/dynphy_lonlat/phy${phys_root}"
     336  fi
     337
     338  if [[ "$filtre" = "filtrez" ]]; then
     339     FILTRE_PATH=${LIBFGCM}/$filtre
     340  fi
     341
     342  if [[ "$chimie" = "INCA" ]]; then
     343     CPP_KEY="$CPP_KEY INCA"
     344     INCLUDE="$INCLUDE ${INCA_INCDIR}"
     345     LIB="$LIB ${INCA_LIBDIR} ${INCA_LIB}"
     346  fi
     347
     348  if [[ "$isotopes" = "true" ]]; then
     349     CPP_KEY="$CPP_KEY ISO"
     350  fi
     351
     352  if [[ "$isoverif" = "true" ]]; then
     353     CPP_KEY="$CPP_KEY ISOVERIF"
     354  fi
     355
     356  if [[ "$diagiso" = "true" ]]; then
     357     CPP_KEY="$CPP_KEY DIAGISO"
     358  fi
     359
     360  if [[ "$isotrac" = "true" ]]; then
     361     CPP_KEY="$CPP_KEY ISOTRAC"
     362  fi
     363
     364  if [[ "$couple" != "false" ]]; then
     365      if [[ "$couple" = "MPI1" ]]; then
     366        CPP_KEY="$CPP_KEY CPP_COUPLE"
     367        export OASIS_INCDIR=$LMDGCM/../../prism/X64/build/lib/psmile.MPI1
     368        export OASIS_LIBDIR=$LMDGCM/../../prism/X64/lib
     369        INCLUDE="$INCLUDE -I${OASIS_INCDIR}"
     370        LIB="$LIB -L${OASIS_LIBDIR} -lpsmile.MPI1 -lmpp_io"
     371      else
     372        CPP_KEY="$CPP_KEY CPP_COUPLE CPP_OMCT"
     373        INCLUDE="$INCLUDE ${OASIS_INCDIR}"
     374        LIB="$LIB ${OASIS_LIBDIR} -lpsmile.MPI1 -lscrip -lmct -lmpeu"
     375      fi
     376  fi
     377
     378  if [[ "$parallel" = "mpi" ]]; then
     379     CPP_KEY="$CPP_KEY CPP_PARA CPP_MPI"
     380     PARA_FFLAGS="%MPI_FFLAGS"
     381     PARA_LD="%MPI_LD"
     382  elif [[ "$parallel" = "omp" ]]; then
     383     CPP_KEY="$CPP_KEY CPP_PARA CPP_OMP"
     384     PARA_FFLAGS="%OMP_FFLAGS"
     385     PARA_LD="%OMP_LD"
     386  elif [[ "$parallel" = "mpi_omp" ]]; then
     387     CPP_KEY="$CPP_KEY CPP_PARA CPP_MPI CPP_OMP"
     388     PARA_FFLAGS="%MPI_FFLAGS %OMP_FFLAGS"
     389     PARA_LD="%MPI_LD %OMP_LD"
     390  fi
     391
     392  if [[ ( "$parallel" = "omp" || "$parallel" = "mpi_omp" ) && "$compil_mod" = "debug" ]]; then
     393      echo "Usually, parallelization with OpenMP requires some optimization."
     394      echo "We suggest switching to \"-dev\"."
     395  fi
     396
     397if [[ "$veget" = "true" || "$veget" = "orchidee1.9" || "$veget" = "orchidee2.0" \
     398   || "$veget" = "orchidee2.1" || "$veget" = "orchideetrunk" ]]; then
    438399        echo "doing orchidee"
    439400#NB: option 'true': for backward compatibility. To be used with ORCHIDEE tag 1.9-1.9.6
     
    445406   if [[ "$veget" == "orchidee1.9" ]] ; then
    446407      CPP_KEY="$CPP_KEY ORCHIDEE_NOOPENMP"
    447    fi
    448    if [[ "$veget" == "orchidee2.0" ]] ; then
     408    fi
     409    if [[ "$veget" = "orchidee2.0" ]]; then
    449410      orch_libs="-lsechiba -lparameters -lstomate -lparallel -lorglob -lorchidee"
    450411      CPP_KEY="$CPP_KEY ORCHIDEE_NOUNSTRUCT"
    451    elif [[ "$veget" == "orchidee2.1" ]] ; then
     412    elif [[ "$veget" = "orchidee2.1" ]]; then
    452413      CPP_KEY="$CPP_KEY ORCHIDEE_NOLIC"
    453414      orch_libs="-lsechiba -lparameters -lstomate -lparallel -lorglob -lorchidee"
    454    elif [[ "$veget" == "orchideetrunk" ]] ; then
     415    elif [[ "$veget" = "orchideetrunk" ]]; then
    455416      orch_libs="-lorchidee"
    456    else
     417    else
    457418      orch_libs="-lsechiba -lparameters -lstomate -lparallel -lorglob"
    458    fi
    459    LIB="${LIB} ${ORCH_LIBDIR} ${orch_libs}"
    460 #   for lib in ${orch_libs} ; do
    461 #      if [ -f ${ORCH_LIBDIR#-L}/lib${LIBPREFIX}$lib.a ] ; then
    462 #         LIB="${LIB} -l${LIBPREFIX}$lib "
    463 #      fi
    464 #   done
    465    echo "orchidee lib"
    466    echo ${LIB}
    467 elif [[ "$veget" != "false" ]] ; then
    468    echo "Option -v $veget does not exist"
    469    echo "Use ./makelmdz_fcm -h for more information"
    470    exit
    471 fi
    472 
    473 if [[ "$inlandsis" == "true" ]]
    474 then
    475    CPP_KEY="$CPP_KEY CPP_INLANDSIS"
    476    INLANDSIS_PATH="$LIBFGCM/phy${physique}/inlandsis"
    477 fi
    478 
    479 if [[ "$rad" == "rrtm" ]]
    480 then
    481    CPP_KEY="$CPP_KEY CPP_RRTM"
    482    RAD_PATH="$LIBFGCM/phy${physique}/rrtm"
    483 fi
    484 if [[ "$rad" == "ecrad" ]]
    485 then
    486    CPP_KEY="$CPP_KEY CPP_ECRAD"
    487    RAD_PATH="$LIBFGCM/phy${physique}/ecrad"
    488 fi
    489 
    490 if [[ "$dust" == "true" ]]
    491 then
    492    CPP_KEY="$CPP_KEY CPP_Dust"
    493    DUST_PATH="$LIBFGCM/phy${physique}/Dust"
    494 fi
    495 
    496 if [[ "$strataer" == "true" ]]
    497 then
    498    CPP_KEY="$CPP_KEY CPP_StratAer"
    499    STRATAER_PATH="$LIBFGCM/phy${physique}/StratAer"
    500 fi
    501 
    502 INCLUDE="$INCLUDE ${NETCDF95_INCDIR}"
    503 LIB="$LIB ${NETCDF95_LIBDIR} ${NETCDF95_LIB}"
    504 
    505 if [[ $io == ioipsl ]]
    506 then
    507    CPP_KEY="$CPP_KEY CPP_IOIPSL"
    508    INCLUDE="$INCLUDE ${IOIPSL_INCDIR}"
    509    LIB="$LIB ${IOIPSL_LIBDIR} ${IOIPSL_LIB}"
    510 elif [[ $io == mix ]]
    511 then
    512    # For now, xios implies also using ioipsl
    513    CPP_KEY="$CPP_KEY CPP_IOIPSL CPP_XIOS"
    514    INCLUDE="$INCLUDE ${IOIPSL_INCDIR} ${XIOS_INCDIR}"
    515    LIB="$LIB ${IOIPSL_LIBDIR} ${IOIPSL_LIB} ${XIOS_LIBDIR} ${XIOS_LIB}"
    516 elif [[ $io == xios ]]
    517 then
    518    # For now, xios implies also using ioipsl
    519    CPP_KEY="$CPP_KEY CPP_IOIPSL CPP_XIOS CPP_IOIPSL_NO_OUTPUT"
    520    INCLUDE="$INCLUDE ${IOIPSL_INCDIR} ${XIOS_INCDIR}"
    521    LIB="$LIB ${IOIPSL_LIBDIR} ${IOIPSL_LIB} ${XIOS_LIBDIR} ${XIOS_LIB}"
    522 fi
    523 
    524 if [[ "$cosp" == "true" ]]
    525 then
    526    CPP_KEY="$CPP_KEY CPP_COSP"
    527    COSP_PATH="$LIBFGCM/phylmd/cosp"
    528 #   LIB="${LIB} -l${LIBPREFIX}cosp"
    529 fi
    530 
    531 if [[ "$cosp2" == "true" ]]
    532 then
    533    CPP_KEY="$CPP_KEY CPP_COSP2"
    534    COSP_PATH="$LIBFGCM/phylmd/cosp2"
    535 #   LIB="${LIB} -l${LIBPREFIX}cosp2"
    536 fi
    537 
    538 if [[ "$cospv2" == "true" ]]
    539 then
    540    CPP_KEY="$CPP_KEY CPP_COSPV2"
    541    COSP_PATH="$LIBFGCM/phylmd/cospv2"
    542 #   LIB="${LIB} -l${LIBPREFIX}cosp2"
    543 fi
    544 
    545 if [[ "$cplocninca" == "TRUE" ]]
    546 then
    547     CPP_KEY="${CPP_KEY} CPP_CPLOCNINCA"
    548 fi
    549 
    550 
    551 INCLUDE="$INCLUDE ${NETCDF_INCDIR}"
    552 LIB="$LIB ${NETCDF_LIBDIR} ${NETCDF_LIB}"
     419    fi
     420    LIB="${LIB} ${ORCH_LIBDIR} ${orch_libs}"
     421    echo "orchidee lib"
     422    echo "${LIB}"
     423  elif [[ "$veget" != "false" ]]; then
     424    echo "Option -v $veget does not exist"
     425    echo "Use ./makelmdz_fcm -h for more information"
     426    exit  1
     427  fi
     428
     429  if [[ "$inlandsis" = "true" ]]; then
     430     CPP_KEY="$CPP_KEY CPP_INLANDSIS"
     431     INLANDSIS_PATH="$LIBFGCM/phy${physique}/inlandsis"
     432  fi
     433
     434  if [[ "$rad" = "rrtm" ]]; then
     435     CPP_KEY="$CPP_KEY CPP_RRTM"
     436     RAD_PATH="$LIBFGCM/phy${physique}/rrtm"
     437  fi
     438  if [[ "$rad" = "ecrad" ]]; then
     439     CPP_KEY="$CPP_KEY CPP_ECRAD"
     440     RAD_PATH="$LIBFGCM/phy${physique}/ecrad"
     441  fi
     442
     443  if [[ "$dust" = "true" ]]; then
     444     CPP_KEY="$CPP_KEY CPP_Dust"
     445     DUST_PATH="$LIBFGCM/phy${physique}/Dust"
     446  fi
     447
     448  if [[ "$strataer" = "true" ]]; then
     449     CPP_KEY="$CPP_KEY CPP_StratAer"
     450     STRATAER_PATH="$LIBFGCM/phy${physique}/StratAer"
     451  fi
     452
     453  INCLUDE="$INCLUDE ${NETCDF95_INCDIR}"
     454  LIB="$LIB ${NETCDF95_LIBDIR} ${NETCDF95_LIB}"
     455
     456  if [[ $io = ioipsl ]]; then
     457     CPP_KEY="$CPP_KEY CPP_IOIPSL"
     458     INCLUDE="$INCLUDE ${IOIPSL_INCDIR}"
     459     LIB="$LIB ${IOIPSL_LIBDIR} ${IOIPSL_LIB}"
     460  elif [[ $io = mix ]]; then
     461     # For now, xios implies also using ioipsl
     462     CPP_KEY="$CPP_KEY CPP_IOIPSL CPP_XIOS"
     463     INCLUDE="$INCLUDE ${IOIPSL_INCDIR} ${XIOS_INCDIR}"
     464     LIB="$LIB ${IOIPSL_LIBDIR} ${IOIPSL_LIB} ${XIOS_LIBDIR} ${XIOS_LIB}"
     465  elif [[ $io = xios ]]; then
     466     # For now, xios implies also using ioipsl
     467     CPP_KEY="$CPP_KEY CPP_IOIPSL CPP_XIOS CPP_IOIPSL_NO_OUTPUT"
     468     INCLUDE="$INCLUDE ${IOIPSL_INCDIR} ${XIOS_INCDIR}"
     469     LIB="$LIB ${IOIPSL_LIBDIR} ${IOIPSL_LIB} ${XIOS_LIBDIR} ${XIOS_LIB}"
     470  fi
     471
     472  if [[ "$cosp" = "true" ]]; then
     473     CPP_KEY="$CPP_KEY CPP_COSP"
     474     COSP_PATH="$LIBFGCM/phylmd/cosp"
     475  fi
     476
     477  if [[ "$cosp2" = "true" ]]; then
     478     CPP_KEY="$CPP_KEY CPP_COSP2"
     479     COSP_PATH="$LIBFGCM/phylmd/cosp2"
     480  fi
     481
     482  if [[ "$cospv2" = "true" ]]; then
     483     CPP_KEY="$CPP_KEY CPP_COSPV2"
     484     COSP_PATH="$LIBFGCM/phylmd/cospv2"
     485  fi
     486
     487  if [[ "$cplocninca" = "TRUE" ]]; then
     488      CPP_KEY="${CPP_KEY} CPP_CPLOCNINCA"
     489  fi
     490
     491
     492  INCLUDE="$INCLUDE ${NETCDF_INCDIR}"
     493  LIB="$LIB ${NETCDF_LIBDIR} ${NETCDF_LIB}"
     494}
     495
     496cpp_keys_and_include_mod_path
     497
    553498
    554499########################################################################
Note: See TracChangeset for help on using the changeset viewer.