source: CONFIG/trunk/LMDZINCA/EXP_CH4_AER/COMP/lmdz.driver @ 435

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

ACo : (LMDZINCA)

fixe a bug on platine

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