source: CONFIG/UNIFORM/v7/IPSLCM7ISO/compile_lmdziso.sh @ 6803

Last change on this file since 6803 was 6746, checked in by snguyen, 4 months ago

update IPSLCM7ISO with LMDZISO amip experiment

  • Property svn:executable set to *
File size: 27.4 KB
Line 
1#!/bin/bash
2# Default options
3#
4#
5#
6date
7#### 1  Set up the compiling options
8#### Define some directories
9submitdir=$( pwd )
10modipsl=$submitdir/../..
11arch_path=$submitdir/ARCH
12mysrc_path=$submitdir/SOURCES
13export ROOT=$modipsl/modeles/IOIPSL
14#$modipsl/modeles/DYNAMICO
15#### Set default options
16# Activate compilation of LMDZ for regular latlon grid without DYNAMICO
17regular_latlon=y
18# Atmospheric resolution for regular grid for LMDZ/ORCHIDEE, if regular_latlon=y
19resol_atm=144x142x79
20# Coupled with ocean biogeochemistry (y/n)
21nemotop=y
22# Optimization mode
23# optmode=prod/dev/debug
24optmode=prod
25# fcm_arch
26fcm_arch=default
27# Default values to be overritten
28parallel=mpi_omp
29export fcm_arch parallel xios
30full_flag=""
31full_nemo=n
32full_inca=""
33full_xios=""
34full_lmdz=""
35full_orch=""
36full_dyna=""
37full_oasis=n
38# choose radiative code compilation option
39rad=rrtm
40opt_rad=""
41#choose chemistry inca configuration
42optchimie=GES
43
44# subconfig : which sub-configuration to compile. By default, the full extracted configuration is compiled.
45subconfig=LMDZISO
46
47# orchversion tells if ORCHIDEE_2_2 or ORCHIDEE_4 is compiled. This is used as argument and also in the suffix of the executables.
48orchversion=orch22
49# orchdriver : Permet to compile the ORCHIDEE offline drivers. This option is activated by setting -orchdriver as argument.
50# Drivers are now compiled by default
51orchdriver="-driver -oasisdriver"
52
53# Default netcdf_lib is used for XIOS but can be change by argument
54netcdf_lib=""
55
56# Output text file for compilation of each component
57datestr=`LC_ALL=C date +"%Y%m%dT%H%M"`
58outfile=$submitdir/out_compile_lmdziso.$datestr
59echo > $outfile
60echo; echo "Text output from compilation will be stored in file out_compile_lmdziso.$datestr"; echo
61
62
63rm -f out_compile_lmdziso
64ln -s ${outfile} out_compile_lmdziso
65
66
67#### Read arguments
68# Loop over all arguments to modify default set up
69while (($# > 0)) ; do
70    case $1 in
71        "-h"|"-help") cat <<end_help
72########################################################################
73# Usage of the script compile_lmdziso.sh
74#
75########################################################################
76
77./compile_lmdziso.sh [Options]
78
79Description of all options:
80
81[-full] Full recompilation of all components. This option can be added to all other options.
82[-cleannemo] Full recompilation of NEMO component only.
83[-regular_latlon yes/no] Activate or deactivate compilation of LMDZ dynamics for regular latlon grid.
84                         Default resol_atm size is used. This option is set in addition to the compilation of the icosahedric grid.
85[-resol_atm XXXxYYYxZZ] Define which regular grid to compile. A default grid is set if this option is not used.
86[-debug / -dev / -prod] Level of optimization. One of these can be added to all other compile options. Default: -prod.
87[-subconfig X] Set this option if you want to compile a sub-configuration. X can be one of following sub-configurations :
88               ICOLMDZORINCA, ICOLMDZOR, LMDZORINCA, LMDZOR, LMDZISO, IPSLCM-reg or IPSLCM
89               By default, all available components are compiled.
90[-orch4 / -orch22] Choice of ORCHIDEE version. The source code are found in modeles/ORCHIDEE_4 or modeles/ORCHIDEE_2_2
91                   and a link will be set to the choosen model version. Default version is currently ORCHIDEE_2_2 (-orch22).
92[-orchdriver]   Activate compilation of orchidee offline drivers
93
94Example 1: Default compilation of LMDZISO
95./compile_lmdziso.sh
96
97Example 2: Default compilation in debug mode
98./compile_lmdziso.sh -debug
99
100Example 3: Default compilation with full recompilation of all components. No clean is needed.
101./compile_lmdziso.sh -full
102
103Example 4: Compilation in addition of LMDZ in regular lat-lon for a specific resolution :
104./compile_lmdziso.sh -resol_atm 144x142x95
105
106Example 5: Compilation without regular grid (only icosaedric grid)
107./compile_lmdziso.sh -regular_latlon no
108
109Example 5: Compilation of ORCHIDEE_4 version
110./compile_lmdziso.sh -orch4
111
112Example 6: compilation of a specific chemistry for INCA (default is GES)
113./compile_lmdziso.sh -chimie NMHC_AER_S
114
115Example 7: Compilation of sub-configuration LMDZOR :
116./compile_lmdziso.sh -subconfig LMDZOR
117
118end_help
119            exit;;
120
121        "-parallel")   parallel=$2 ; shift ; shift ;;
122        "-arch")       fcm_arch="$2" ; shift ; shift ;;
123        "-debug")      optmode=debug ; shift ;;
124        "-dev")        optmode=dev ; shift ;;
125        "-prod")       optmode=prod ; shift ;;
126        "-regular_latlon")  regular_latlon=$2 ; shift ; shift ;;
127        "-resol_atm")  regular_latlon=y ; resol_atm=$2 ; shift ; shift ;;
128        "-subconfig")  subconfig=$2 ; shift ; shift ;;
129        "-full")       full_flag="-full"; full_nemo=y ; full_xios="--full" ; full_lmdz="-full" ; full_orch="-full" ; full_oasis=y ; full_inca="-clean" ; full_dyna="-full" ; shift ;;
130        "-full_xios")  full_xios="--full" ; shift ;;  # Note only full_xios is using double dash: --full
131        "-full_lmdz")  full_lmdz="-full"  ; shift ;;
132        "-full_orch")  full_orch="-full"  ; shift ;;
133        "-full_nemo")  full_nemo=y ; shift ;;
134        "-full_inca")  full_inca="-clean"; shift ;;
135        "-full_dyna")  full_dyna="-full" ; shift ;;
136        "-full_oasis") full_oasis=y ; shift ;;
137        "-cleannemo")  full_nemo=y ; shift ;;
138        "-rad")        rad=$2; shift ; shift ;;
139        "-orch22")     orchversion="orch22"; shift ;;
140        "-orch4")      orchversion="orch4"shift ;;
141        "-orchdriver") orchdriver="-driver"shift ;;
142        "-chimie")     optchimie=$2; shift ; shift;;
143        *)             echo "unknown option "$1" , exiting..." ; exit
144    esac
145done
146
147
148# Define which sub-configuration to compile. By default all extracted source components are compiled.
149source define_config_iso.sh
150
151echo "Following options are set in current compiling:" >> $outfile
152echo "   regular_latlon=$regular_latlon (if yes, then resol_atm=${resol_atm})" >> $outfile 
153echo "   resol_atm=${resol_atm}, nemotop=${nemotop}" >> $outfile 
154echo "   optmode = $optmode, parallel = $parallel, fcm_arch = $fcm_arch " >> $outfile 
155echo "   full_flag=$full_flag, full_xios=$full_xios, full_lmdz=$full_lmdz, full_orch=$full_orch, full_nemo=$full_nemo, full_dyna=$full_dyna, full_oasis=$full_oasis" >> $outfile 
156echo "   compinca=$compinca compnemo=$compnemo compoasis=$compoasis compdyna=$compdyna complmdz=y comporch=y compxios=y compiso=$compiso" >> $outfile
157echo >> $outfile
158### Verification of argument
159# Set argorch depending on the version of ORCHIDEE. This argument is needed for the compilation of LMDZ to consider coherent interface.
160if [ $orchversion == orch22 ] ; then
161    argorch=orchidee2.1
162elif [ $orchversion == orch4 ] ; then
163    argorch=orchideetrunk
164else
165    echo "ERROR in version of ORCHIDEE. It is only possible to have orch22 or orch4 for now"
166fi
167
168### Read host dependent default values
169### These variables will not be changed if they were set as argument
170###./host.sh $host
171# Later : Following lines should be set in host.sh file
172# begin host.sh
173if [ $fcm_arch == default ] ; then
174    # Find out current host and source specific paths and commands for the host
175    case $( hostname -s ) in
176        jean-zay*)
177            if [[ $( hostname -s ) != *"pp"* ]] ; then
178                echo "Warning! You MUST compile on jean-zay-pp."
179                echo "EXIT"
180                exit
181            else
182                fcm_arch=X64_JEANZAY
183            fi ;;
184        irene170|irene171|irene190|irene191|irene192|irene193)
185            fcm_arch=X64_IRENE;;
186        irene172|irene173|irene194|irene195)
187            fcm_arch=X64_IRENE-AMD;;
188        asterix*|obelix*)
189            fcm_arch=ifort_LSCE
190            if [ "${parallel}" == "mpi_omp" ] ; then
191                echo "Warning!! Currently at Obelix hybrid mode is not possible."
192                echo "          Option -parallel mpi_omp is now changed to -parallel mpi"
193                echo ""
194                parallel=mpi
195            else
196                echo "You used -parallel" $parallel
197            fi ;;
198        spirit*)
199            fcm_arch=ifort_MESOIPSL;;
200        ciclad*|climserv*|loholt*|camelot*)
201            fcm_arch=ifort_CICLAD;;
202        *)
203            echo Current host is not known. You must use option -arch to specify which architecuture files to use.
204            echo Exit now.
205            exit
206    esac
207fi
208
209# Set a link to arch.env if arch-${fcm_arch}.env file exist for current fcm_arch.
210# The link arch.env is also set in config.card and will be used by libIGCM to ensure the same running environnement.
211if [ -f ARCH/arch-${fcm_arch}.env ] ; then
212    echo >> $outfile
213    echo "The file ARCH/arch-${fcm_arch}.env will now be sourced with modules needed for compilation for all components."
214    echo "Note that this new environement might be kept after compilation."
215    echo "If this is the case, source again your personal environment after compilation."
216    echo " Personal module list before sourcing of ARCH/arch.env file:"    >> $outfile 
217    module list   >> $outfile 2>&1
218    svn_version=$(module list -t | grep subversion)
219       
220    # Make a link to this file, to be used also in config.card
221    rm -f ARCH/arch.env
222    ln -s arch-${fcm_arch}.env ARCH/arch.env
223
224    # Source the file
225    source ARCH/arch.env   >> $outfile 2>&1
226    if [ X$svn_version != X ] ; then
227        module load ${svn_version}
228    fi
229    echo >> $outfile
230    echo " New module list after sourcing of ARCH/arch.env file:"    >> $outfile 
231    module list   >> $outfile 2>&1
232fi
233
234
235#### Clean if full_orch
236# If full recompilation of ORCHIDEE then first clean modipsl/lib folder
237if [ X${full_orch} == X"-full" ] ; then
238   rm -f $modipsl/lib/*
239fi
240
241#### 2 Do the compilation
242## 2.1 Compile ioipsl
243cd $modipsl/modeles/IOIPSL
244echo; echo "NOW COMPILE IOIPSL"
245echo >> $outfile ; echo " NOW COMPILE IOIPSL"   >> $outfile 
246
247echo ./makeioipsl_fcm -$optmode -parallel -arch ${fcm_arch} -arch_path $arch_path -j 8 $full_flag   >> $outfile 
248     ./makeioipsl_fcm -$optmode -parallel -arch ${fcm_arch} -arch_path $arch_path -j 8 $full_flag   >> $outfile 2>&1
249# Test if compiling succeded
250if [[ $? != 0 ]] ; then
251    echo "THERE IS A PROBLEM IN IOIPSL COMPILATION - STOP"
252    exit
253fi
254
255if [ $compoasis == y ] ; then
256## 2.2 Compile oasis3-mct
257if [ $full_oasis == y ] ; then
258    rm -rf $modipsl/oasis3-mct/BLD
259fi
260cd $modipsl/oasis3-mct/util/make_dir
261echo; echo "NOW COMPILE OASIS3-MCT"
262echo >> $outfile ; echo " NOW COMPILE OASIS3-MCT"   >> $outfile
263cp $mysrc_path/OASIS3-MCT/make_${fcm_arch} make.inc
264
265echo make -f TopMakefileOasis3 >> $outfile
266     make -f TopMakefileOasis3 >> $outfile 2>&1
267if [[ $? != 0 ]] ; then
268    echo "THERE IS A PROBLEM IN OASIS COMPILATION - STOP"
269    exit
270fi
271 
272
273else
274echo ; echo No compilation of OASIS
275fi
276
277## 2.3 Compile xios
278cd $modipsl/modeles/XIOS
279echo; echo "NOW COMPILE XIOS"
280echo >> $outfile ; echo " NOW COMPILE XIOS"   >> $outfile 
281if [ $compoasis == y ] ; then
282argoasis="--use_oasis oasis3_mct "
283else
284argoasis=" "
285fi
286echo ./make_xios $argoasis --$optmode --arch $fcm_arch --arch_path $arch_path ${netcdf_lib} --job 4 $full_xios   >> $outfile 
287     ./make_xios $argoasis --$optmode --arch $fcm_arch --arch_path $arch_path ${netcdf_lib} --job 4 $full_xios   >> $outfile 2>&1
288# Test if compiling succeded
289if [[ $? != 0 ]] ; then
290    echo "THERE IS A PROBLEM IN XIOS COMPILATION - STOP"
291    exit
292fi
293# Move executables to modipsl/bin
294if [ -f $modipsl/modeles/XIOS/bin/xios_server.exe ] ; then
295    mv $modipsl/modeles/XIOS/bin/xios_server.exe $modipsl/bin/xios_server_${optmode}.exe
296else
297    echo "THERE IS A PROBLEM IN XIOS COMPILATION EXECUTABLE MISSING - STOP"
298    exit
299fi
300
301
302## 2.4 Compile ORCHIDEE
303# Choose ORCHIDEE version to compile and create a link to generic folder name ORCHIDEE.
304# This link is needed for the compilation of ICOSA_LMDZ for it to find the orchidee librarie.
305cd $modipsl/modeles
306rm -f ORCHIDEE
307if [ $orchversion == orch22 ] ; then
308    ln -s ORCHIDEE_2_2 ORCHIDEE
309    cd $modipsl/modeles/ORCHIDEE_2_2
310    echo; echo "NOW COMPILE ORCHIDEE_2_2"
311    echo >> $outfile ; echo " NOW COMPILE ORCHIDEE_2_2"   >> $outfile 
312else
313    ln -s ORCHIDEE_4 ORCHIDEE
314    cd $modipsl/modeles/ORCHIDEE_4
315    echo; echo "NOW COMPILE ORCHIDEE_4 (trunk)"
316    echo >> $outfile ; echo " NOW COMPILE ORCHIDEE_4 (trunk)"   >> $outfile 
317fi
318
319# Check if the compilation of ORCHIDEE was previsouly interupted prematured.
320# In that case, the files fcm.bld.lock exist. If the file exist, it is here removed to avoid makeorchidee_fcm
321# to ask question and wait for interactivly answer from the user.
322if [ -f build/fcm.bld.lock ] ; then
323    echo >> $outfile
324    echo " WARNING!! The file ORCHIDEE/build/fcm.bld.lock exist. "   >> $outfile
325    echo "           This means that the compilation is either currently on going in another terminal was previous interupted before the end."   >> $outfile
326    echo "           The file will now be removed. "   >> $outfile
327    echo >> $outfile
328    rm -f build/fcm.bld.lock
329fi
330
331echo    ./makeorchidee_fcm -j 8 -xios -parallel $parallel -$optmode -arch ${fcm_arch} -arch_path $arch_path $full_orch $orchdriver >> $outfile 
332        ./makeorchidee_fcm -j 8 -xios -parallel $parallel -$optmode -arch ${fcm_arch} -arch_path $arch_path $full_orch $orchdriver >> $outfile 2>&1
333# Test if compiling finished
334if [[ $? != 0 ]] ; then
335    echo "THERE IS A PROBLEM IN ORCHIDEE COMPILATION - STOP"
336    exit
337fi
338
339# Rename exetubles for ORCHIDEE offline driver with suffix version
340cd $modipsl/bin
341if [ -f orchideedriver ] ; then
342    mv orchideedriver orchideedriver.${orchversion}_$optmode
343    ln -sf orchideedriver.${orchversion}_$optmode orchideedriver_$optmode
344fi
345if [ -f orchidee_ol ] ; then
346    mv orchidee_ol orchidee_ol.${orchversion}_$optmode
347    ln -sf orchidee_ol.${orchversion}_$optmode orchidee_ol_$optmode
348fi
349
350## 2.5 Compile NEMO
351if [ $compnemo == y ] ; then
352    nemo_root=$modipsl/modeles/NEMO
353    cfg_ref=ORCA2_ICE_PISCES
354    cfg_wrk=ORCA_ICE_TRC
355    addkeys="key_oasis3 key_top key_si3 key_isf"
356    delkeys=""
357   
358    if [ ${nemotop} == n ] ; then
359        cfg_wrk=ORCA_ICE
360        delkeys="key_top"
361    fi
362   
363    if [ ${nemotop} == n ] ; then
364        echo; echo "NOW COMPILE NEMO with ice model SI3 without passive tracer model TOP"
365        echo >> $outfile ; echo " NOW COMPILE NEMO with ice model SI3 without passive tracer model TOP"   >> $outfile
366    else
367        echo; echo "NOW COMPILE NEMO with ice model SI3 and passive tracer model TOP"
368        echo >> $outfile ; echo " NOW COMPILE NEMO with ice model SI3 and passive tracer model TOP"   >> $outfile
369    fi
370   
371    echo >> $outfile ; echo cd $nemo_root  >> $outfile
372    echo >> $outfile ; echo cp $mysrc_path/NEMO/arch-${fcm_arch}.fcm arch/CNRS/.   >> $outfile
373    echo >> $outfile
374   
375    cd $nemo_root ; cp $mysrc_path/NEMO/arch-${fcm_arch}.fcm arch/CNRS/.
376   
377    # creation of config
378    echo >> $outfile ; echo cd $nemo_root  >> $outfile
379    echo ./makenemo -m ${fcm_arch} -n $cfg_wrk -r $cfg_ref -j0 add_key "$addkeys"  del_key "$delkeys"   >> $outfile
380    echo >> $outfile
381    cd $nemo_root
382    ./makenemo -m ${fcm_arch} -n $cfg_wrk -r $cfg_ref -j0  add_key "$addkeys"  del_key "$delkeys"  >> $outfile 2>&1
383   
384   
385    # Copy of specfic source files
386    echo >> $outfile ; echo cp $mysrc_path/NEMO/*.*90  $nemo_root/cfgs/$cfg_wrk/MY_SRC/.   >> $outfile
387    echo >> $outfile
388    cp $mysrc_path/NEMO/*.*90  $nemo_root/cfgs/$cfg_wrk/MY_SRC/.
389   
390   
391    if [ $full_nemo == y ] ; then
392        # To make a full compilation, first make a clean to remove all files produced during previous compilation
393        echo ./makenemo -m ${fcm_arch} -n $cfg_wrk -r $cfg_ref clean   >> $outfile
394        echo >> $outfile
395        ./makenemo -m ${fcm_arch} -n $cfg_wrk -r $cfg_ref clean  >> $outfile 2>&1
396    fi
397    echo ./makenemo -m ${fcm_arch} -n $cfg_wrk -r $cfg_ref -j8  >> $outfile
398    echo >> $outfile
399    ./makenemo -m ${fcm_arch} -n $cfg_wrk -r $cfg_ref -j8  >> $outfile 2>&1
400   
401    echo >> $outfile
402    echo "Move nemo executable to modipsl/bin" >> $outfile
403    echo ls -lrt $nemo_root/cfgs/$cfg_wrk/BLD/bin   >> $outfile
404    ls -lrt $nemo_root/cfgs/$cfg_wrk/BLD/bin  >> $outfile
405    echo >> $outfile
406   
407    if [ -f $nemo_root/cfgs/$cfg_wrk/BLD/bin/nemo.exe ] ; then
408        mv $nemo_root/cfgs/$cfg_wrk/BLD/bin/nemo.exe $modipsl/bin/opa_${optmode}.exe
409    else
410        echo "ERROR nemo.exe executable does not exist."
411        echo "THERE IS A PROBLEM IN NEMO COMPILATION - STOP"
412        exit
413    fi
414   
415else
416    echo ; echo No compilation of NEMO
417fi
418
419##2.6  Compile INCA
420if [ $compinca == y ] ; then
421    cd $modipsl/modeles/INCA
422   
423    echo; echo "NOW COMPILE INCA ${optchimie}"
424    echo >> $outfile ; echo " NOW COMPILE INCA ${optchimie}"   >> $outfile 
425   
426    echo ./makeinca_fcm -chimie ${optchimie} -$optmode -xios -parallel mpi_omp -j 8 -arch ${fcm_arch}  -arch_path $arch_path $full_inca  >> $outfile
427    ./makeinca_fcm -chimie ${optchimie} -$optmode -xios -parallel mpi_omp  -j 8 -arch ${fcm_arch} -arch_path $arch_path $full_inca >> $outfile 2>&1
428   
429    # Test if compiling finished
430    if [[ $? != 0 ]] ; then
431        echo "THERE IS A PROBLEM IN INCA COMPILATION - STOP"
432        echo "ALL INFORMATION IN FILE $outfile"
433        exit
434    fi
435   
436    echo "Move inca.dat modipsl/bin"
437    if [[ -f $modipsl/modeles/INCA/SIMULATIONS/${optchimie}/inca.dat ]] ;  then 
438        mv $modipsl/modeles/INCA/SIMULATIONS/${optchimie}/inca.dat $modipsl/bin/inca_${optchimie}.dat ;
439    else
440        echo "THERE IS A PROBLEM IN INCA COMPILATION - STOP"
441        echo "ALL INFORMATION IN FILE $outfile"
442        exit   
443    fi
444   
445    echo "Move tracer.def to  modipsl/bin"
446    if [[ -f $modipsl/modeles/INCA/tracer.def ]] ;  then
447        mv $modipsl/modeles/INCA/tracer.def $modipsl/bin/tracer_${optchimie}.def ;
448    fi
449   
450else
451    echo ; echo No compilation of INCA
452fi
453
454## 2.7 Compile LMDZ
455cd $modipsl/modeles/LMDZ
456
457
458# Temporary use of SOURCES/LMDZ to handle modifications needed by IPSLCM7 for LMDZ 4515
459# To be remove for newer versions of LMDZ
460cp $mysrc_path/LMDZ/phylmd/*.*90  libf/phylmd/.
461cp $mysrc_path/LMDZ/dyn3d_common/*.*90  libf/dyn3d_common/.
462
463
464# Compile LMDZ as library to couple to DYNAMICO
465if [ $compdyna == y ] ; then
466    echo; echo "NOW COMPILE LMDZ FOR COUPLING TO DYNAMICO"
467    echo >> $outfile ; echo " NOW COMPILE LMDZ FOR COUPLING TO DYNAMICO"   >> $outfile 
468   
469   
470    # Check if the compilation of LMDZ was previsouly interupted prematured.
471    # In that case, the files dimension.h and .lock exist. If the files exist, they are here removed to avoid makelmdz_fcm
472    # to ask question and wait for interactivly answer from the user.
473    if [ -f libf/grid/dimensions.h ] || [ -f .lock ] ; then
474        echo >> $outfile
475        echo " WARNING!! The file LMDZ/libf/grid/dimension.h and/or the LMDZ/.lock exist. "   >> $outfile
476        echo "           This means that the compilation is either currently on going in another terminal was previous interupted before the end."   >> $outfile
477        echo "           The files dimension.h and .lock will now be removed. "   >> $outfile
478        echo >> $outfile
479        rm -f libf/grid/dimensions.h
480        rm -f .lock
481    fi
482   
483    # Need to define the proper option for radiative code compilation. By default, we use rrtm
484    case $rad in
485        oldrad) opt_rad="" ;;
486        rrtm)    opt_rad="-rad rrtm" ;;
487        ecrad)  opt_rad="-rad ecrad" ;;
488        *) echo Only oldrad rrtm ecrad for rad option ; exit
489    esac
490   
491   
492    if [ $compinca == y ] ; then
493        arginca="-chimie INCA "
494    else
495        arginca=" "
496    fi
497   
498    if [ $compoasis == y ] ; then
499        argoasis="-c OMCT "
500    else
501        argoasis=" "
502    fi
503
504    echo ./makelmdz_fcm -p lmd $argoasis $opt_rad -$optmode -mem -parallel $parallel -libphy -v $argorch $arginca  -io xios -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz    >> $outfile 
505    ./makelmdz_fcm -p lmd $argoasis $opt_rad -$optmode -mem -parallel $parallel -libphy -v $argorch $arginca  -io xios -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz    >> $outfile 2>&1
506   
507   
508    # Test if compiling finished
509    if [[ $? != 0 ]] ; then
510        echo "THERE IS A PROBLEM IN LMDZ PHYSICS COMPILATION - STOP"
511        exit
512    fi
513fi
514
515
516## 2.8 Compile DYNAMICO
517if [ $compdyna == y ] ; then
518    cd $modipsl/modeles/DYNAMICO
519    echo; echo "NOW COMPILE DYNAMICO "
520    echo >> $outfile ; echo " NOW COMPILE DYNAMICO"   >> $outfile 
521   
522    if [ $compoasis == y ] ; then
523        argoasis="-with_oasis "
524    else
525        argoasis=" "
526    fi
527    if [ $compinca == y ] ; then
528        arginca="-with_inca "
529    else
530        arginca=" "
531    fi
532   
533   
534    echo ./make_icosa -$optmode -with_fcm1 -parallel $parallel -external_ioipsl $argoasis -with_xios -arch $fcm_arch -arch_path $arch_path -job 8 $full_dyna    >> $outfile 
535    ./make_icosa -$optmode -with_fcm1 -parallel $parallel -external_ioipsl $argoasis -with_xios -arch $fcm_arch -arch_path $arch_path -job 8 $full_dyna    >> $outfile 2>&1
536    # Test if compiling finished
537    if [[ $? != 0 ]] ; then
538        echo "THERE IS A PROBLEM IN DYNAMICO COMPILATION - STOP"
539        exit
540    fi
541fi
542   
543## 2.9 Compile interface ICOSA_LMDZ
544if [ $compdyna == y ] ; then
545    cd $modipsl/modeles/ICOSA_LMDZ
546    echo; echo "NOW COMPILE ICOSA_LMDZ "
547    echo >> $outfile ; echo " NOW COMPILE ICOSA_LMDZ"   >> $outfile 
548   
549    echo ./make_icosa_lmdz -nodeps -p lmd -$optmode -parallel $parallel $argoasis -with_orchidee $arginca -arch ${fcm_arch} -arch_path ${arch_path} -job 8 $full_dyna    >> $outfile 
550    ./make_icosa_lmdz -nodeps -p lmd -$optmode -parallel $parallel $argoasis -with_orchidee $arginca -arch ${fcm_arch} -arch_path ${arch_path} -job 8 $full_dyna    >> $outfile 2>&1
551    # Test if compiling finished
552    if [[ $? != 0 ]] ; then
553        echo "THERE IS A PROBLEM IN ICOSA_LMDZ COMPILATION - STOP"
554        exit
555    fi
556    # Move executables to modipsl/bin
557    if [ -f $modipsl/modeles/ICOSA_LMDZ/bin/icosa_lmdz.exe ] ; then
558        if [ $compinca == y ] ; then
559            mv $modipsl/modeles/ICOSA_LMDZ/bin/icosa_lmdz.exe $modipsl/bin/icosa_lmdz_${orchversion}_${optmode}_${optchimie}.exe
560            # Create link to be use by IPSLCM and LMDZOR without any change in the executable name
561            cd  $modipsl/bin
562            rm -f icosa_lmdz_${orchversion}_${optmode}.exe
563            ln -s icosa_lmdz_${orchversion}_${optmode}_${optchimie}.exe icosa_lmdz_${orchversion}_${optmode}.exe
564        else
565            mv $modipsl/modeles/ICOSA_LMDZ/bin/icosa_lmdz.exe $modipsl/bin/icosa_lmdz_${orchversion}_${optmode}.exe
566        fi
567    else
568        echo "THERE IS A PROBLEM IN ICOSA_LMDZ COMPILATION EXECUTABLE MISSING - STOP"
569        exit
570    fi
571fi
572
573
574## 2.10 Compile LMDZ for regular latlon configuration
575if [ $regular_latlon = y ] ; then
576
577    cd $modipsl/modeles/LMDZ
578    # Compile LMDZ regular lat-lon exectuable
579    echo; echo "NOW COMPILE LMDZ REGULAR LAT-LON MODE. Resolution = ${resol_atm}"
580    echo >> $outfile ; echo " NOW COMPILE LMDZ REGULAR LAT-LON MODE. Resolution = ${resol_atm}"   >> $outfile 
581    # Check if the compilation of LMDZ was previsouly interupted prematured.
582    # In that case, the files dimension.h and .lock exist. If the files exist, they are here removed to avoid makelmdz_fcm
583    # to ask question and wait for interactivly answer from the user.
584    if [ -f libf/grid/dimensions.h ] || [ -f .lock ] ; then
585        echo >> $outfile
586        echo " WARNING!! The file LMDZ/libf/grid/dimension.h and/or the LMDZ/.lock exist. "   >> $outfile
587        echo "           This means that the compilation is either currently on going in another terminal was previous interupted before the end."   >> $outfile
588        echo "           The files dimension.h and .lock will now be removed. "   >> $outfile
589        echo >> $outfile
590        rm -f libf/grid/dimensions.h
591        rm -f .lock
592    fi
593
594    # Need to define the proper option for radiative code compilation. By default, we use rrtm
595    case $rad in
596        oldrad) opt_rad="" ;;
597        rrtm)    opt_rad="-rad rrtm" ;;
598        ecrad)  opt_rad="-rad ecrad" ;;
599        *) echo Only oldrad rrtm ecrad for rad option ; exit
600    esac
601   
602    if [ $compinca == y ] ; then
603        arginca="-chimie INCA"
604    else
605        arginca=""
606    fi
607   
608    if [ $compoasis == y ] ; then
609        argoasis="-c OMCT"
610    else
611        argoasis=""
612    fi
613
614    if [ $compiso == y ] ; then
615    arginca=""
616    compinca="n" 
617#    argoasis=""
618    argiso="-isotopes true"
619    argorch="false"
620    argphys="lmdiso"
621    else
622    argiso=""
623    argphys="lmd"
624    fi
625
626    echo ./makelmdz_fcm -d ${resol_atm} $argoasis -p $argphys $opt_rad -$optmode -mem -parallel $parallel $arginca -io xios -v $argorch $argiso -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz gcm    >> $outfile 
627         ./makelmdz_fcm -d ${resol_atm} $argoasis -p $argphys $opt_rad -$optmode -mem -parallel $parallel $arginca -io xios -v $argorch $argiso -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz gcm    >> $outfile 2>&1
628    # Test if compiling finished
629    if [[ $? != 0 ]] ; then
630        echo "THERE IS A PROBLEM IN LMDZ REGULAR LATLON COMPILATION - STOP"
631        exit
632    fi
633
634    # Find executable suffix
635    suffix=_${resol_atm}_phy${argphys}
636    suffix=${suffix}_${rad} 
637    if [ $parallel == seq ] || [ $parallel == none ] ; then
638        suffix=${suffix}_seq_orch_inca.e
639    else
640    if [ $argorch != false ] ; then
641        suffix=${suffix}_para_mem_orch
642    else
643        suffix=${suffix}_para_mem
644    fi
645        if [ $compoasis == y ] ; then
646            suffix=${suffix}_couple
647        else
648            suffix=${suffix}
649        fi
650        if [ $compinca == y ] ; then
651            suffix=${suffix}_inca
652        else
653            suffix=${suffix}
654        fi
655    if [ $compiso == y ] ; then
656        suffix=${suffix}_iso.e
657    else
658        suffix=${suffix}.e
659    fi
660    fi
661    echo gcm suffix = $suffix
662   
663    # Move executables to modipsl/bin folder
664    echo "Move gcm.e executable to modipsl/bin"
665    if [ -f $modipsl/modeles/LMDZ/bin/gcm${suffix} ] ;  then
666        if [ $compinca == y ] ; then
667            mv $modipsl/modeles/LMDZ/bin/gcm${suffix} $modipsl/bin/gcm_${resol_atm}_${orchversion}_${optmode}_${optchimie}.e
668            # Create link to be use by IPSLCM and LMDZOR without any change in the executable name
669            cd $modipsl/bin
670            rm -f gcm_${resol_atm}_${orchversion}_${optmode}.e
671            ln -s gcm_${resol_atm}_${orchversion}_${optmode}_${optchimie}.e gcm_${resol_atm}_${orchversion}_${optmode}.e
672        elif [ $compiso == y ] ; then
673        mv $modipsl/modeles/LMDZ/bin/gcm${suffix} $modipsl/bin/gcm_${resol_atm}_iso_${optmode}.e
674        else
675            mv $modipsl/modeles/LMDZ/bin/gcm${suffix} $modipsl/bin/gcm_${resol_atm}_${orchversion}_${optmode}.e
676        fi
677    else
678        echo "ERROR gcm${suffix} executable does not exist." 
679        echo "THERE IS A PROBLEM IN LMDZ REGULAR LATLON COMPILATION - STOP"
680        exit
681    fi   
682
683    # Find executable suffix
684    suffix=_${resol_atm}_phylmd
685    suffix=${suffix}_${rad} 
686    if [ $parallel == seq ] || [ $parallel == none ] ; then
687        suffix=${suffix}_seq_orch.e
688    else
689    if [ $argorch != false ] ; then
690        suffix=${suffix}_para_mem_orch
691    else
692        suffix=${suffix}_para_mem
693    fi
694        if [ $compoasis == y ] ; then
695            suffix=${suffix}_couple.e
696        else
697            suffix=${suffix}.e
698        fi
699    fi
700    echo ce0l suffix = $suffix
701
702    # Compile ce0l initialization program for LMDZ regular lat-lon exectuable
703    cd $modipsl/modeles/LMDZ
704    echo; echo "NOW COMPILE CE0L OF LMDZ. Resolution = ${resol_atm}"
705    echo >> $outfile ; echo " NOW COMPILE CE0L OF LMDZ. Resolution = ${resol_atm}"   >> $outfile 
706
707    echo ./makelmdz_fcm -d ${resol_atm} $argoasis -p lmd -rrtm true -$optmode -mem -parallel $parallel -io xios -v $argorch -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz ce0l    >> $outfile 
708         ./makelmdz_fcm -d ${resol_atm} $argoasis -p lmd -rrtm true -$optmode -mem -parallel $parallel -io xios -v $argorch -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz ce0l    >> $outfile 2>&1
709    # Test if compiling finished
710    if [[ $? != 0 ]] ; then
711        echo "THERE IS A PROBLEM IN CE0L (LMDZ) REGULAR LATLON COMPILATION - STOP"
712        exit
713    fi
714   
715 
716    # Move executable ce0l to modipsl/bin folder
717    echo "Move ce0l executable to modipsl/bin"
718    if [ -f $modipsl/modeles/LMDZ/bin/ce0l${suffix} ] ;  then
719        mv $modipsl/modeles/LMDZ/bin/ce0l${suffix} $modipsl/bin/ce0l_${resol_atm}_${optmode}.e
720    else
721        echo "ERROR ce0l${suffix} executable does not exist." 
722        echo "THERE IS A PROBLEM IN LMDZ REGULAR LATLON COMPILATION - STOP"
723        exit
724    fi
725fi
726
727echo >>$outfile ; echo "ALL COMPILING FINISHED" >> $outfile
728echo ls -lrt modipsl/bin >> $outfile
729ls -lrt $modipsl/bin >> $outfile
730
731echo; echo "ALL COMPILING FINISHED" ; echo
732echo "Executables are found in modipsl/bin"
733echo "Check that executable names correspond with the name set in config.card before launching the job"
734echo ls -lrt modipsl/bin
735ls -lrt $modipsl/bin
736
737date
738
739exit
740
741
Note: See TracBrowser for help on using the repository browser.