[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 |
---|
[6856] | 32 | regular_latlon=y |
---|
[6638] | 33 | fi |
---|
| 34 | |
---|
| 35 | if [ -d ../../oasis3-mct ] ; then |
---|
| 36 | compoasis=y |
---|
| 37 | else |
---|
| 38 | compoasis=n |
---|
| 39 | fi |
---|
| 40 | |
---|
[6727] | 41 | if [ -d ../../modeles/LMDZ ] ; then |
---|
| 42 | complmdz=y |
---|
| 43 | else |
---|
| 44 | complmdz=n |
---|
| 45 | fi |
---|
[6638] | 46 | |
---|
| 47 | |
---|
[6727] | 48 | |
---|
[6638] | 49 | ### Step 2: Define which components to compile. Check if the configuration set as argument is possible |
---|
| 50 | if [ $subconfig == default ] ; then |
---|
| 51 | echo ; echo Compilation of all availble components will be done: |
---|
[6677] | 52 | |
---|
| 53 | elif [ $subconfig == IPSLCM ] || [ $subconfig == IPSLCM-ico ] ; then |
---|
| 54 | # Full coupled model currently without INCA |
---|
[6727] | 55 | if [ $compdyna == n ] || [ $compoasis == n ] || [ $compnemo == n ] || [ $complmdz == n ] ; then |
---|
[6677] | 56 | echo ; echo It is not possible to compile IPSLCM. |
---|
| 57 | echo Source code is missing |
---|
| 58 | exit |
---|
| 59 | else |
---|
| 60 | echo "Compilation of IPSLCM configuration (without INCA) will be done" |
---|
| 61 | compnemo=y compoasis=y compdyna=y compinca=n complmdz=y comporch=y compxios=y |
---|
| 62 | fi |
---|
| 63 | elif [ $subconfig == IPSLCM-reg ] ; then |
---|
| 64 | # Coupled model without DYNAMICO and INCA |
---|
[6727] | 65 | if [ $compoasis == n ] || [ $compnemo == n ] || [ $complmdz == n ] ; then |
---|
[6677] | 66 | echo ; echo It is not possible to compile IPSLCM-reg. |
---|
| 67 | echo Source code is missing |
---|
| 68 | exit |
---|
| 69 | else |
---|
| 70 | echo "Compilation of IPSLCM-reg configuration (without INCA and DYNAMICO) will be done" |
---|
| 71 | compnemo=y compoasis=y compdyna=n compinca=n complmdz=y comporch=y compxios=y |
---|
| 72 | regular_latlon=y |
---|
| 73 | fi |
---|
[6638] | 74 | elif [ $subconfig == ICOLMDZORINCA ] ; then |
---|
[6727] | 75 | if [ $compinca == n ] || [ $compdyna == n ] || [ $complmdz == n ] ; then |
---|
[6638] | 76 | echo ; echo It is not possible to compile ICOLMDZORINCA. |
---|
| 77 | echo INCA or DYNAMICO source code is missing |
---|
| 78 | exit |
---|
| 79 | else |
---|
| 80 | echo Compilation of ICOLMDZORINCA configuration will be done |
---|
[6677] | 81 | compnemo=n compoasis=n compdyna=y compinca=y complmdz=y comporch=y compxios=y |
---|
[6638] | 82 | fi |
---|
| 83 | elif [ $subconfig == ICOLMDZOR ] ; then |
---|
[6727] | 84 | if [ $compdyna == n ] || [ $complmdz == n ] ; then |
---|
[6638] | 85 | echo ; echo It is not possible to compile ICOLMDZOR |
---|
| 86 | echo DYNAMICO source code is missing |
---|
| 87 | exit |
---|
| 88 | else |
---|
| 89 | echo Compilation of ICOLMDZOR configuration will be done |
---|
[6677] | 90 | compnemo=n compoasis=n compdyna=y compinca=n complmdz=y comporch=y compxios=y |
---|
[6638] | 91 | fi |
---|
| 92 | elif [ $subconfig == LMDZORINCA ] ; then |
---|
[6727] | 93 | if [ $compinca == n ] || [ $complmdz == n ] ; then |
---|
[6638] | 94 | echo ; echo It is not possible to compile LMDZORINCA. |
---|
[6727] | 95 | echo INCA or LMDZ source code is missing |
---|
[6638] | 96 | exit |
---|
| 97 | else |
---|
[6677] | 98 | regular_latlon=y |
---|
[6638] | 99 | echo Compilation of regular LMDZORINCA configuration for grid $resol_atm will be done |
---|
[6677] | 100 | compnemo=n compoasis=n compdyna=n compinca=y complmdz=y comporch=y compxios=y |
---|
[6638] | 101 | fi |
---|
| 102 | elif [ $subconfig == LMDZOR ] ; then |
---|
[6727] | 103 | if [ $complmdz == n ] ; then |
---|
| 104 | echo ; echo It is not possible to compile LMDZOR. |
---|
| 105 | echo LMDZ source code is missing |
---|
| 106 | exit |
---|
| 107 | else |
---|
| 108 | regular_latlon=y |
---|
| 109 | echo Compilation of regular LMDZOR configuration for grid $resol_atm will be done |
---|
| 110 | compnemo=n compoasis=n compdyna=n compinca=n complmdz=y comporch=y compxios=y |
---|
| 111 | fi |
---|
| 112 | elif [ $subconfig == ORCHIDEE_OL ] ; then |
---|
| 113 | # We always suppose ORCHIDEE is extracted. No check needs to be done. |
---|
| 114 | regular_latlon=n |
---|
| 115 | echo Compilation of ORCHIDEE offline configuration will be done |
---|
| 116 | compnemo=n compoasis=n compdyna=n compinca=n complmdz=n comporch=y compxios=y |
---|
[6638] | 117 | else |
---|
[6677] | 118 | echo ; echo "The configuration $subconfig is not available" |
---|
| 119 | echo "Choose between ICOLMDZORINCA, ICOLMDZOR, LMDZORINCA, LMDZOR" |
---|
| 120 | echo " IPSLCM or IPSLCM-reg" |
---|
| 121 | echo "Exit now" |
---|
[6638] | 122 | exit |
---|
| 123 | fi |
---|
[6727] | 124 | echo compnemo=$compnemo compoasis=$compoasis compdyna=$compdyna compinca=$compinca complmdz=$complmdz comporch=y compxios=y |
---|
[6638] | 125 | echo ; |
---|
| 126 | |
---|
[6677] | 127 | |
---|
| 128 | # Coherence test for variable regular_latlon which can be set as input argument |
---|
| 129 | if [ $regular_latlon == yes ] || [ $regular_latlon == y ] ; then |
---|
| 130 | regular_laton=y |
---|
| 131 | elif [ $regular_latlon == no ] || [ $regular_latlon == n ] ; then |
---|
| 132 | regular_laton=n |
---|
| 133 | else |
---|
| 134 | echo "regular_latlon=$regular_latlon : This option is not possible." |
---|
| 135 | echo "Compile using argument '-regular_latlon' no or '-regular_latlon yes'" |
---|
| 136 | echo "Exit now" |
---|
[6856] | 137 | exit |
---|
[6677] | 138 | fi |
---|
| 139 | |
---|