[6638] | 1 | #!/bin/bash |
---|
| 2 | # |
---|
| 3 | # define_config.sh is called from the main compilation script compile_ipslcm7.sh |
---|
| 4 | # The script will define which components to compile. |
---|
| 5 | # By default all availble components are compiled. |
---|
| 6 | # |
---|
| 7 | # Step 1: The avaible components are defined. |
---|
| 8 | # Step 2: Define which components to compile. If argument [-subconfig subconfig] is set |
---|
| 9 | # to the main compilation script, a control if the components needed are avaiable. |
---|
| 10 | # If argument is subconfig is not set, the components defined in step 1 will be defined. |
---|
| 11 | |
---|
| 12 | |
---|
| 13 | ### Step 1: Check available components possible to compile |
---|
| 14 | # LMDZ, ORCHIDEE and XIOS are considered mandatory and will not be checked. |
---|
| 15 | |
---|
| 16 | if [ -d ../../modeles/NEMO ] ; then |
---|
| 17 | compnemo=y |
---|
| 18 | else |
---|
| 19 | compnemo=n |
---|
| 20 | fi |
---|
| 21 | |
---|
| 22 | if [ -d ../../modeles/INCA ] ; then |
---|
| 23 | compinca=y |
---|
| 24 | else |
---|
| 25 | compinca=n |
---|
| 26 | fi |
---|
| 27 | |
---|
| 28 | if [ -d ../../modeles/DYNAMICO ] ; then |
---|
| 29 | compdyna=y |
---|
| 30 | else |
---|
| 31 | compdyna=n |
---|
| 32 | fi |
---|
| 33 | |
---|
| 34 | if [ -d ../../oasis3-mct ] ; then |
---|
| 35 | compoasis=y |
---|
| 36 | else |
---|
| 37 | compoasis=n |
---|
| 38 | fi |
---|
| 39 | |
---|
| 40 | |
---|
| 41 | |
---|
| 42 | ### Step 2: Define which components to compile. Check if the configuration set as argument is possible |
---|
| 43 | if [ $subconfig == default ] ; then |
---|
| 44 | echo ; echo Compilation of all availble components will be done: |
---|
[6677] | 45 | |
---|
| 46 | elif [ $subconfig == IPSLCM ] || [ $subconfig == IPSLCM-ico ] ; then |
---|
| 47 | # Full coupled model currently without INCA |
---|
| 48 | if [ $compdyna == n ] || [ $compoasis == n ] || [ $compnemo == n ] ; then |
---|
| 49 | echo ; echo It is not possible to compile IPSLCM. |
---|
| 50 | echo Source code is missing |
---|
| 51 | exit |
---|
| 52 | else |
---|
| 53 | echo "Compilation of IPSLCM configuration (without INCA) will be done" |
---|
| 54 | compnemo=y compoasis=y compdyna=y compinca=n complmdz=y comporch=y compxios=y |
---|
| 55 | fi |
---|
| 56 | elif [ $subconfig == IPSLCM-reg ] ; then |
---|
| 57 | # Coupled model without DYNAMICO and INCA |
---|
| 58 | if [ $compoasis == n ] || [ $compnemo == n ] ; then |
---|
| 59 | echo ; echo It is not possible to compile IPSLCM-reg. |
---|
| 60 | echo Source code is missing |
---|
| 61 | exit |
---|
| 62 | else |
---|
| 63 | echo "Compilation of IPSLCM-reg configuration (without INCA and DYNAMICO) will be done" |
---|
| 64 | compnemo=y compoasis=y compdyna=n compinca=n complmdz=y comporch=y compxios=y |
---|
| 65 | regular_latlon=y |
---|
| 66 | fi |
---|
[6638] | 67 | elif [ $subconfig == ICOLMDZORINCA ] ; then |
---|
| 68 | if [ $compinca == n ] || [ $compdyna == n ] ; then |
---|
| 69 | echo ; echo It is not possible to compile ICOLMDZORINCA. |
---|
| 70 | echo INCA or DYNAMICO source code is missing |
---|
| 71 | exit |
---|
| 72 | else |
---|
| 73 | echo Compilation of ICOLMDZORINCA configuration will be done |
---|
[6677] | 74 | compnemo=n compoasis=n compdyna=y compinca=y complmdz=y comporch=y compxios=y |
---|
[6638] | 75 | fi |
---|
| 76 | elif [ $subconfig == ICOLMDZOR ] ; then |
---|
| 77 | if [ $compdyna == n ] ; then |
---|
| 78 | echo ; echo It is not possible to compile ICOLMDZOR |
---|
| 79 | echo DYNAMICO source code is missing |
---|
| 80 | exit |
---|
| 81 | else |
---|
| 82 | echo Compilation of ICOLMDZOR configuration will be done |
---|
[6677] | 83 | compnemo=n compoasis=n compdyna=y compinca=n complmdz=y comporch=y compxios=y |
---|
[6638] | 84 | fi |
---|
| 85 | elif [ $subconfig == LMDZORINCA ] ; then |
---|
| 86 | if [ $compinca == n ] ; then |
---|
| 87 | echo ; echo It is not possible to compile LMDZORINCA. |
---|
| 88 | echo INCA source code is missing |
---|
| 89 | exit |
---|
| 90 | else |
---|
[6677] | 91 | regular_latlon=y |
---|
[6638] | 92 | echo Compilation of regular LMDZORINCA configuration for grid $resol_atm will be done |
---|
[6677] | 93 | compnemo=n compoasis=n compdyna=n compinca=y complmdz=y comporch=y compxios=y |
---|
[6638] | 94 | fi |
---|
| 95 | elif [ $subconfig == LMDZOR ] ; then |
---|
| 96 | # We always suppose that LMDZ and ORCHIDEE are extracted. No check needs to be done. |
---|
[6677] | 97 | regular_latlon=y |
---|
[6638] | 98 | echo Compilation of regular LMDZOR configuration for grid $resol_atm will be done |
---|
[6677] | 99 | compnemo=n compoasis=n compdyna=n compinca=n complmdz=y comporch=y compxios=y |
---|
[6638] | 100 | else |
---|
[6677] | 101 | echo ; echo "The configuration $subconfig is not available" |
---|
| 102 | echo "Choose between ICOLMDZORINCA, ICOLMDZOR, LMDZORINCA, LMDZOR" |
---|
| 103 | echo " IPSLCM or IPSLCM-reg" |
---|
| 104 | echo "Exit now" |
---|
[6638] | 105 | exit |
---|
| 106 | fi |
---|
[6677] | 107 | echo compnemo=$compnemo compoasis=$compoasis compdyna=$compdyna compinca=$compinca complmdz=y comporch=y compxios=y |
---|
[6638] | 108 | echo ; |
---|
| 109 | |
---|
[6677] | 110 | |
---|
| 111 | # Coherence test for variable regular_latlon which can be set as input argument |
---|
| 112 | if [ $regular_latlon == yes ] || [ $regular_latlon == y ] ; then |
---|
| 113 | regular_laton=y |
---|
| 114 | elif [ $regular_latlon == no ] || [ $regular_latlon == n ] ; then |
---|
| 115 | regular_laton=n |
---|
| 116 | else |
---|
| 117 | echo "regular_latlon=$regular_latlon : This option is not possible." |
---|
| 118 | echo "Compile using argument '-regular_latlon' no or '-regular_latlon yes'" |
---|
| 119 | echo "Exit now" |
---|
| 120 | fi |
---|
| 121 | |
---|