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