source: CONFIG/trunk/LMDZINCA_v2/EXP_NMHC_AER/COMP/lmdz.driver @ 229

Last change on this file since 229 was 229, checked in by acosce, 17 years ago

ACo : change lmdz.driver in LMDZINCA for taking in account the real date in run.def

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