source: CONFIG/LMDZINCA/branches/LMDZINCA_v3_1/CREATE/COMP/lmdz.driver @ 889

Last change on this file since 889 was 889, checked in by acosce, 14 years ago

ACo : update LMDZINCA_v3 config

1- add TS in inca.card
2- add repertory POST
3- change calendar by default (leap)


  • Property svn:executable set to *
File size: 3.9 KB
Line 
1#- $Id: lmdz.driver 868 2010-01-08 13:20:18Z 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    ## Mise en forme du fichier physiq.def
93    sed -e "s/OK_instan=.*/OK_instan=${OK_instan}/"     \
94        -e "s/OK_journe=.*/OK_journe=${OK_journe}/"     \
95        -e "s/OK_mensuel=.*/OK_mensuel=${OK_mensuel}/"  \
96        physiq.def > physiq.def.tmp
97    IGCM_sys_Mv physiq.def.tmp physiq.def
98
99    ## Mise en forme du fichier gcm.def
100    sed  -e "s/${PAT_ecritphy}/ecritphy=${ecritphy}/"   \
101        -e "s/${PAT_day_step}/day_step=${day_step}/"    \
102        -e "s/${PAT_iperiod}/iperiod=${iperiod}/"       \
103        -e "s/${PAT_iphysiq}/iphysiq=${iphysiq}/"       \
104        gcm.def > gcm.def.tmp
105    IGCM_sys_Mv gcm.def.tmp gcm.def
106
107    greg_dat=$( IGCM_date_ConvertFormatToGregorian $PeriodDateBegin ) 
108    jul_dat=$( IGCM_date_ConvertGregorianDateToJulian $greg_dat )
109    nbjour=$( expr \( $jul_dat \% 1000 \) ) 
110    yractu=$( expr $greg_dat / 10000  )
111    echo  "dayref = " $nbjour  "year actu = " $yractu
112
113    ## Mise en forme du fichier run.def
114    sed -e "s/_dayref_/${nbjour}/"                      \
115        -e "s/_anneeref_/${yractu}/"                    \
116        -e "s/_calend_/${CalendarTypeForLmdz}/"         \
117        -e "s/_nday_/${PeriodLengthInDays}/"            \
118        -e "s/_raz_date_/${RAZ_DATE}/"                  \
119        run.def > run.def.tmp
120    IGCM_sys_Mv run.def.tmp run.def
121
122    IGCM_debug_PopStack "ATM_Update"
123}
124
125#-----------------------------------
126function ATM_Finalize
127{
128    IGCM_debug_PushStack "ATM_Finalize"
129
130    echo FINALIZE ATM !
131
132    IGCM_debug_PopStack "ATM_Finalize"
133}
Note: See TracBrowser for help on using the repository browser.