source: CONFIG/LMDZINCA/branches/LMDZINCA_v3_1/EXP_NMHC_AER/COMP/lmdz.driver @ 841

Last change on this file since 841 was 841, checked in by acosce, 13 years ago

ACo: Update config LMDZINCA (Rebuild on Archive - LMDZ calendar

  • Property svn:executable set to *
File size: 3.9 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        LMD14496)  BandsResol=144x96x19  ;;
14        LMD144142) BandsResol=144x142x19 ;;
15    esac
16
17    ##-- Calendar type for LMDZ
18    case ${config_UserChoices_CalendarType} in
19        leap|gregorian)
20            CalendarTypeForLmdz=earth_366d;;
21        noleap)
22            CalendarTypeForLmdz=earth_365d;;
23        360d)
24            CalendarTypeForLmdz=earth_360d;;
25        *)
26            CalendarTypeForLmdz=earth_360d
27    esac
28
29
30
31    ##- Default number of processor for lmdz
32    NUM_PROC_ATM=1
33    if [ X"${BATCH_NUM_PROC_TOT}" != X ] ; then
34        NUM_PROC_ATM=${BATCH_NUM_PROC_TOT}
35    fi
36 
37
38    ##--Frequency purpose ....
39    ##--  Initialisation  ....
40    OK_instan=n
41    ##--
42    OK_journe=n
43    OK_mensuel=y
44
45    case ${config_UserChoices_PeriodLength} in
46        1Y|1y|1M|1m) OK_mensuel=y ;;
47        5D|5d|1D|1d) OK_journe=n ;;
48    esac
49
50    for frequency in ${config_ATM_WriteFrequency} ; do
51        case ${frequency} in
52            5D|5d|1D|1d) OK_journe=n ;;
53        esac
54    done
55
56    ##--Variables used by LMDZ --
57    PAT_INST=$(     grep 'OK_instan'   ${SUBMIT_DIR}/PARAM/physiq.def )
58    PAT_JOUR=$(     grep 'OK_journe'   ${SUBMIT_DIR}/PARAM/physiq.def )
59    PAT_MOIS=$(     grep 'OK_mensuel'  ${SUBMIT_DIR}/PARAM/physiq.def )
60
61    PAT_iphysiq=$(  grep 'iphysiq'     ${SUBMIT_DIR}/PARAM/gcm.def )
62    PAT_iperiod=$(  grep 'iperiod'     ${SUBMIT_DIR}/PARAM/gcm.def | tail -1)
63    PAT_day_step=$( grep 'day_step'    ${SUBMIT_DIR}/PARAM/gcm.def )
64    PAT_ecritphy=$( grep 'ecritphy'    ${SUBMIT_DIR}/PARAM/gcm.def )
65
66    ##-- This could be define in lmdz.card, inside section [UserChoices]
67    ##-- Otherwise we get the value in *.def
68    iperiod=$(grep iperiod ${SUBMIT_DIR}/PARAM/gcm.def | awk -F= '{print $2}' | tail -1)
69    iphysiq=$(grep iphysiq ${SUBMIT_DIR}/PARAM/gcm.def | awk -F= '{print $2}')
70    # day_step : number of steps per day (multiple of iperiod)
71    (( day_step = 48 * iphysiq ))
72
73    IGCM_debug_PopStack "ATM_Initialize"
74}
75
76#-----------------------------------------------------------------
77function ATM_Update
78{
79    IGCM_debug_PushStack "ATM_Update"
80
81    ecritphy=${PeriodLengthInDays}
82
83    ##-- Remise ou non a zero de la date initiale de LMDZ pour le fichier run.def
84    if [ ${CumulPeriod} -eq 1 ] ; then
85        RAZ_DATE=1
86    else
87        RAZ_DATE=0
88    fi
89
90    ## Mise en forme du fichier physiq.def
91    sed -e "s/OK_instan=.*/OK_instan=${OK_instan}/"   \
92        -e "s/OK_journe=.*/OK_journe=${OK_journe}/"   \
93        -e "s/OK_mensuel=.*/OK_mensuel=${OK_mensuel}/" \
94        physiq.def > physiq.def.tmp
95    IGCM_sys_Mv physiq.def.tmp physiq.def
96
97    ## Mise en forme du fichier gcm.def
98    sed  -e "s/${PAT_ecritphy}/ecritphy=${ecritphy}/" \
99        -e "s/${PAT_day_step}/day_step=${day_step}/" \
100        -e "s/${PAT_iperiod}/iperiod=${iperiod}/" \
101        -e "s/${PAT_iphysiq}/iphysiq=${iphysiq}/" \
102        gcm.def > gcm.def.tmp
103    IGCM_sys_Mv gcm.def.tmp gcm.def
104
105    greg_dat=$( IGCM_date_ConvertFormatToGregorian $PeriodDateBegin ) 
106    jul_dat=$( IGCM_date_ConvertGregorianDateToJulian $greg_dat )
107    nbjour=$( expr \( $jul_dat \% 1000 \) ) 
108    yractu=$( expr $greg_dat / 10000  )
109    echo  "dayref = " $nbjour  "year actu = " $yractu
110
111    ## Mise en forme du fichier run.def
112    sed -e "s/_dayref_/${nbjour}/" \
113        -e "s/_anneeref_/${yractu}/" \
114        -e "s/_calend_/${CalendarTypeForLmdz}/"         \
115        -e "s/_nday_/${PeriodLengthInDays}/" \
116        -e "s/_raz_date_/${RAZ_DATE}/" \
117        run.def > run.def.tmp
118    IGCM_sys_Mv run.def.tmp run.def
119
120    IGCM_debug_PopStack "ATM_Update"
121}
122
123#-----------------------------------
124function ATM_Finalize
125{
126    IGCM_debug_PushStack "ATM_Finalize"
127
128    echo FINALIZE ATM !
129
130    IGCM_debug_PopStack "ATM_Finalize"
131}
Note: See TracBrowser for help on using the repository browser.