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