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

Last change on this file since 6565 was 6565, checked in by acosce, 12 months ago

add LMDZ routines copy to solve a problem when we are running with inca model
there was an incompatibilty between lmdz and dynamico for type_trac (dynamico was waiting for type_trac="lmdz|inca", and lmdz for type_trac="inca"
there wasn't any problem without inca because in both cases type_trac=lmdz

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