source: CONFIG/LMDZORINCA/trunk/EXP_IPCC/COMP/lmdz.driver @ 644

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

ACo : update LMDZORINCA config + add a directory EXP_IPCC

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