source: CONFIG/trunk/LMDZ4OR_v2/LMDZOR/COMP/lmdz.driver @ 334

Last change on this file since 334 was 334, checked in by jgipsl, 16 years ago
  • Adapted to changes in CREATE job
  • Added lmdz.card_Interannuel for interannuel run (before as comments in lmdz.card)
File size: 4.1 KB
Line 
1# $Id$
2#
3#!/bin/ksh
4#-----------------------------------------------------------------
5function ATM_Initialize
6{
7    IGCM_debug_PushStack "ATM_Initialize"
8
9    RESOL_ATM=${RESOL}
10    case ${RESOL_ATM} in
11        LMD7245)   BandsResol=72x45x19   ;;
12        LMD9671)   BandsResol=96x71x19   ;;
13        LMD14496)  BandsResol=144x96x19  ;;
14        LMD144142) BandsResol=144x142x19 ;;
15    esac
16
17    ##- Create_etat0_limit version
18    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/lmdz.card UserChoices CREATE
19    CREATE=${lmdz_UserChoices_CREATE}
20    echo create_etat0_limit version : ${CREATE}
21
22    ##- Default number of processor for lmdz
23    NUM_PROC_ATM=1
24    if [ X"${BATCH_NUM_PROC_TOT}" != X ] ; then
25        NUM_PROC_ATM=${BATCH_NUM_PROC_TOT}
26    fi
27 
28    ##--Frequency purpose ....
29    ##--  Initialisation  ....
30    OK_instan=n
31    OK_journe=n
32    OK_mensuel=n
33    ok_hf=n
34
35    case ${config_UserChoices_PeriodLength} in
36        1Y|1y|1M|1m) OK_mensuel=y ;;
37        5D|5d|1D|1d) OK_journe=y ;;
38    esac
39
40    for frequency in ${config_ATM_WriteFrequency} ; do
41        case ${frequency} in
42            5D|5d|1D|1d) OK_journe=y ;;
43        esac
44        case ${frequency} in
45            HF|hf) ok_hf=y ;;
46        esac
47    done
48
49    ##--Variables used by LMDZ in physiq.def --
50    PAT_INST=$(     grep -v ^# ${SUBMIT_DIR}/PARAM/physiq.def  | grep 'OK_instan'  )
51    PAT_JOUR=$(     grep -v ^# ${SUBMIT_DIR}/PARAM/physiq.def  | grep 'OK_journe'  )
52    PAT_MOIS=$(     grep -v ^# ${SUBMIT_DIR}/PARAM/physiq.def  | grep 'OK_mensuel' )
53    PAT_HFRE=$(     grep -v ^# ${SUBMIT_DIR}/PARAM/physiq.def  | grep 'ok_hf'      )
54
55    ##--Variables used by LMDZ in gcm.def --
56    PAT_iphysiq=$(  grep -v ^# ${SUBMIT_DIR}/PARAM/gcm.def_${RESOL_ATM} | grep iphysiq  )
57    PAT_iperiod=$(  grep -v ^# ${SUBMIT_DIR}/PARAM/gcm.def_${RESOL_ATM} | grep iperiod  )
58    PAT_day_step=$( grep -v ^# ${SUBMIT_DIR}/PARAM/gcm.def_${RESOL_ATM} | grep day_step )
59    PAT_ecritphy=$( grep -v ^# ${SUBMIT_DIR}/PARAM/gcm.def_${RESOL_ATM} | grep ecritphy )
60
61    ## Read LMDZ_adjust option in ${compname}.card --> put adjust=y and save Bands_*.dat in ${SUBMIT_DIR}/PARAM
62    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/${compname}.card UserChoices LMDZ_adjust
63    eval LMDZ_adjust=\${${compname}_UserChoices_LMDZ_adjust} > /dev/null 2>&1
64
65    ##-- This could be define in lmdz.card, inside section [UserChoices]
66    ##-- Otherwise we get the value in *.def
67    iperiod=$( echo ${PAT_iperiod} | awk -F= '{print $2}' )
68    iphysiq=$( echo ${PAT_iphysiq} | awk -F= '{print $2}' )
69
70    # day_step : number of steps per day (multiple of iperiod)
71    (( day_step = 48 * iphysiq ))
72
73    IGCM_debug_PopStack "ATM_Initialize"
74}
75
76#-----------------------------------------------------------------
77function ATM_Update
78{
79    IGCM_debug_PushStack "ATM_Update"
80
81    ecritphy=${PeriodLengthInDays}
82
83    ##-- Remise ou non a zero de la date initiale de LMDZ pour le fichier run.def
84    if [ ${CumulPeriod} -eq 1 ] ; then
85        RAZ_DATE=1
86    else
87        RAZ_DATE=0
88    fi
89
90    ## Mise en forme du fichier physiq.def
91    sed -e "s/${PAT_INST}/OK_instan=${OK_instan}/"    \
92        -e "s/${PAT_JOUR}/OK_journe=${OK_journe}/"    \
93        -e "s/${PAT_MOIS}/OK_mensuel=${OK_mensuel}/"  \
94        -e "s/${PAT_HFRE}/ok_hf=${ok_hf}/"            \
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    ## Mise en forme du fichier run.def
107    sed -e "s/_dayref_/${InitDay}/"                    \
108        -e "s/_anneeref_/${InitYear}/"                 \
109        -e "s/_nday_/${PeriodLengthInDays}/"           \
110        -e "s/_raz_date_/${RAZ_DATE}/"                 \
111        -e "s/_adjust_/${LMDZ_adjust}/"                \
112        run.def > run.def.tmp
113    IGCM_sys_Mv run.def.tmp run.def
114
115    IGCM_debug_PopStack "ATM_Update"
116}
117
118#-----------------------------------
119function ATM_Finalize
120{
121    IGCM_debug_PushStack "ATM_Finalize"
122
123    [ ${LMDZ_adjust} = y ] && IGCM_sys_Cp Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat ${SUBMIT_DIR}/PARAM
124
125    echo FINALIZE ATM !
126
127    IGCM_debug_PopStack "ATM_Finalize"
128}
Note: See TracBrowser for help on using the repository browser.