source: CONFIG/UNIFORM/v7/IPSLCM7/compile_ipslcm7.sh @ 6649

Last change on this file since 6649 was 6649, checked in by aclsce, 8 months ago

Added cleaning of inca and dynmico in case of full option is activated.

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