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