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