source: CONFIG/LMDZINCA/branches/LMDZINCA_v3_1/EXP_GES/COMP/lmdz.driver @ 591

Last change on this file since 591 was 591, checked in by acosce, 13 years ago

In LMDZINCA_v3 config : add copy of the BandsResol? file in lmdz.card

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