source: CONFIG/LMDZORINCA/trunk/EXP_AER/COMP/lmdz.driver @ 615

Last change on this file since 615 was 615, checked in by acosce, 15 years ago

ACo : update LMDZORINCA config

  • Property svn:executable set to *
File size: 3.5 KB
Line 
1#- $Id: lmdz.driver 591 2009-03-27 08:41:41Z acosce $
2#!/bin/ksh
3
4#-----------------------------------------------------------------
5function ATM_Initialize
6{
7    IGCM_debug_PushStack "ATM_Initialize"
8
9    RESOL_ATM=$( echo $RESOL | awk "-Fx" '{print $2}' )
10    case ${RESOL_ATM} in
11        LMD7245)   BandsResol=72x45x19   ;;
12        LMD9671)   BandsResol=96x71x19   ;;
13        LMD9672)   BandsResol=96x72x19   ;;
14        LMD14496)  BandsResol=144x96x19  ;;
15        LMD144142) BandsResol=144x142x19 ;;
16    esac
17
18    ##- Default number of processor for lmdz
19    NUM_PROC_ATM=1
20    if [ X"${BATCH_NUM_PROC_TOT}" != X ] ; then
21        NUM_PROC_ATM=${BATCH_NUM_PROC_TOT}
22    fi
23
24    ##--Frequency purpose ....
25    ##--  Initialisation  ....
26    OK_instan=n
27    ##--
28    OK_journe=n
29    OK_mensuel=n
30
31    case ${config_UserChoices_PeriodLength} in
32        1Y|1y|1M|1m) OK_mensuel=y ;;
33        5D|5d|1D|1d) OK_journe=n ;;
34    esac
35
36    for frequency in ${config_ATM_WriteFrequency} ; do
37        case ${frequency} in
38            5D|5d|1D|1d) OK_journe=n ;;
39        esac
40    done
41
42    ##--Variables used by LMDZ --
43    PAT_INST=$(     grep 'OK_instan'   ${SUBMIT_DIR}/PARAM/physiq.def )
44    PAT_JOUR=$(     grep 'OK_journe'   ${SUBMIT_DIR}/PARAM/physiq.def )
45    PAT_MOIS=$(     grep 'OK_mensuel'  ${SUBMIT_DIR}/PARAM/physiq.def )
46
47    PAT_iphysiq=$(  grep 'iphysiq'     ${SUBMIT_DIR}/PARAM/gcm.def )
48    PAT_iperiod=$(  grep 'iperiod'     ${SUBMIT_DIR}/PARAM/gcm.def | tail -1)
49    PAT_day_step=$( grep 'day_step'    ${SUBMIT_DIR}/PARAM/gcm.def )
50    PAT_ecritphy=$( grep 'ecritphy'    ${SUBMIT_DIR}/PARAM/gcm.def )
51
52    ##-- This could be define in lmdz.card, inside section [UserChoices]
53    ##-- Otherwise we get the value in *.def
54    iperiod=$(grep iperiod ${SUBMIT_DIR}/PARAM/gcm.def | awk -F= '{print $2}' | tail -1)
55    iphysiq=$(grep iphysiq ${SUBMIT_DIR}/PARAM/gcm.def | awk -F= '{print $2}')
56    # day_step : number of steps per day (multiple of iperiod)
57    (( day_step = 48 * iphysiq ))
58
59    IGCM_debug_PopStack "ATM_Initialize"
60}
61
62#-----------------------------------------------------------------
63function ATM_Update
64{
65    IGCM_debug_PushStack "ATM_Update"
66
67    ecritphy=${PeriodLengthInDays}
68
69    ##-- Remise ou non a zero de la date initiale de LMDZ pour le fichier run.def
70    if [ ${CumulPeriod} -eq 1 ] ; then
71        RAZ_DATE=1
72    else
73        RAZ_DATE=0
74    fi
75
76    ## Mise en forme du fichier physiq.def
77    sed -e "s/OK_instan=.*/OK_instan=${OK_instan}/"   \
78        -e "s/OK_journe=.*/OK_journe=${OK_journe}/"   \
79        -e "s/OK_mensuel=.*/OK_mensuel=${OK_mensuel}/" \
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    greg_dat=$( IGCM_date_ConvertFormatToGregorian $PeriodDateBegin ) 
92    jul_dat=$( IGCM_date_ConvertGregorianDateToJulian $greg_dat )
93    nbjour=$( expr \( $jul_dat \% 1000 \) ) 
94    yractu=$( expr $greg_dat / 10000  )
95    echo  "dayref = " $nbjour  "year actu = " $yractu
96
97    ## Mise en forme du fichier run.def
98    sed -e "s/_dayref_/${nbjour}/" \
99        -e "s/_anneeref_/${yractu}/" \
100        -e "s/_nday_/${PeriodLengthInDays}/" \
101        -e "s/_raz_date_/${RAZ_DATE}/" \
102        run.def > run.def.tmp
103    IGCM_sys_Mv run.def.tmp run.def
104
105    IGCM_debug_PopStack "ATM_Update"
106}
107
108#-----------------------------------
109function ATM_Finalize
110{
111    IGCM_debug_PushStack "ATM_Finalize"
112
113    echo FINALIZE ATM !
114
115    IGCM_debug_PopStack "ATM_Finalize"
116}
Note: See TracBrowser for help on using the repository browser.