1 | #!/bin/ksh |
---|
2 | |
---|
3 | #----------------------------------------------------------------- |
---|
4 | function ATM_Initialize |
---|
5 | { |
---|
6 | IGCM_debug_PushStack "ATM_Initialize" |
---|
7 | |
---|
8 | RESOL_ATM=${RESOL} |
---|
9 | |
---|
10 | ##--Frequency purpose .... |
---|
11 | ##-- Initialisation .... |
---|
12 | OK_instan=n |
---|
13 | ##-- |
---|
14 | OK_journe=n |
---|
15 | OK_mensuel=n |
---|
16 | |
---|
17 | case ${config_UserChoices_PeriodLength} in |
---|
18 | 1Y|1y|1M|1m) OK_mensuel=y ;; |
---|
19 | 5D|5d|1D|1d) OK_journe=y ;; |
---|
20 | esac |
---|
21 | |
---|
22 | for frequency in ${config_ATM_WriteFrequency} ; do |
---|
23 | case ${frequency} in |
---|
24 | 5D|5d|1D|1d) OK_journe=y ;; |
---|
25 | esac |
---|
26 | done |
---|
27 | |
---|
28 | ##--Variables used by LMDZ -- |
---|
29 | PAT_INST=$( grep 'OK_instan' ${SUBMIT_DIR}/PARAM/physiq.def ) |
---|
30 | PAT_JOUR=$( grep 'OK_journe' ${SUBMIT_DIR}/PARAM/physiq.def ) |
---|
31 | PAT_MOIS=$( grep 'OK_mensuel' ${SUBMIT_DIR}/PARAM/physiq.def ) |
---|
32 | |
---|
33 | PAT_iphysiq=$( grep 'iphysiq' ${SUBMIT_DIR}/PARAM/gcm.def ) |
---|
34 | PAT_iperiod=$( grep 'iperiod' ${SUBMIT_DIR}/PARAM/gcm.def | tail -1) |
---|
35 | PAT_day_step=$( grep 'day_step' ${SUBMIT_DIR}/PARAM/gcm.def ) |
---|
36 | PAT_ecritphy=$( grep 'ecritphy' ${SUBMIT_DIR}/PARAM/gcm.def ) |
---|
37 | |
---|
38 | ##-- This could be define in lmdz.card, inside section [UserChoices] |
---|
39 | ##-- Otherwise we get the value in *.def |
---|
40 | iperiod=$(grep iperiod ${SUBMIT_DIR}/PARAM/gcm.def | awk -F= '{print $2}' | tail -1) |
---|
41 | iphysiq=$(grep iphysiq ${SUBMIT_DIR}/PARAM/gcm.def | awk -F= '{print $2}') |
---|
42 | # day_step : number of steps per day (multiple of iperiod) |
---|
43 | (( day_step = 48 * iphysiq )) |
---|
44 | |
---|
45 | IGCM_debug_PopStack "ATM_Initialize" |
---|
46 | } |
---|
47 | |
---|
48 | #----------------------------------------------------------------- |
---|
49 | function ATM_Update |
---|
50 | { |
---|
51 | IGCM_debug_PushStack "ATM_Update" |
---|
52 | |
---|
53 | ecritphy=${PeriodLengthInDays} |
---|
54 | |
---|
55 | ##-- Remise ou non a zero de la date initiale de LMDZ pour le fichier run.def |
---|
56 | if [ ${CumulPeriod} -eq 1 ] ; then |
---|
57 | RAZ_DATE=1 |
---|
58 | else |
---|
59 | RAZ_DATE=0 |
---|
60 | fi |
---|
61 | |
---|
62 | ## Mise en forme du fichier physiq.def |
---|
63 | sed -e "s/OK_instan=.*/OK_instan=${OK_instan}/" \ |
---|
64 | -e "s/OK_journe=.*/OK_journe=${OK_journe}/" \ |
---|
65 | -e "s/OK_mensuel=.*/OK_mensuel=${OK_mensuel}/" \ |
---|
66 | physiq.def > physiq.def.tmp |
---|
67 | IGCM_sys_Mv physiq.def.tmp physiq.def |
---|
68 | |
---|
69 | ## Mise en forme du fichier gcm.def |
---|
70 | sed -e "s/${PAT_ecritphy}/ecritphy=${ecritphy}/" \ |
---|
71 | -e "s/${PAT_day_step}/day_step=${day_step}/" \ |
---|
72 | -e "s/${PAT_iperiod}/iperiod=${iperiod}/" \ |
---|
73 | -e "s/${PAT_iphysiq}/iphysiq=${iphysiq}/" \ |
---|
74 | gcm.def > gcm.def.tmp |
---|
75 | IGCM_sys_Mv gcm.def.tmp gcm.def |
---|
76 | |
---|
77 | ## Mise en forme du fichier run.def |
---|
78 | sed -e "s/_dayref_/${InitDay}/" \ |
---|
79 | -e "s/_anneeref_/${InitYear}/" \ |
---|
80 | -e "s/_nday_/${PeriodLengthInDays}/" \ |
---|
81 | -e "s/_raz_date_/${RAZ_DATE}/" \ |
---|
82 | run.def > run.def.tmp |
---|
83 | IGCM_sys_Mv run.def.tmp run.def |
---|
84 | |
---|
85 | IGCM_debug_PopStack "ATM_Update" |
---|
86 | } |
---|
87 | |
---|
88 | #----------------------------------- |
---|
89 | function ATM_Finalize |
---|
90 | { |
---|
91 | IGCM_debug_PushStack "ATM_Finalize" |
---|
92 | |
---|
93 | echo FINALIZE ATM ! |
---|
94 | |
---|
95 | IGCM_debug_PopStack "ATM_Finalize" |
---|
96 | } |
---|