source: CONFIG/trunk/LMDZ4OR_v2/CREATE/COMP/lmdz.driver @ 197

Last change on this file since 197 was 197, checked in by mmaipsl, 17 years ago

First import of LMDZ4OR_v2 model.

File size: 2.9 KB
Line 
1#!/bin/ksh
2
3# MPI Variables
4ATM_PARA=0
5
6#-----------------------------------------------------------------
7function 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_${RESOL} )
37    PAT_iperiod=$(  grep 'iperiod'     ${SUBMIT_DIR}/PARAM/gcm.def_${RESOL} | tail -1)
38    PAT_day_step=$( grep 'day_step'    ${SUBMIT_DIR}/PARAM/gcm.def_${RESOL} )
39    PAT_ecritphy=$( grep 'ecritphy'    ${SUBMIT_DIR}/PARAM/gcm.def_${RESOL} )
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_${RESOL} | awk -F= '{print $2}' | tail -1)
44    iphysiq=$(grep iphysiq ${SUBMIT_DIR}/PARAM/gcm.def_${RESOL} | 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#-----------------------------------------------------------------
52function ATM_Update
53{
54    IGCM_debug_PushStack "ATM_Update"
55
56    ecritphy=${PeriodLengthInDays}
57
58    ##-- Remise ou non a zero de la date initiale de LMDZ pour le fichier run.def
59    if [ ${CumulPeriod} -eq 1 ] ; then
60        RAZ_DATE=1
61    else
62        RAZ_DATE=0
63    fi
64
65    ## Mise en forme du fichier physiq.def
66    sed -e "s/OK_instan=.*/OK_instan=${OK_instan}/"   \
67        -e "s/OK_journe=.*/OK_journe=${OK_journe}/"   \
68        -e "s/OK_mensuel=.*/OK_mensuel=${OK_mensuel}/" \
69        physiq.def > physiq.def.tmp
70    IGCM_sys_Mv physiq.def.tmp physiq.def
71
72    ## Mise en forme du fichier gcm.def
73    sed  -e "s/${PAT_ecritphy}/ecritphy=${ecritphy}/" \
74        -e "s/${PAT_day_step}/day_step=${day_step}/" \
75        -e "s/${PAT_iperiod}/iperiod=${iperiod}/" \
76        -e "s/${PAT_iphysiq}/iphysiq=${iphysiq}/" \
77        gcm.def > gcm.def.tmp
78    IGCM_sys_Mv gcm.def.tmp gcm.def
79
80    ## Mise en forme du fichier run.def
81    sed -e "s/_dayref_/${InitDay}/" \
82        -e "s/_anneeref_/${InitYear}/" \
83        -e "s/_nday_/${PeriodLengthInDays}/" \
84        -e "s/_raz_date_/${RAZ_DATE}/" \
85        run.def > run.def.tmp
86    IGCM_sys_Mv run.def.tmp run.def
87
88    IGCM_debug_PopStack "ATM_Update"
89}
90
91#-----------------------------------
92function ATM_Finalize
93{
94    IGCM_debug_PushStack "ATM_Finalize"
95
96    echo FINALIZE ATM !
97
98    IGCM_debug_PopStack "ATM_Finalize"
99}
Note: See TracBrowser for help on using the repository browser.