source: CONFIG/trunk/IPSLCM4_v2/EXP00/COMP/lmdz.driver @ 284

Last change on this file since 284 was 284, checked in by sdipsl, 16 years ago

SD : Add MGV resolution

File size: 3.9 KB
Line 
1#!/bin/ksh
2#-----------------------------------------------------------------
3function ATM_Initialize
4{
5    IGCM_debug_PushStack "ATM_Initialize"
6
7    RESOL_ATM=$( echo $RESOL | awk "-Fx" '{print $2}' )
8
9    case ${RESOL_ATM} in
10        LMD4443)   BandsResol=44x43x19   ;;
11        LMD7245)   BandsResol=72x45x19   ;;
12        LMD9671)   BandsResol=96x71x19   ;;
13        LMD14496)  BandsResol=144x96x19  ;;
14        LMD144142) BandsResol=144x142x19 ;;
15    esac
16
17    ##--Frequency purpose ....
18    ##--  Initialisation  ....
19    OK_instan=n
20    OK_journe=n
21    OK_mensuel=n
22    ok_hf=n
23
24    case ${config_UserChoices_PeriodLength} in
25        1Y|1y|1M|1m) OK_mensuel=y ;;
26        5D|5d|1D|1d) OK_journe=y ;;
27    esac
28
29    for frequency in ${config_ATM_WriteFrequency} ; do
30        case ${frequency} in
31            5D|5d|1D|1d) OK_journe=y ;;
32        esac
33        case ${frequency} in
34            HF|hf) ok_hf=y ;;
35        esac
36    done
37
38    ##--Variables used by LMDZ --
39    PAT_INST=$(     grep -v ^# ${SUBMIT_DIR}/PARAM/physiq.def  | grep 'OK_instan'  )
40    PAT_JOUR=$(     grep -v ^# ${SUBMIT_DIR}/PARAM/physiq.def  | grep 'OK_journe'  )
41    PAT_MOIS=$(     grep -v ^# ${SUBMIT_DIR}/PARAM/physiq.def  | grep 'OK_mensuel' )
42    PAT_HFRE=$(     grep -v ^# ${SUBMIT_DIR}/PARAM/physiq.def  | grep 'ok_hf'      )
43
44    PAT_iphysiq=$(  grep -v ^# ${SUBMIT_DIR}/PARAM/gcm.def_${RESOL_ATM} | grep iphysiq  )
45    PAT_iperiod=$(  grep -v ^# ${SUBMIT_DIR}/PARAM/gcm.def_${RESOL_ATM} | grep iperiod  )
46    PAT_day_step=$( grep -v ^# ${SUBMIT_DIR}/PARAM/gcm.def_${RESOL_ATM} | grep day_step )
47    PAT_ecritphy=$( grep -v ^# ${SUBMIT_DIR}/PARAM/gcm.def_${RESOL_ATM} | grep ecritphy )
48
49    ##-- This could be define in lmdz.card, inside section [UserChoices]
50    ##-- Otherwise we get the value in *.def
51    iperiod=$( echo ${PAT_iperiod} | awk -F= '{print $2}' )
52    iphysiq=$( echo ${PAT_iphysiq} | awk -F= '{print $2}' )
53    # day_step : number of steps per day (multiple of iperiod)
54    (( day_step = 48 * iphysiq ))
55
56    #[ -f ${SUBMIT_DIR}/PARAM/Bands_${BandsResol}_7prc.dat ] && IGCM_sys_Cp ${SUBMIT_DIR}/PARAM/Bands_${BandsResol}_7prc.dat .
57
58    IGCM_debug_PopStack "ATM_Initialize"
59}
60
61#-----------------------------------------------------------------
62function ATM_Update
63{
64    IGCM_debug_PushStack "ATM_Update"
65
66    ecritphy=${PeriodLengthInDays}
67
68    ##-- Remise ou non a zero de la date initiale de LMDZ pour le fichier run.def
69    if [ ${CumulPeriod} -eq 1 ] ; then
70        RAZ_DATE=1
71    else
72        RAZ_DATE=0
73    fi
74
75    ## Mise en forme du fichier physiq.def
76    sed -e "s/OK_instan=.*/OK_instan=${OK_instan}/"   \
77        -e "s/OK_journe=.*/OK_journe=${OK_journe}/"   \
78        -e "s/OK_mensuel=.*/OK_mensuel=${OK_mensuel}/" \
79        -e "s/ok_hf=.*/ok_hf=${ok_hf}/" \
80        physiq.def > physiq.def.tmp
81    IGCM_sys_Mv physiq.def.tmp physiq.def
82
83    ## Mise en forme du fichier gcm.def
84    sed  -e "s/${PAT_ecritphy}/ecritphy=${ecritphy}/" \
85        -e "s/${PAT_day_step}/day_step=${day_step}/" \
86        -e "s/${PAT_iperiod}/iperiod=${iperiod}/" \
87        -e "s/${PAT_iphysiq}/iphysiq=${iphysiq}/" \
88        gcm.def > gcm.def.tmp
89    IGCM_sys_Mv gcm.def.tmp gcm.def
90
91    ## Mise en forme du fichier run.def
92    sed -e "s/_dayref_/${InitDay}/" \
93        -e "s/_anneeref_/${InitYear}/" \
94        -e "s/_nday_/${PeriodLengthInDays}/" \
95        -e "s/_raz_date_/${RAZ_DATE}/" \
96        run.def > run.def.tmp
97    IGCM_sys_Mv run.def.tmp run.def
98
99    if ( ${FirstInitialize} ) ; then
100
101        if ( [ "${config_Restarts_OverRule}" = "n" ] && [ "${config_ATM_Restart}" = "n" ] ); then
102            if [ ${DRYRUN} -le 2 ] ; then
103                IGCM_sys_Cp ${R_EXE}/create_etat0_limit.e ${RUN_DIR}/.
104                if [ ${DRYRUN} -le 1 ] ; then
105                    ./create_etat0_limit.e
106                fi
107            else
108                echo "EXECUTION of ./create_etat0_limit.e simulated"
109                echo "EXECUTION of ./create_etat0_limit.e simulated for DRYRUN = " $DRYRUN >> stack
110            fi
111        fi
112
113    fi
114
115    IGCM_debug_PopStack "ATM_Update"
116}
117
118#-----------------------------------
119function ATM_Finalize
120{
121    IGCM_debug_PushStack "ATM_Finalize"
122
123    echo FINALIZE ATM !
124
125    #IGCM_sys_Cp Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat ${SUBMIT_DIR}/PARAM
126
127    IGCM_debug_PopStack "ATM_Finalize"
128}
Note: See TracBrowser for help on using the repository browser.