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

Last change on this file since 6692 was 6692, checked in by acosce, 6 months ago

update compilation script for IPSLCM7 :

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