source: CONFIG/LMDZORINCA/tags/LMDZORINCA_v4_1/CREATE/COMP/lmdz.driver @ 6923

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

ACo: update LMDZORINCA config

1- add TS in inca.card
2- add repertory POST for monitoring
3- change calendar by default (now : leap) and limit files

  • Property svn:executable set to *
File size: 3.9 KB
Line 
1#- $Id: lmdz.driver 841 2009-12-08 09:48:13Z 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        LMD9695)   BandsResol=96x95x19   ;;
15        LMD14496)  BandsResol=144x96x19  ;;
16        LMD144142) BandsResol=144x142x19 ;;
17    esac
18
19
20    ##-- Calendar type for LMDZ
21    case ${config_UserChoices_CalendarType} in
22        leap|gregorian)
23            CalendarTypeForLmdz=earth_366d;;
24        noleap)
25            CalendarTypeForLmdz=earth_365d;;
26        360d)
27            CalendarTypeForLmdz=earth_360d;;
28        *)
29            CalendarTypeForLmdz=earth_360d
30    esac
31
32    ##- Default number of processor for lmdz
33    NUM_PROC_ATM=1
34    if [ X"${BATCH_NUM_PROC_TOT}" != X ] ; then
35        NUM_PROC_ATM=${BATCH_NUM_PROC_TOT}
36    fi
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
67
68    ##-- This could be define in lmdz.card, inside section [UserChoices]
69    ##-- Otherwise we get the value in *.def
70    iperiod=$(grep iperiod ${SUBMIT_DIR}/PARAM/gcm.def | awk -F= '{print $2}' | tail -1)
71    iphysiq=$(grep iphysiq ${SUBMIT_DIR}/PARAM/gcm.def | awk -F= '{print $2}')
72    # day_step : number of steps per day (multiple of iperiod)
73    (( day_step = 48 * iphysiq ))
74
75    IGCM_debug_PopStack "ATM_Initialize"
76}
77
78#-----------------------------------------------------------------
79function ATM_Update
80{
81    IGCM_debug_PushStack "ATM_Update"
82
83    ecritphy=${PeriodLengthInDays}
84
85    ##-- Remise ou non a zero de la date initiale de LMDZ pour le fichier run.def
86    if [ ${CumulPeriod} -eq 1 ] ; then
87        RAZ_DATE=1
88    else
89        RAZ_DATE=0
90    fi
91
92
93    ## Mise en forme du fichier physiq.def
94    sed -e "s/OK_instan=.*/OK_instan=${OK_instan}/"     \
95        -e "s/OK_journe=.*/OK_journe=${OK_journe}/"     \
96        -e "s/OK_mensuel=.*/OK_mensuel=${OK_mensuel}/"  \
97        physiq.def > physiq.def.tmp
98    IGCM_sys_Mv physiq.def.tmp physiq.def
99
100    ## Mise en forme du fichier gcm.def
101    sed  -e "s/${PAT_ecritphy}/ecritphy=${ecritphy}/"   \
102        -e "s/${PAT_day_step}/day_step=${day_step}/"    \
103        -e "s/${PAT_iperiod}/iperiod=${iperiod}/"       \
104        -e "s/${PAT_iphysiq}/iphysiq=${iphysiq}/"       \
105        gcm.def > gcm.def.tmp
106    IGCM_sys_Mv gcm.def.tmp gcm.def
107
108    greg_dat=$( IGCM_date_ConvertFormatToGregorian $PeriodDateBegin ) 
109    jul_dat=$( IGCM_date_ConvertGregorianDateToJulian $greg_dat )
110    nbjour=$( expr \( $jul_dat \% 1000 \) ) 
111    yractu=$( expr $greg_dat / 10000  )
112    echo  "dayref = " $nbjour  "year actu = " $yractu
113
114    ## Mise en forme du fichier run.def
115    sed -e "s/_dayref_/${nbjour}/"                      \
116        -e "s/_anneeref_/${yractu}/"                    \
117        -e "s/_calend_/${CalendarTypeForLmdz}/"         \
118        -e "s/_nday_/${PeriodLengthInDays}/"            \
119        -e "s/_raz_date_/${RAZ_DATE}/"                  \
120        run.def > run.def.tmp
121    IGCM_sys_Mv run.def.tmp run.def
122
123    IGCM_debug_PopStack "ATM_Update"
124}
125
126#-----------------------------------
127function ATM_Finalize
128{
129    IGCM_debug_PushStack "ATM_Finalize"
130
131    echo FINALIZE ATM !
132
133    IGCM_debug_PopStack "ATM_Finalize"
134}
Note: See TracBrowser for help on using the repository browser.