[5555] | 1 | #!/bin/bash |
---|
| 2 | #set -vx |
---|
| 3 | # Default options |
---|
| 4 | # |
---|
| 5 | # |
---|
| 6 | # |
---|
| 7 | date |
---|
| 8 | #### 1 Set up the compiling options |
---|
| 9 | #### Define some directories |
---|
| 10 | submitdir=$( pwd ) |
---|
| 11 | modipsl=$submitdir/../.. |
---|
| 12 | arch_path=$submitdir/ARCH |
---|
| 13 | mysrc_path=$submitdir/SOURCES |
---|
| 14 | |
---|
| 15 | #### Set default options |
---|
| 16 | # Atmospheric resolution, for LMDZ/ORCHIDEE in regular mode |
---|
| 17 | resol_atm=144x142x79 |
---|
| 18 | # Oceanic resolution, for NEMO (ORCA2/ORCA1/ORCA025) |
---|
| 19 | resol_oce=ORCA1 |
---|
| 20 | # Version of ice model lim2/lim3 |
---|
| 21 | icemodel=lim3 |
---|
| 22 | # Coupled with ocean biogeochemistry (y/n) |
---|
| 23 | oceanbio=y |
---|
| 24 | # Version ESM CO2: CO2 interactif ocean/atmosphere (y/n) |
---|
| 25 | esmco2=n |
---|
| 26 | # Version ESM AER : Aer interactif chemistry / atmosphere (y/n) |
---|
| 27 | esmaer=n |
---|
| 28 | # Also compile ce0l subprogram to LMDZ (y/n) |
---|
| 29 | ce0l=n |
---|
[6533] | 30 | # choose radiative code compilation option |
---|
| 31 | rad=rrtm |
---|
| 32 | opt_rad="" |
---|
[6550] | 33 | # choose inca chemistry |
---|
| 34 | optchimie=AER |
---|
[5555] | 35 | |
---|
| 36 | # Optimization mode |
---|
| 37 | # optmode=prod/dev/debug |
---|
| 38 | optmode=prod |
---|
| 39 | # fcm_arch |
---|
| 40 | fcm_arch=default |
---|
| 41 | # Default values to be overritten |
---|
| 42 | parallel=mpi_omp |
---|
| 43 | export fcm_arch parallel xios |
---|
| 44 | full_flag="" |
---|
| 45 | full_nemo=n |
---|
| 46 | full_inca="" |
---|
| 47 | full_xios="" |
---|
| 48 | full_lmdz="" |
---|
| 49 | full_orch="" |
---|
| 50 | |
---|
| 51 | |
---|
| 52 | |
---|
| 53 | # Output text file for compilation of each component |
---|
| 54 | datestr=`LC_ALL=C date +"%Y%m%dT%H%M"` |
---|
| 55 | outfile=$submitdir/out_compile_ipslcm6.$datestr |
---|
| 56 | echo > $outfile |
---|
| 57 | echo; echo "Text output from compilation will be stored in file out_compile_ipslcm6.$datestr"; echo |
---|
| 58 | |
---|
| 59 | #### Read arguments |
---|
| 60 | # Loop over all arguments to modify default set up |
---|
| 61 | while (($# > 0)) ; do |
---|
| 62 | case $1 in |
---|
| 63 | "-h") cat <<end_help |
---|
| 64 | ######################################################################## |
---|
| 65 | # Usage of the script compile_ipslcm6.sh |
---|
| 66 | # |
---|
| 67 | ######################################################################## |
---|
| 68 | |
---|
| 69 | ./compile_ipslcm6.sh [Options] |
---|
| 70 | |
---|
| 71 | |
---|
| 72 | Options: [LR / VLR / MR1 / MR025] Model resolution, choose only one. Default: LR. |
---|
| 73 | [ESMCO2] Compile IPSLCM6 for CO2 interactif ocean/atmosphere. |
---|
[6550] | 74 | [ESMCHEM] Compile IPSLCM6 for chemistry interactif on atmosphere |
---|
| 75 | [ESMCO2AER] Compile IPSLCM6 for both interactive CO2 and chemistry, and also with transfer of species from PISCES to INCA. |
---|
[5555] | 76 | [-full] Full recompilation of all components. This option can be added to all other options. |
---|
| 77 | [-cleannemo] Full recompilation of NEMO component only. |
---|
| 78 | [-debug / -dev / -prod] Level of optimization. One of these can be added to all other compile options. Default: -prod. |
---|
| 79 | |
---|
| 80 | |
---|
| 81 | Example 1: Default compilation of IPSLCM6 for resoltion LR |
---|
| 82 | (Resolution atmos: 144x142x79, ocean: ORCA1) |
---|
| 83 | ./compile_ipslcm6.sh |
---|
| 84 | |
---|
| 85 | Example 2: Compilation of IPSLCM6 for resolution MR025 |
---|
| 86 | (atmos: 256x256x79, ocean: ORCA025, NOPISCES) |
---|
| 87 | ./compile_ipslcm6.sh MR025 |
---|
| 88 | |
---|
| 89 | Example 3: Compilation of IPSLCM6 for ESM CO2 |
---|
| 90 | ./compile_ipslcm6.sh ESMCO2 -cleannemo |
---|
| 91 | |
---|
| 92 | Example 4: Default resoltuion (LR) compiled in debug mode |
---|
| 93 | ./compile_ipslcm6.sh -debug |
---|
| 94 | |
---|
| 95 | Example 5: Default compilation with full recompilation of all components. No clean is needed. |
---|
| 96 | ./compile_ipslcm6.sh -full |
---|
| 97 | |
---|
| 98 | Example 6: Full recompilation of resolution MR05 in debug mode |
---|
| 99 | ./compile_ipslcm6.sh MR025 -debug -full |
---|
| 100 | |
---|
[6533] | 101 | Example 7: choose radiative schema for LMDZ (oldrad/rrtm/ecrad). Default is rrtm |
---|
| 102 | ./compile_ipslcm6.sh MR025 -rad ecrad |
---|
| 103 | |
---|
[6550] | 104 | Example 8: Compilation of IPSLCM6 for ESM with INCA chemistry (default CHEMISTRY=AER) |
---|
| 105 | ./compile_ipslcm6.sh ESMCHEM |
---|
[6533] | 106 | |
---|
[6550] | 107 | Example 9: Compilation of IPSLCM6 for ESM with INCA chemistry and choose the chemistry |
---|
| 108 | ./compile_ipslcm6.sh ESMCHEM -chimie GES |
---|
| 109 | |
---|
| 110 | |
---|
[5555] | 111 | end_help |
---|
| 112 | exit;; |
---|
| 113 | "VLR") resol_atm=96x95x39; resol_oce=ORCA2 ; icemodel=lim2; oceanbio=y; shift ;; |
---|
| 114 | "LR") resol_atm=144x142x79; resol_oce=ORCA1 ; icemodel=lim3; oceanbio=y; shift ;; |
---|
| 115 | "MR1") resol_atm=256x256x79; resol_oce=ORCA1 ; icemodel=lim3; oceanbio=y; shift ;; |
---|
| 116 | "MR025") resol_atm=256x256x79; resol_oce=ORCA025 ; icemodel=lim3; oceanbio=n; shift ;; |
---|
| 117 | "ESMCO2") esmco2=y; shift ;; |
---|
[6550] | 118 | "ESMCHEM") esmchem=y; shift ;; |
---|
| 119 | "ESMCO2AER") esmco2=y; esmchem=y; shift ;; |
---|
[5555] | 120 | "CE0L") ce0l=y ; shift ;; |
---|
[6533] | 121 | "-rad") rad=$2; shift ; shift;; |
---|
[5555] | 122 | "-parallel") parallel=$2 ; shift ; shift ;; |
---|
| 123 | "-arch") fcm_arch="$2" ; shift ; shift ;; |
---|
| 124 | "-debug") optmode=debug ; shift ;; |
---|
| 125 | "-dev") optmode=dev ; shift ;; |
---|
| 126 | "-prod") optmode=prod ; shift ;; |
---|
| 127 | "-full") full_flag="-full"; full_nemo=y ; full_xios="--full" ; full_lmdz="-full" ; full_orch="-full" ; shift ;; |
---|
| 128 | "-full_xios") full_xios="--full" ; shift ;; # Note only full_xios is using double dash: --full |
---|
| 129 | "-full_lmdz") full_lmdz="-full" ; shift ;; |
---|
| 130 | "-full_orch") full_orch="-full" ; shift ;; |
---|
| 131 | "-full_nemo") full_nemo=y ; shift ;; |
---|
| 132 | "-full_inca") full_inca="-clean"; shift ;; |
---|
| 133 | "-cleannemo") full_nemo=y ; shift ;; |
---|
[6550] | 134 | "-chimie") optchimie=$2; shift ; shift;; |
---|
| 135 | |
---|
[5555] | 136 | *) echo "unknown option "$1" , exiting..." ; exit |
---|
| 137 | esac |
---|
| 138 | done |
---|
| 139 | |
---|
| 140 | echo "Following options are set in current compiling:" >> $outfile |
---|
| 141 | echo " resol_atm=${resol_atm}, resol_oce=${resol_oce}, icemodel=${icemodel}, oceanbio=${oceanbio}" >> $outfile |
---|
[6550] | 142 | echo " esmco2=${esmco2}, esmchem=${esmchem}, chemistry=${optchimie}" >> $outfile |
---|
[5555] | 143 | echo " ce0l=${ce0l}" >> $outfile |
---|
| 144 | echo " optmode = $optmode, parallel = $parallel, fcm_arch = $fcm_arch " >> $outfile |
---|
| 145 | echo " full_flag=$full_flag, full_xios=$full_xios, full_lmdz=$full_lmdz, full_orch=$full_orch, full_nemo=$full_nemo," >> $outfile |
---|
| 146 | echo >> $outfile |
---|
| 147 | |
---|
| 148 | ### Read host dependent default values |
---|
| 149 | ### These variables will not be changed if they were set as argument |
---|
| 150 | ###./host.sh $host |
---|
| 151 | # Later : Following lines should be set in host.sh file |
---|
| 152 | # begin host.sh |
---|
| 153 | if [ $fcm_arch == default ] ; then |
---|
| 154 | # Find out current host and source specific paths and commands for the host |
---|
| 155 | case $( hostname -s ) in |
---|
| 156 | jean-zay*) |
---|
| 157 | fcm_arch=X64_JEANZAY;; |
---|
| 158 | irene170|irene171|irene190|irene191|irene192|irene193) |
---|
| 159 | fcm_arch=X64_IRENE;; |
---|
| 160 | irene172|irene173|irene194|irene195) |
---|
| 161 | fcm_arch=X64_IRENE-AMD;; |
---|
| 162 | asterix*|obelix*) |
---|
| 163 | fcm_arch=ifort_LSCE |
---|
| 164 | if [ "${parallel}" == "mpi_omp" ] ; then |
---|
| 165 | echo "Warning!! Currently at Obelix hybrid mode is not possible." |
---|
| 166 | echo " Option -parallel mpi_omp is now changed to -parallel mpi" |
---|
| 167 | echo "" |
---|
| 168 | parallel=mpi |
---|
| 169 | else |
---|
| 170 | echo "You used -parallel" $parallel |
---|
| 171 | fi ;; |
---|
| 172 | ciclad*|climserv*|loholt*|camelot*) |
---|
| 173 | fcm_arch=ifort_CICLAD;; |
---|
| 174 | *) |
---|
| 175 | echo Current host is not known. You must use option -arch to specify which architecuture files to use. |
---|
| 176 | echo Exit now. |
---|
| 177 | exit |
---|
| 178 | esac |
---|
| 179 | fi |
---|
| 180 | |
---|
| 181 | # Set a link to arch.env if arch-${fcm_arch}.env file exist for current fcm_arch. |
---|
| 182 | # The link arch.env is also set in config.card and will be used by libIGCM to ensure the same running environnement. |
---|
| 183 | if [ -f ARCH/arch-${fcm_arch}.env ] ; then |
---|
| 184 | echo >> $outfile |
---|
| 185 | echo "The file ARCH/arch-${fcm_arch}.env will now be sourced with modules needed for compilation for all components." |
---|
| 186 | echo "Note that this new environement might be kept after compilation." |
---|
| 187 | echo "If this is the case, source again your personal environment after compilation. " |
---|
| 188 | echo " Personal module list before sourcing of ARCH/arch.env file:" >> $outfile |
---|
| 189 | module list >> $outfile 2>&1 |
---|
[6533] | 190 | # Get initial svn version |
---|
| 191 | svn_version=$(module list -t | grep subversion) |
---|
[5555] | 192 | |
---|
| 193 | # Make a link to this file, to be used also in config.card |
---|
| 194 | rm -f ARCH/arch.env |
---|
| 195 | ln -s arch-${fcm_arch}.env ARCH/arch.env |
---|
| 196 | |
---|
| 197 | # Source the file |
---|
| 198 | source ARCH/arch.env >> $outfile 2>&1 |
---|
[6533] | 199 | if [ X$svn_version != X ] ; then |
---|
| 200 | # Put back initial version of svn |
---|
| 201 | module load ${svn_version} |
---|
| 202 | fi |
---|
[5555] | 203 | echo >> $outfile |
---|
| 204 | echo " New module list after sourcing of ARCH/arch.env file:" >> $outfile |
---|
| 205 | module list >> $outfile 2>&1 |
---|
| 206 | fi |
---|
| 207 | |
---|
| 208 | #### 2 Do the compilation |
---|
| 209 | ## 2.1 Compile ioipsl |
---|
| 210 | cd $modipsl/modeles/IOIPSL |
---|
| 211 | echo; echo "NOW COMPILE IOIPSL" |
---|
| 212 | echo >> $outfile ; echo " NOW COMPILE IOIPSL" >> $outfile |
---|
| 213 | |
---|
| 214 | # Check if compilation with fcm is included in IOIPSL |
---|
| 215 | if [ ! -f makeioipsl_fcm ] ; then |
---|
| 216 | echo "The file makeiopsl_fcm do not exist. Probably this is not the right version of IOIPSL." |
---|
| 217 | echo "Version of IOIPSL with fcm compilation is needed to compile with this script. Stop now." |
---|
| 218 | exit |
---|
| 219 | fi |
---|
| 220 | |
---|
| 221 | echo ./makeioipsl_fcm -$optmode -parallel -arch ${fcm_arch} -arch_path $arch_path -j 8 $full_flag >> $outfile |
---|
| 222 | ./makeioipsl_fcm -$optmode -parallel -arch ${fcm_arch} -arch_path $arch_path -j 8 $full_flag >> $outfile 2>&1 |
---|
| 223 | # Test if compiling succeded |
---|
| 224 | if [[ $? != 0 ]] ; then |
---|
| 225 | echo "THERE IS A PROBLEM IN IOIPSL COMPILATION - STOP" |
---|
| 226 | exit |
---|
| 227 | fi |
---|
| 228 | |
---|
| 229 | ## 2.2 Compile oasis3-mct |
---|
| 230 | cd $modipsl/oasis3-mct/util/make_dir |
---|
| 231 | echo; echo "NOW COMPILE OASIS3-MCT" |
---|
| 232 | echo >> $outfile ; echo " NOW COMPILE OASIS3-MCT" >> $outfile |
---|
| 233 | cp $mysrc_path/OASIS3-MCT/make_${fcm_arch} make.inc |
---|
| 234 | |
---|
| 235 | echo make -f TopMakefileOasis3 >> $outfile |
---|
| 236 | make -f TopMakefileOasis3 >> $outfile 2>&1 |
---|
| 237 | |
---|
| 238 | |
---|
| 239 | ## 2.3 Compile xios |
---|
| 240 | cd $modipsl/modeles/XIOS |
---|
| 241 | echo; echo "NOW COMPILE XIOS" |
---|
| 242 | echo >> $outfile ; echo " NOW COMPILE XIOS" >> $outfile |
---|
| 243 | echo ./make_xios --use_oasis oasis3_mct --$optmode --arch $fcm_arch --arch_path $arch_path --job 4 $full_xios >> $outfile |
---|
| 244 | ./make_xios --use_oasis oasis3_mct --$optmode --arch $fcm_arch --arch_path $arch_path --job 4 $full_xios >> $outfile 2>&1 |
---|
| 245 | # Test if compiling succeded |
---|
| 246 | if [[ $? != 0 ]] ; then |
---|
| 247 | echo "THERE IS A PROBLEM IN XIOS COMPILATION - STOP" |
---|
| 248 | exit |
---|
| 249 | fi |
---|
| 250 | # Move executables to modipsl/bin |
---|
| 251 | if [ -f $modipsl/modeles/XIOS/bin/xios_server.exe ] ; then |
---|
| 252 | mv $modipsl/modeles/XIOS/bin/xios_server.exe $modipsl/bin/xios_server_${optmode}.exe |
---|
| 253 | else |
---|
| 254 | echo "THERE IS A PROBLEM IN XIOS COMPILATION EXECUTABLE MISSING - STOP" |
---|
| 255 | exit |
---|
| 256 | fi |
---|
| 257 | |
---|
| 258 | |
---|
| 259 | ## 2.4 Compile orchidee |
---|
| 260 | cd $modipsl/modeles/ORCHIDEE |
---|
| 261 | echo; echo "NOW COMPILE ORCHIDEE" |
---|
| 262 | echo >> $outfile ; echo " NOW COMPILE ORCHIDEE" >> $outfile |
---|
| 263 | |
---|
| 264 | # Check if the compilation of ORCHIDEE was previsouly interupted prematured. |
---|
| 265 | # In that case, the files fcm.bld.lock exist. If the file exist, it is here removed to avoid makeorchidee_fcm |
---|
| 266 | # to ask question and wait for interactivly answer from the user. |
---|
| 267 | if [ -f build/fcm.bld.lock ] ; then |
---|
| 268 | echo >> $outfile |
---|
| 269 | echo " WARNING!! The file ORCHIDEE/build/fcm.bld.lock exist. " >> $outfile |
---|
| 270 | echo " This means that the compilation is either currently on going in another terminal was previous interupted before the end." >> $outfile |
---|
| 271 | echo " The file will now be removed. " >> $outfile |
---|
| 272 | echo >> $outfile |
---|
| 273 | rm -f build/fcm.bld.lock |
---|
| 274 | fi |
---|
| 275 | |
---|
| 276 | echo ./makeorchidee_fcm -j 8 -xios -parallel $parallel -$optmode -arch ${fcm_arch} -arch_path $arch_path $full_orch >> $outfile |
---|
| 277 | ./makeorchidee_fcm -j 8 -xios -parallel $parallel -$optmode -arch ${fcm_arch} -arch_path $arch_path $full_orch >> $outfile 2>&1 |
---|
| 278 | # Test if compiling finished |
---|
| 279 | if [[ $? != 0 ]] ; then |
---|
| 280 | echo "THERE IS A PROBLEM IN ORCHIDEE COMPILATION - STOP" |
---|
| 281 | exit |
---|
| 282 | fi |
---|
| 283 | |
---|
| 284 | |
---|
| 285 | ## 2.5 Compile NEMO |
---|
| 286 | nemo_root=$modipsl/modeles/NEMOGCM/CONFIG |
---|
| 287 | if [ ${icemodel} == lim2 ] ; then |
---|
| 288 | addkeys="key_lim2_vp key_diahth key_oasis3" |
---|
| 289 | delkeys="key_nosignedzero key_mpp_rep" |
---|
| 290 | else |
---|
[6570] | 291 | addkeys="key_top key_pisces key_age key_cfc key_cpl_carbon_cycle key_gas key_oasis3" |
---|
[5555] | 292 | if [ ${oceanbio} == y ] ; then |
---|
| 293 | if [ ${esmco2} == y ] ; then |
---|
[6550] | 294 | if [ ${esmchem} == y ] ; then |
---|
[6533] | 295 | delkeys="key_nosignedzero key_mpp_rep" |
---|
| 296 | else |
---|
[6570] | 297 | delkeys="key_nosignedzero key_mpp_rep" |
---|
[6533] | 298 | fi |
---|
[5555] | 299 | else |
---|
[6570] | 300 | delkeys="key_nosignedzero key_mpp_rep key_cpl_carbon_cycle key_gas" |
---|
[5555] | 301 | fi |
---|
| 302 | else |
---|
[6570] | 303 | delkeys="key_nosignedzero key_mpp_rep key_top key_pisces key_cfc key_age key_cpl_carbon_cycle key_gas" |
---|
[5555] | 304 | fi |
---|
| 305 | fi |
---|
| 306 | |
---|
| 307 | if [ ${oceanbio} == n ] ; then |
---|
| 308 | echo; echo "NOW COMPILE NEMO. Resolution = ${resol_oce} with icemodel ${icemodel} and without PISCES" |
---|
| 309 | echo >> $outfile ; echo " NOW COMPILE NEMO. Resolution = ${resol_oce} with icemodel ${icemodel} and without PISCES" >> $outfile |
---|
| 310 | else |
---|
| 311 | echo; echo "NOW COMPILE NEMO. Resolution = ${resol_oce} with icemodel ${icemodel} and PISCES" |
---|
| 312 | echo >> $outfile ; echo " NOW COMPILE NEMO. Resolution = ${resol_oce} with icemodel ${icemodel} and PISCES" >> $outfile |
---|
| 313 | fi |
---|
| 314 | echo >> $outfile ; echo cd $nemo_root >> $outfile |
---|
| 315 | echo >> $outfile ; echo cp $modipsl/config/IPSLCM6/SOURCES/NEMO/arch-${fcm_arch}.fcm ../ARCH/. >> $outfile |
---|
| 316 | echo >> $outfile |
---|
| 317 | |
---|
| 318 | cd $nemo_root ; cp $mysrc_path/NEMO/arch-${fcm_arch}.fcm ../ARCH/. |
---|
| 319 | |
---|
[6571] | 320 | |
---|
[5555] | 321 | if [ ${resol_oce} == ORCA2 ] ; then cfg_wrk=ORCA2_LIM_PISCES ; fi |
---|
| 322 | if [ ${resol_oce} == ORCA1 ] ; then cfg_wrk=ORCA1_LIM3_PISCES ; fi |
---|
| 323 | if [ ${resol_oce} == ORCA025 ] ; then cfg_wrk=ORCA025_LIM3_PISCES ; fi |
---|
| 324 | |
---|
[6571] | 325 | |
---|
[5555] | 326 | echo cp $modipsl/config/IPSLCM6/SOURCES/NEMO/*.*90 $nemo_root/$cfg_wrk/MY_SRC/ >> $outfile |
---|
| 327 | echo >> $outfile |
---|
| 328 | cp $mysrc_path/NEMO/*.*90 $nemo_root/$cfg_wrk/MY_SRC/ |
---|
| 329 | |
---|
| 330 | if [ $full_nemo == y ] ; then |
---|
| 331 | # To make a full compilation, first make a clean to remove all files produced during previous compilation |
---|
| 332 | echo ./makenemo -m ${fcm_arch} -n $cfg_wrk clean >> $outfile |
---|
| 333 | echo >> $outfile |
---|
| 334 | ./makenemo -m ${fcm_arch} -n $cfg_wrk clean >> $outfile 2>&1 |
---|
| 335 | fi |
---|
| 336 | echo ./makenemo -m ${fcm_arch} -n $cfg_wrk -j16 add_key "$addkeys" del_key "$delkeys" >> $outfile |
---|
| 337 | echo >> $outfile |
---|
| 338 | ./makenemo -m ${fcm_arch} -n $cfg_wrk -j16 add_key "$addkeys" del_key "$delkeys" >> $outfile 2>&1 |
---|
| 339 | |
---|
| 340 | |
---|
| 341 | # Test if compiling finished |
---|
| 342 | if [[ $? != 0 ]] ; then |
---|
| 343 | echo "THERE IS A PROBLEM IN NEMO COMPILATION - STOP" |
---|
| 344 | exit |
---|
| 345 | fi |
---|
| 346 | |
---|
| 347 | echo >> $outfile |
---|
| 348 | echo "Move nemo executable to modipsl/bin" >> $outfile |
---|
| 349 | echo ls -lrt $nemo_root/$cfg_wrk/BLD/bin >> $outfile |
---|
| 350 | ls -lrt $nemo_root/$cfg_wrk/BLD/bin >> $outfile |
---|
| 351 | echo >> $outfile |
---|
| 352 | |
---|
| 353 | if [ -f $nemo_root/$cfg_wrk/BLD/bin/nemo.exe ] ; then |
---|
[6550] | 354 | if [ ${esmco2} == y ] && [ ${esmchem} == n ] ; then |
---|
[5555] | 355 | mv $nemo_root/$cfg_wrk/BLD/bin/nemo.exe $modipsl/bin/opa.ESMCO2_${resol_oce}_${optmode} |
---|
[6550] | 356 | elif [ ${esmco2} == y ] && [ ${esmchem} == y ] ; then |
---|
[6533] | 357 | mv $nemo_root/$cfg_wrk/BLD/bin/nemo.exe $modipsl/bin/opa.ESMCO2AER_${resol_oce}_${optmode} |
---|
[5555] | 358 | else |
---|
| 359 | mv $nemo_root/$cfg_wrk/BLD/bin/nemo.exe $modipsl/bin/opa_${resol_oce}_${optmode} |
---|
| 360 | fi |
---|
| 361 | fi |
---|
| 362 | |
---|
| 363 | |
---|
| 364 | ## 2.6 Compile LMDZ for regular latlon configuration |
---|
| 365 | # If necessary compile INCA modele with AER configuration |
---|
[6550] | 366 | if [ ${esmchem} == y ] ; then |
---|
[5555] | 367 | cd $modipsl/modeles/INCA |
---|
[6533] | 368 | #compile INCA regulat lat_lon chimie library |
---|
[6570] | 369 | echo; echo "NOW COMPILE INCA ${optchimie} on resolution = ${resol_atm}" |
---|
| 370 | echo ./makeinca_fcm -chimie ${optchimie} -$optmode -xios -parallel mpi_omp -j 8 -arch ${fcm_arch} -arch_path $arch_path $full_flag $full_inca -cplocninca >> $outfile |
---|
| 371 | ./makeinca_fcm -chimie ${optchimie} -$optmode -xios -parallel mpi_omp -j 8 -arch ${fcm_arch} -arch_path $arch_path $full_flag $full_inca -cplocninca >> $outfile 2>&1 |
---|
| 372 | |
---|
[5555] | 373 | # Test if compiling finished |
---|
| 374 | if [[ $? != 0 ]] ; then |
---|
| 375 | echo "THERE IS A PROBLEM IN INCA COMPILATION - STOP" |
---|
| 376 | exit |
---|
| 377 | fi |
---|
| 378 | |
---|
| 379 | echo "Move inca.dat modipsl/bin" |
---|
[6550] | 380 | if [[ -f $modipsl/modeles/INCA/SIMULATIONS/$optchimie/inca.dat ]] ; then |
---|
| 381 | mv $modipsl/modeles/INCA/SIMULATIONS/$optchimie/inca.dat $modipsl/bin/inca_${optchimie}.dat ; |
---|
[5555] | 382 | else |
---|
| 383 | echo "THERE IS A PROBLEM IN INCA COMPILATION - STOP" |
---|
| 384 | exit |
---|
| 385 | fi |
---|
[6550] | 386 | |
---|
| 387 | echo "Move tracer.def to modipsl/bin" |
---|
| 388 | if [[ -f $modipsl/modeles/INCA/tracer.def ]] ; then |
---|
| 389 | mv $modipsl/modeles/INCA/tracer.def $modipsl/bin/tracer_${optchimie}.def ; |
---|
| 390 | fi |
---|
| 391 | |
---|
| 392 | |
---|
| 393 | |
---|
[5555] | 394 | fi |
---|
| 395 | |
---|
| 396 | |
---|
| 397 | # Compile LMDZ regular lat-lon executable |
---|
| 398 | cd $modipsl/modeles/LMDZ |
---|
| 399 | echo; echo "NOW COMPILE LMDZ REGULAR LAT-LON MODE. Resolution = ${resol_atm}" |
---|
| 400 | echo >> $outfile ; echo " NOW COMPILE LMDZ REGULAR LAT-LON MODE. Resolution = ${resol_atm}" >> $outfile |
---|
| 401 | |
---|
[6571] | 402 | # Temporary use of SOURCES/LMDZ to handle modifications needed by LMDZ rev 4515 |
---|
| 403 | cp $mysrc_path/LMDZ/*.*90 libf/phylmd/. |
---|
| 404 | |
---|
| 405 | |
---|
[5555] | 406 | # Check if the compilation of LMDZ was previsouly interupted prematured. |
---|
| 407 | # In that case, the files dimension.h and .lock exist. If the files exist, they are here removed to avoid makelmdz_fcm |
---|
| 408 | # to ask question and wait for interactivly answer from the user. |
---|
| 409 | if [ -f libf/grid/dimensions.h ] || [ -f .lock ] ; then |
---|
| 410 | echo >> $outfile |
---|
| 411 | echo " WARNING!! The file LMDZ/libf/grid/dimension.h and/or the LMDZ/.lock exist. " >> $outfile |
---|
| 412 | echo " This means that the compilation is either currently on going in another terminal was previous interupted before the end." >> $outfile |
---|
| 413 | echo " The files dimension.h and .lock will now be removed. " >> $outfile |
---|
| 414 | echo >> $outfile |
---|
| 415 | rm -f libf/grid/dimensions.h |
---|
| 416 | rm -f .lock |
---|
| 417 | fi |
---|
| 418 | |
---|
[6533] | 419 | # Need to define the proper option for radiative code compilation. By default, we use rrtm |
---|
| 420 | case $rad in |
---|
| 421 | oldrad) opt_rad="" ;; |
---|
[6550] | 422 | rrtm) opt_rad="-rad rrtm" ;; |
---|
[6533] | 423 | ecrad) opt_rad="-rad ecrad" ;; |
---|
| 424 | *) echo Only oldrad rrtm ecrad for rad option ; exit |
---|
| 425 | esac |
---|
| 426 | |
---|
[6550] | 427 | if [ ${esmchem} == n ] ; then |
---|
[6533] | 428 | echo ./makelmdz_fcm -d ${resol_atm} -c OMCT -cosp true $opt_rad -$optmode -mem -parallel $parallel -io xios -v orchidee2.1 -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz gcm >> $outfile |
---|
[6550] | 429 | ./makelmdz_fcm -d ${resol_atm} -c OMCT -cosp true $opt_rad -$optmode -mem -parallel $parallel -io xios -v orchidee2.1 -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz gcm >> $outfile 2>&1 |
---|
[5555] | 430 | else |
---|
[6533] | 431 | #in esm aer case add chemistry option to lmdz compilation |
---|
[6570] | 432 | echo ./makelmdz_fcm -d ${resol_atm} -c OMCT -cosp true $opt_rad -rrtm true -$optmode -mem -parallel $parallel -chimie INCA -io xios -v orchidee2.1 -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz gcm >> $outfile |
---|
| 433 | ./makelmdz_fcm -d ${resol_atm} -c OMCT -cosp true $opt_rad -rrtm true -$optmode -mem -parallel $parallel -chimie INCA -io xios -v orchidee2.1 -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz gcm >> $outfile 2>&1 |
---|
[6533] | 434 | fi |
---|
| 435 | |
---|
[5555] | 436 | # Test if compiling finished |
---|
| 437 | if [[ $? != 0 ]] ; then |
---|
| 438 | echo "THERE IS A PROBLEM IN LMDZ REGULAR LATLON COMPILATION - STOP" |
---|
| 439 | exit |
---|
| 440 | fi |
---|
| 441 | |
---|
[6533] | 442 | |
---|
[5555] | 443 | # Move executables to modipsl/bin folder |
---|
| 444 | echo >> $outfile |
---|
| 445 | echo "Move gcm.e executable to modipsl/bin" >> $outfile |
---|
| 446 | echo ls -lrt $modipsl/modeles/LMDZ/bin >> $outfile |
---|
| 447 | ls -lrt $modipsl/modeles/LMDZ/bin >> $outfile |
---|
| 448 | echo >> $outfile |
---|
[6533] | 449 | |
---|
| 450 | |
---|
| 451 | suffix=_${resol_atm}_phylmd |
---|
[6550] | 452 | suffix=${suffix}_${rad} |
---|
[6533] | 453 | suffix=${suffix}_para_mem_orch_couple |
---|
[6550] | 454 | if [ ${esmchem} == n ] ; then |
---|
[6533] | 455 | suffix=${suffix}.e |
---|
[5555] | 456 | else |
---|
[6533] | 457 | suffix=${suffix}_inca.e |
---|
[5555] | 458 | fi |
---|
[6533] | 459 | |
---|
[5555] | 460 | echo gcm suffix = $suffix |
---|
| 461 | |
---|
| 462 | if [ -f $modipsl/modeles/LMDZ/bin/gcm${suffix} ] ; then |
---|
[6550] | 463 | if [ ${esmchem} == n ] ; then |
---|
[5555] | 464 | mv $modipsl/modeles/LMDZ/bin/gcm${suffix} $modipsl/bin/gcm_${resol_atm}_${optmode}.e |
---|
| 465 | else |
---|
[6550] | 466 | mv $modipsl/modeles/LMDZ/bin/gcm${suffix} $modipsl/bin/gcm_${resol_atm}_${optmode}_${optchimie}.e |
---|
[5555] | 467 | fi |
---|
| 468 | else |
---|
| 469 | echo "ERROR gcm${suffix} executable does not exist." |
---|
| 470 | echo "THERE IS A PROBLEM IN LMDZ REGULAR LATLON COMPILATION - STOP" |
---|
| 471 | exit |
---|
| 472 | fi |
---|
| 473 | |
---|
| 474 | |
---|
[6533] | 475 | |
---|
| 476 | |
---|
| 477 | |
---|
[5555] | 478 | # Compile ce0l initialization program for LMDZ regular lat-lon exectuable |
---|
| 479 | if [ $ce0l == y ] ; then |
---|
| 480 | echo; echo "NOW COMPILE CE0L OF LMDZ. Resolution = ${resol_atm}" |
---|
| 481 | echo >> $outfile ; echo " NOW COMPILE CE0L OF LMDZ. Resolution = ${resol_atm}" >> $outfile |
---|
| 482 | |
---|
[6533] | 483 | echo ./makelmdz_fcm -d ${resol_atm} $opt_rad -$optmode -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz ce0l >> $outfile |
---|
| 484 | ./makelmdz_fcm -d ${resol_atm} $opt_rad -$optmode -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz ce0l >> $outfile 2>&1 |
---|
| 485 | |
---|
| 486 | # 1er aout - remove xios from ce0l compilation # |
---|
| 487 | # echo ./makelmdz_fcm -d ${resol_atm} $opt_rad -$optmode -io xios -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz ce0l >> $outfile |
---|
| 488 | # ./makelmdz_fcm -d ${resol_atm} $opt_rad -$optmode -io xios -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz ce0l >> $outfile 2>&1 |
---|
| 489 | |
---|
[5555] | 490 | # Test if compiling finished |
---|
| 491 | if [[ $? != 0 ]] ; then |
---|
| 492 | echo "THERE IS A PROBLEM IN CE0L (LMDZ) REGULAR LATLON COMPILATION - STOP" |
---|
| 493 | exit |
---|
| 494 | fi |
---|
| 495 | |
---|
| 496 | |
---|
| 497 | # Move executables to modipsl/bin folder |
---|
| 498 | echo >> $outfile |
---|
| 499 | echo "Move ce0l.e executable to modipsl/bin" >> $outfile |
---|
| 500 | echo ls -lrt $modipsl/modeles/LMDZ/bin >> $outfile |
---|
| 501 | ls -lrt $modipsl/modeles/LMDZ/bin >> $outfile |
---|
| 502 | echo >> $outfile |
---|
[6533] | 503 | |
---|
[5555] | 504 | suffix=_${resol_atm}_phylmd_seq.e |
---|
[6533] | 505 | if [ $lmdzsvn -ge 4186 ] ; then suffix=_${resol_atm}_phylmd_${rad}_seq.e ; fi |
---|
[5555] | 506 | echo ce0l suffix = $suffix |
---|
| 507 | |
---|
| 508 | if [ -f $modipsl/modeles/LMDZ/bin/ce0l${suffix} ] ; then |
---|
| 509 | mv $modipsl/modeles/LMDZ/bin/ce0l${suffix} $modipsl/bin/ce0l_${resol_atm}_${optmode}.e |
---|
| 510 | else |
---|
| 511 | echo "ERROR ce0l${suffix} executable does not exist." |
---|
| 512 | echo "THERE IS A PROBLEM IN CE0L (LMDZ) REGULAR LATLON COMPILATION - STOP" |
---|
| 513 | exit |
---|
| 514 | fi |
---|
| 515 | fi |
---|
| 516 | |
---|
| 517 | echo >>$outfile ; echo "ALL COMPILING FINISHED" >> $outfile |
---|
| 518 | echo ls -lrt modipsl/bin >> $outfile |
---|
| 519 | ls -lrt $modipsl/bin >> $outfile |
---|
| 520 | |
---|
| 521 | echo; echo "ALL COMPILING FINISHED" ; echo |
---|
| 522 | echo "Executables are found in modipsl/bin" |
---|
| 523 | echo "Check that executable names correspond with the name set in config.card before launching the job" |
---|
| 524 | echo ls -lrt modipsl/bin |
---|
| 525 | ls -lrt $modipsl/bin |
---|
| 526 | |
---|
| 527 | date |
---|
| 528 | |
---|
| 529 | exit |
---|
| 530 | |
---|
| 531 | |
---|