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