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

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

SD : lmdz.driver can work with comments inside physiq.def and correctly
handle high frequency request through config card ATM section

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