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