source: CONFIG/trunk/LMDZINCA_v2/EXP_AER/COMP/lmdz.driver @ 267

Last change on this file since 267 was 267, checked in by acosce, 16 years ago

ACo : (LMDZINCA)

fixe a bug on platine

  • Property svn:keywords set to Id
File size: 3.1 KB
Line 
1#- $Id$
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
11
12    ##--Frequency purpose ....
13    ##--  Initialisation  ....
14    OK_instan=n
15    ##--
16    OK_journe=n
17    OK_mensuel=n
18
19    case ${config_UserChoices_PeriodLength} in
20        1Y|1y|1M|1m) OK_mensuel=y ;;
21        5D|5d|1D|1d) OK_journe=n ;;
22    esac
23
24    for frequency in ${config_ATM_WriteFrequency} ; do
25        case ${frequency} in
26            5D|5d|1D|1d) OK_journe=n ;;
27        esac
28    done
29
30    ##--Variables used by LMDZ --
31    PAT_INST=$(     grep 'OK_instan'   ${SUBMIT_DIR}/PARAM/physiq.def )
32    PAT_JOUR=$(     grep 'OK_journe'   ${SUBMIT_DIR}/PARAM/physiq.def )
33    PAT_MOIS=$(     grep 'OK_mensuel'  ${SUBMIT_DIR}/PARAM/physiq.def )
34
35    PAT_iphysiq=$(  grep 'iphysiq'     ${SUBMIT_DIR}/PARAM/gcm.def )
36    PAT_iperiod=$(  grep 'iperiod'     ${SUBMIT_DIR}/PARAM/gcm.def | tail -1)
37    PAT_day_step=$( grep 'day_step'    ${SUBMIT_DIR}/PARAM/gcm.def )
38    PAT_ecritphy=$( grep 'ecritphy'    ${SUBMIT_DIR}/PARAM/gcm.def )
39
40    ##-- This could be define in lmdz.card, inside section [UserChoices]
41    ##-- Otherwise we get the value in *.def
42    iperiod=$(grep iperiod ${SUBMIT_DIR}/PARAM/gcm.def | awk -F= '{print $2}' | tail -1)
43    iphysiq=$(grep iphysiq ${SUBMIT_DIR}/PARAM/gcm.def | awk -F= '{print $2}')
44    # day_step : number of steps per day (multiple of iperiod)
45    (( day_step = 48 * iphysiq ))
46
47    IGCM_debug_PopStack "ATM_Initialize"
48}
49
50#-----------------------------------------------------------------
51function ATM_Update
52{
53    IGCM_debug_PushStack "ATM_Update"
54
55    ecritphy=${PeriodLengthInDays}
56
57    ##-- Remise ou non a zero de la date initiale de LMDZ pour le fichier run.def
58    if [ ${CumulPeriod} -eq 1 ] ; then
59        RAZ_DATE=1
60    else
61        RAZ_DATE=0
62    fi
63
64    ## Mise en forme du fichier physiq.def
65    sed -e "s/OK_instan=.*/OK_instan=${OK_instan}/"   \
66        -e "s/OK_journe=.*/OK_journe=${OK_journe}/"   \
67        -e "s/OK_mensuel=.*/OK_mensuel=${OK_mensuel}/" \
68        physiq.def > physiq.def.tmp
69    IGCM_sys_Mv physiq.def.tmp physiq.def
70
71    ## Mise en forme du fichier gcm.def
72    sed  -e "s/${PAT_ecritphy}/ecritphy=${ecritphy}/" \
73        -e "s/${PAT_day_step}/day_step=${day_step}/" \
74        -e "s/${PAT_iperiod}/iperiod=${iperiod}/" \
75        -e "s/${PAT_iphysiq}/iphysiq=${iphysiq}/" \
76        gcm.def > gcm.def.tmp
77    IGCM_sys_Mv gcm.def.tmp gcm.def
78
79    greg_dat=$( IGCM_date_ConvertFormatToGregorian $PeriodDateBegin ) 
80    jul_dat=$( IGCM_date_ConvertGregorianDateToJulian $greg_dat )
81    nbjour=$( expr \( $jul_dat \% 1000 \) ) 
82    yractu=$( expr $greg_dat / 10000  )
83    echo  "dayref = " $nbjour  "year actu = " $yractu
84
85    ## Mise en forme du fichier run.def
86    sed -e "s/_dayref_/${nbjour}/" \
87        -e "s/_anneeref_/${yractu}/" \
88        -e "s/_nday_/${PeriodLengthInDays}/" \
89        -e "s/_raz_date_/${RAZ_DATE}/" \
90        run.def > run.def.tmp
91    IGCM_sys_Mv run.def.tmp run.def
92
93    IGCM_debug_PopStack "ATM_Update"
94}
95
96#-----------------------------------
97function ATM_Finalize
98{
99    IGCM_debug_PushStack "ATM_Finalize"
100
101    echo FINALIZE ATM !
102
103    IGCM_debug_PopStack "ATM_Finalize"
104}
Note: See TracBrowser for help on using the repository browser.