source: dynamico_lmdz/aquaplanet/ICOSA_LMDZ/make_icosa_lmdz @ 4120

Last change on this file since 4120 was 4120, checked in by jgipsl, 6 years ago

Added argument -rrtm true/false to compile LMDZ with rrtm radiation scheme. Default value rrtm=false makes the same as if the option is not set.

  • Property svn:executable set to *
File size: 5.3 KB
Line 
1#!/bin/bash
2export PATH=$PWD/tools/FCM/bin:$PATH
3
4export ROOT=$PWD
5set -x
6echo $0 $* > rebuild_all
7chmod a+x rebuild_all
8
9compil_mode_defined="FALSE"
10compil_mode="prod"
11
12job=1
13full_defined="FALSE"
14with_xios_defined="TRUE"
15with_orchidee_defined="FALSE"
16arch_defined="FALSE"
17parallel_defined="FALSE"
18arch_path="../ARCH"
19arch_default_path="arch"
20parallel="none"
21physics="none"
22build_deps="TRUE"
23CPP_KEY="CPP_NONE" 
24ICOSA_LIB=""
25rrtm="false"
26
27while (($# > 0))
28  do
29  case $1 in
30      "-h") cat <<fin
31Usage :
32makegcm [options] -m arch -p phys  exec
33[-h]                       : help
34[-prod / -dev / -debug]    : compilation en mode production (default) / developpement / debug .
35[-nodeps]                  : do not build dependencies (XIOS, IOIPSL, LMDZ5, ICOSAGCM)
36 -arch nom_arch            : nom de l\'architecture cible
37 -p phys                   : physics package (e.g. std , venus , ...)
38[-p_opt "options"]         : additional options for physics package
39fin
40          exit;;
41
42      "-p")
43          phys=$2 ; shift ; shift ;;
44     
45      "-p_opt")
46          phys_opt=$2 ; shift ; shift ;;
47
48      "-rrtm")
49          rrtm=$2 ; shift ; shift ;;
50         
51      "-prod")
52          compil_mode="prod" ; shift ;;
53
54      "-dev")
55          compil_mode="dev" ; shift ;;
56
57      "-debug")
58          compil_mode="debug" ; shift ;;
59
60      "-arch")
61          arch=$2 ; arch_defined="TRUE"; shift ; shift ;;
62 
63      "-arch_path")
64          arch_path=$2 ; arch_path_defined="TRUE"; shift ; shift ;;
65
66      "-parallel")
67          parallel=$2 ; parallel_defined="TRUE"; shift ; shift ;;
68
69      "-job")
70          job=$2 ; shift ; shift;;
71
72      "-full")
73          full_defined="TRUE" ; shift ;;
74
75      "-nodeps")
76          build_deps="FALSE" ; shift ;;
77
78      "-with_xios")
79          with_xios_defined="TRUE" ; shift ;;
80
81      "-with_orchidee")
82          with_orchidee_defined="TRUE" ; shift ;;
83
84      *)
85          code="$1" ; shift ;;
86  esac
87done
88
89rm -f .void_file
90echo > .void_file
91rm -rf .void_dir
92mkdir .void_dir
93
94if [[ "$arch_defined" == "TRUE" ]]
95then
96  rm -f arch.path
97  rm -f arch.fcm
98  rm -f arch.env
99
100  if test -f $arch_path/arch-${arch}.path
101  then
102    ln -s $arch_path/arch-${arch}.path arch.path
103  elif test -f $arch_default_path/arch-${arch}.path
104  then
105    ln -s $arch_default_path/arch-${arch}.path arch.path
106  fi
107       
108  if test -f $arch_path/arch-${arch}.fcm
109  then
110    ln -s $arch_path/arch-${arch}.fcm arch.fcm
111  elif test -f $arch_default_path/arch-${arch}.fcm
112  then
113    ln -s $arch_default_path/arch-${arch}.fcm arch.fcm
114  fi
115
116  if test -f $arch_path/arch-${arch}.env
117  then
118    ln -s $arch_path/arch-${arch}.env arch.env
119  elif test -f $arch_default_path/arch-${arch}.env
120  then
121    ln -s $arch_default_path/arch-${arch}.env arch.env
122  else
123    ln -s .void_file arch.env
124  fi
125  source arch.env
126  source arch.path
127else
128  echo "Please define a target architecture"
129  exit 1
130fi
131
132LD_FLAGS="%BASE_LD"
133
134if [[ "$compil_mode" == "prod" ]]
135then
136  COMPIL_FFLAGS="%PROD_FFLAGS"
137elif [[ "$compil_mode" == "dev" ]]
138then
139  COMPIL_FFLAGS="%DEV_FFLAGS"
140elif [[ "$compil_mode" == "debug" ]]
141then
142  COMPIL_FFLAGS="%DEBUG_FFLAGS"
143fi
144
145if [[ "$parallel" == "mpi" ]]
146then
147  CPP_KEY="$CPP_KEY CPP_USING_MPI"
148elif [[ "$parallel" == "omp" ]]
149then
150  CPP_KEY="$CPP_KEY CPP_USING_OMP"
151  COMPIL_FFLAGS="$COMPIL_FFLAGS %OMP_FFLAGS"
152  LD_FLAGS="$LD_FLAGS %OMP_LD"
153elif [[ "$parallel" == "mpi_omp" ]]
154then
155  CPP_KEY="$CPP_KEY CPP_USING_MPI CPP_USING_OMP"
156  COMPIL_FFLAGS="$COMPIL_FFLAGS %OMP_FFLAGS"
157  LD_FLAGS="$LD_FLAGS %OMP_LD"
158elif [[ "$parallel" == "none" ]]
159then
160  parallel="none"
161else 
162  echo "-parallel value $parallel is invalid, only permited <none>, <mpi>, <omp> or <mpi_omp>"
163  exit 1
164fi
165
166if [[ "$with_orchidee_defined" == "TRUE" ]]
167then
168  ICOSA_LIB="$ICOSA_LIB $ORCHIDEE_LIBDIR $ORCHIDEE_LIB"
169fi 
170
171if [[ "$with_xios_defined" == "TRUE" ]]
172then
173  CPP_KEY="$CPP_KEY CPP_USING_XIOS"
174  COMPIL_FFLAGS="$COMPIL_FFLAGS $XIOS_INCDIR"
175  ICOSA_LIB="$ICOSA_LIB $XIOS_LIBDIR $XIOS_LIB"
176fi 
177
178ICOSA_LIB="$ICOSA_LIB $IOIPSL_LIBDIR $IOIPSL_LIB $NETCDF_LIBDIR $NETCDF_LIB $HDF5_LIBDIR $HDF5_LIB"
179
180rm bin/*
181
182if [[ "$full_defined" == "TRUE" ]]
183then
184  full_flag="-full"
185  full_flag2="--full"
186else 
187  full_flag=""
188  full_flag2=""
189fi
190
191rm -f config.fcm
192
193echo "%COMPIL_FFLAGS $COMPIL_FFLAGS $NETCDF_INCDIR" >> config.fcm
194echo "%LD_FLAGS $LD_FLAGS" >> config.fcm
195echo "%CPP_KEY $CPP_KEY" >> config.fcm
196echo "%PHYS phy$phys" >> config.fcm
197echo "%LIB $ICOSA_LIB">> config.fcm
198
199if [[ "$build_deps" == "TRUE" ]]
200then
201
202    cd ../IOIPSL
203    ./makeioipsl_fcm -$compil_mode -parallel -arch $arch -arch_path $arch_path -j $job $full_flag  || exit 1
204    cd -
205
206    cd ../XIOS
207    ./make_xios --$compil_mode --arch $arch --arch_path $arch_path --job $job $full_flag2 || exit 1
208    cd -
209
210    if [[ "$with_orchidee_defined" == "TRUE" ]]
211    then
212        cd ../ORCHIDEE
213        ./makeorchidee_fcm -$compil_mode -parallel $parallel -xios2 -arch $arch -arch_path $arch_path -j $job $full_flag  || exit 1
214        cd -
215    fi
216
217    cd ../LMDZ5
218    lmdz_veget="false"
219    if [[ "$with_orchidee_defined" == "TRUE" ]]
220    then
221        lmdz_veget="orchidee2.0 -cpp ORCHIDEE_NOZ0H"
222    fi
223    ./makelmdz_fcm -p $phys $phys_opt -rrtm $rrtm -$compil_mode -mem -parallel $parallel -libphy -io xios -v $lmdz_veget -arch $arch -arch_path $arch_path -j $job $full_flag || exit 1
224    cd -
225
226    cd ../ICOSAGCM
227    ./make_icosa -$compil_mode -parallel $parallel -external_ioipsl -with_xios -arch $arch -arch_path $arch_path -job $job $full_flag || exit 1
228    cd -
229fi
230
231./build --job $job $full_flag2
Note: See TracBrowser for help on using the repository browser.