source: CONFIG/LMDZ/branches/LMDZ/COMP/lmdz.driver @ 541

Last change on this file since 541 was 541, checked in by jgipsl, 13 years ago

Added LMDZ4 forced configuration using the "old physics" of LMDZ with
possiblity to later add a second set parameter files to run "new
physics" in the same configuration. This configuration is adapted to the
latest LMDZ trunk version.

File size: 3.7 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    ##- Parameter files directory
23    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/lmdz.card UserChoices PARAM
24    PARAM=${lmdz_UserChoices_PARAM}
25    echo Parameter files directory : ${PARAM}
26
27    ##- Default number of processor for lmdz
28    NUM_PROC_ATM=1
29    if [ X"${BATCH_NUM_PROC_TOT}" != X ] ; then
30        NUM_PROC_ATM=${BATCH_NUM_PROC_TOT}
31    fi
32 
33    ##--Frequency purpose ....
34    ##--  Initialisation  ....
35    OK_instan=n
36    OK_journe=n
37    OK_mensuel=n
38    ok_hf=n
39
40    case ${config_UserChoices_PeriodLength} in
41        1Y|1y|1M|1m) OK_mensuel=y ;;
42        5D|5d|1D|1d) OK_journe=y ;;
43    esac
44
45    for frequency in ${config_ATM_WriteFrequency} ; do
46        case ${frequency} in
47            5D|5d|1D|1d) OK_journe=y ;;
48        esac
49        case ${frequency} in
50            HF|hf) ok_hf=y ;;
51        esac
52    done
53
54    ##--Variables used by LMDZ in gcm.def --
55    PAT_iphysiq=$(  grep -v ^# ${SUBMIT_DIR}/${PARAM}/gcm.def_${RESOL_ATM} | grep iphysiq  )
56    PAT_iperiod=$(  grep -v ^# ${SUBMIT_DIR}/${PARAM}/gcm.def_${RESOL_ATM} | grep iperiod  )
57
58    ## Read LMDZ_adjust option in ${compname}.card --> put adjust=y and save Bands_*.dat in ${SUBMIT_DIR}/${PARAM}
59    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/${compname}.card UserChoices LMDZ_adjust
60    eval LMDZ_adjust=\${${compname}_UserChoices_LMDZ_adjust} > /dev/null 2>&1
61
62    ##-- This could be define in lmdz.card, inside section [UserChoices]
63    ##-- Otherwise we get the value in *.def
64    iperiod=$( echo ${PAT_iperiod} | awk -F= '{print $2}' )
65    iphysiq=$( echo ${PAT_iphysiq} | awk -F= '{print $2}' )
66
67    # day_step : number of steps per day (multiple of iperiod and iphysiq)
68    (( day_step = 48 * iphysiq ))
69
70    IGCM_debug_PopStack "ATM_Initialize"
71}
72
73#-----------------------------------------------------------------
74function ATM_Update
75{
76    IGCM_debug_PushStack "ATM_Update"
77
78#    ecritphy=${PeriodLengthInDays}
79
80    ##-- Remise ou non a zero de la date initiale de LMDZ pour le fichier run.def
81    if [ ${CumulPeriod} -eq 1 ] ; then
82        RAZ_DATE=1
83    else
84        RAZ_DATE=0
85    fi
86
87    ## Mise en forme du fichier physiq.def
88    sed -e "s/_ok_instan_/${OK_instan}/"              \
89        -e "s/_ok_journe_/${OK_journe}/"              \
90        -e "s/_ok_mensuel_/${OK_mensuel}/"            \
91        -e "s/_ok_hf_/${OK_hf}/"                      \
92        physiq.def > physiq.def.tmp
93    IGCM_sys_Mv physiq.def.tmp physiq.def
94
95    ## Mise en forme du fichier gcm.def
96    sed -e "s/_day_step_/${day_step}/"                \
97        -e "s/${PAT_iperiod}/iperiod=${iperiod}/"     \
98        -e "s/${PAT_iphysiq}/iphysiq=${iphysiq}/"     \
99        gcm.def > gcm.def.tmp
100    IGCM_sys_Mv gcm.def.tmp gcm.def
101
102    ## Mise en forme du fichier run.def
103    sed -e "s/_dayref_/${InitDay}/"                    \
104        -e "s/_anneeref_/${InitYear}/"                 \
105        -e "s/_nday_/${PeriodLengthInDays}/"           \
106        -e "s/_raz_date_/${RAZ_DATE}/"                 \
107        -e "s/_adjust_/${LMDZ_adjust}/"                \
108        run.def > run.def.tmp
109    IGCM_sys_Mv run.def.tmp run.def
110
111    IGCM_debug_PopStack "ATM_Update"
112}
113
114#-----------------------------------
115function ATM_Finalize
116{
117    IGCM_debug_PushStack "ATM_Finalize"
118
119    [ ${LMDZ_adjust} = y ] && IGCM_sys_Cp Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat ${SUBMIT_DIR}/${PARAM}
120
121    echo FINALIZE ATM !
122
123    IGCM_debug_PopStack "ATM_Finalize"
124}
Note: See TracBrowser for help on using the repository browser.