1 | #!/bin/ksh |
---|
2 | #----------------------------------------------------------------- |
---|
3 | function ATM_Initialize |
---|
4 | { |
---|
5 | IGCM_debug_PushStack "ATM_Initialize" |
---|
6 | |
---|
7 | ##- Horizontal resolution read from dynamicolmdz.card |
---|
8 | if [ ! X${dynamicolmdz_UserChoices_RESOL_NBP} = X ] ; then |
---|
9 | RESOL_NBP=${dynamicolmdz_UserChoices_RESOL_NBP} |
---|
10 | else |
---|
11 | # Set default resolution |
---|
12 | RESOL_NBP=20 |
---|
13 | fi |
---|
14 | |
---|
15 | ##- Horizontal resolution read from dynamicolmdz.card |
---|
16 | if [ ! X${dynamicolmdz_UserChoices_RESOL_LLM} = X ] ; then |
---|
17 | RESOL_LLM=${dynamicolmdz_UserChoices_RESOL_LLM} |
---|
18 | else |
---|
19 | # Set default resolution |
---|
20 | RESOL_LLM=79 |
---|
21 | fi |
---|
22 | |
---|
23 | ##- LMDZ physics version |
---|
24 | ## Read LMDZ_Physics option in lmdz.card, if not present take default value NPv6.1.3 |
---|
25 | if [ ! X${dynamicolmdz_UserChoices_LMDZ_Physics} = X ] ; then |
---|
26 | LMDZ_Physics=${dynamicolmdz_UserChoices_LMDZ_Physics} |
---|
27 | else |
---|
28 | LMDZ_Physics=NPv6.0.11 |
---|
29 | fi |
---|
30 | echo LMDZ physics version : ${LMDZ_Physics} |
---|
31 | |
---|
32 | |
---|
33 | IGCM_debug_PopStack "ATM_Initialize" |
---|
34 | } |
---|
35 | |
---|
36 | #----------------------------------------------------------------- |
---|
37 | function ATM_Update |
---|
38 | { |
---|
39 | IGCM_debug_PushStack "ATM_Update" |
---|
40 | |
---|
41 | ##-- Remise ou non a zero de la date initiale de LMDZ pour le fichier run.def |
---|
42 | if [ ${CumulPeriod} -eq 1 ] ; then |
---|
43 | IGCM_comp_modifyDefFile blocker run.def raz_date 1 |
---|
44 | else |
---|
45 | IGCM_comp_modifyDefFile blocker run.def raz_date 0 |
---|
46 | fi |
---|
47 | |
---|
48 | ##-- Calendar type for LMDZ and create_etat0_limit |
---|
49 | case ${config_UserChoices_CalendarType} in |
---|
50 | leap|gregorian) |
---|
51 | IGCM_comp_modifyDefFile blocker run.def calend gregorian ;; |
---|
52 | noleap) |
---|
53 | IGCM_comp_modifyDefFile blocker run.def calend earth_365d ;; |
---|
54 | 360d) |
---|
55 | IGCM_comp_modifyDefFile blocker run.def calend earth_360d ;; |
---|
56 | *) |
---|
57 | IGCM_comp_modifyDefFile blocker run.def calend earth_360d ;; |
---|
58 | esac |
---|
59 | |
---|
60 | IGCM_comp_modifyDefFile blocker run.def dayref ${InitDay} |
---|
61 | IGCM_comp_modifyDefFile blocker run.def anneeref ${InitYear} |
---|
62 | |
---|
63 | IGCM_comp_modifyDefFile blocker run_icosa.def run_length $(( ${PeriodLengthInDays} * 86400 )) |
---|
64 | |
---|
65 | if [ X${RESOL_NBP} == X40 ] || [ X${RESOL_NBP} == X20 ]; then |
---|
66 | IGCM_comp_modifyDefFile nonblocker run_icosa.def nbp ${RESOL_NBP} |
---|
67 | IGCM_comp_modifyDefFile nonblocker run_icosa.def nsplit_i $(( ${RESOL_NBP} / 10 )) |
---|
68 | IGCM_comp_modifyDefFile nonblocker run_icosa.def nsplit_j $(( ${RESOL_NBP} / 10 )) |
---|
69 | IGCM_comp_modifyDefFile nonblocker run_icosa.def llm 79 |
---|
70 | IGCM_debug_Print 1 "Maximum nubmer of MPI for resolution nbp=${RESOL_NBP} is $(( ${RESOL_NBP} * ${RESOL_NBP} / 10 ))" |
---|
71 | else |
---|
72 | IGCM_debug_Print 1 "nbp=${RESOL_NBP} is set in dynamicolmdz.card" |
---|
73 | IGCM_debug_Exit "This resolution has not been prepared in dynamicolmdz.driver" |
---|
74 | IGCM_debug_Verif_Exit |
---|
75 | fi |
---|
76 | |
---|
77 | if [ X${dynamicolmdz_UserChoices_Aquaplanet} == Xy ] ; then |
---|
78 | IGCM_comp_modifyDefFile nonblocker earth_const.def solarlong0 1000.0 |
---|
79 | IGCM_comp_modifyDefFile nonblocker config.def R_ecc 0 |
---|
80 | IGCM_comp_modifyDefFile nonblocker config.def read_climoz -1 |
---|
81 | IGCM_comp_modifyDefFile nonblocker run_icosa.def etat0 held_suarez |
---|
82 | else |
---|
83 | IGCM_comp_modifyDefFile nonblocker earth_const.def solarlong0 -9999.999 |
---|
84 | IGCM_comp_modifyDefFile nonblocker config.def R_ecc 0.016715 |
---|
85 | IGCM_comp_modifyDefFile nonblocker config.def read_climoz 1 |
---|
86 | # IGCM_comp_modifyDefFile nonblocker run_icosa.def etat0 database |
---|
87 | IGCM_comp_modifyDefFile nonblocker run_icosa.def etat0 start_file |
---|
88 | fi |
---|
89 | |
---|
90 | |
---|
91 | |
---|
92 | # Add include of context xml files for LMDZ and DYNAMICO in iodef.xml |
---|
93 | # In iodef.xml add on the next line after "COMPONENT CONTEXT" |
---|
94 | echo '<context id="LMDZ" src="./context_lmdz.xml"/>' > add.tmp |
---|
95 | echo '<context id="icosagcm" src="./context_dynamico.xml"/>' >> add.tmp |
---|
96 | |
---|
97 | # Add inclusion of file context_input_lmdz.xml if this file exists |
---|
98 | if [ -f context_input_lmdz.xml ] ; then |
---|
99 | echo '<context id="LMDZ" src="./context_input_lmdz.xml"/>' >> add.tmp |
---|
100 | fi |
---|
101 | # Add inclusion of file context_input_dynamico.xml if this file exists |
---|
102 | if [ -f context_input_dynamico.xml ] ; then |
---|
103 | echo '<context id="icosagcm" src="./context_input_dynamico.xml"/>' >> add.tmp |
---|
104 | fi |
---|
105 | |
---|
106 | |
---|
107 | # Include xml files for output configuration if running with workflow CMIP6 |
---|
108 | if [ X"$( echo ${config_UserChoices_ExpType} | grep CMIP6 )" != "X" ] ; then |
---|
109 | echo '<context id="LMDZ" src="./ping_lmdz.xml"/>' >> add.tmp |
---|
110 | echo '<context id="LMDZ" src="./dr2xml_lmdz.xml"/>' >> add.tmp |
---|
111 | fi |
---|
112 | cp iodef.xml iodef.xml.tmp |
---|
113 | sed -e "/COMPONENT CONTEXT/r add.tmp" iodef.xml.tmp > iodef.xml |
---|
114 | rm iodef.xml.tmp add.tmp |
---|
115 | |
---|
116 | # Add a Long Name as global attribute in output files if LongName is set in config.card |
---|
117 | if [ ! "X${config_UserChoices_LongName}" = "X" ] ; then |
---|
118 | listfile=$(ls file_def*lmdz.xml) |
---|
119 | echo "<variable id=\"LongName\" type=\"string\">${config_UserChoices_LongName}</variable>" > add.tmp |
---|
120 | for file in ${listfile} ; do |
---|
121 | cp ${file} ${file}.tmp |
---|
122 | sed -e "/<file id/r add.tmp" \ |
---|
123 | ${file}.tmp > ${file} |
---|
124 | rm ${file}.tmp |
---|
125 | done |
---|
126 | rm add.tmp |
---|
127 | fi |
---|
128 | |
---|
129 | |
---|
130 | IGCM_debug_PopStack "ATM_Update" |
---|
131 | } |
---|
132 | |
---|
133 | #----------------------------------- |
---|
134 | function ATM_Finalize |
---|
135 | { |
---|
136 | IGCM_debug_PushStack "ATM_Finalize" |
---|
137 | |
---|
138 | IGCM_debug_PopStack "ATM_Finalize" |
---|
139 | } |
---|
140 | |
---|