source: CONFIG/IPSLCM/IPSLCM5/trunk/EXP00/COMP/lmdz.driver @ 579

Last change on this file since 579 was 579, checked in by aclsce, 15 years ago

Modified IPSLCM5 configuration :

  • changed nemo by opa9 as component name (config.card, opa9.driver, opa9.card)
  • added 5655 resolution
  • Default resolution ORCA2_LMD9695
  • Modified coupling mode : now conservative mode
  • Added diaeiv cpp key and diaptr calculation
  • Changed ORCA2.1 by ORCA2.2 (to allow diaptr atlas)
File size: 5.9 KB
Line 
1#!/bin/ksh
2#-----------------------------------------------------------------
3function ATM_Initialize
4{
5    IGCM_debug_PushStack "ATM_Initialize"
6
7    RESOL_ATM=$( echo $RESOL | awk "-Fx" '{print $2}' )
8
9    case ${RESOL_ATM} in
10        LMD4443)   BandsResol=44x43x19   ;;
11        LMD7245)   BandsResol=72x45x19   ;;
12        LMD5655)   BandsResol=56x55x19   ;;
13        LMD9671)   BandsResol=96x71x19   ;;
14        LMD9695)   BandsResol=96x95x19   ;;
15        LMD14496)  BandsResol=144x96x19  ;;
16        LMD144142) BandsResol=144x142x19 ;;
17    esac
18
19    ##--Frequency purpose ....
20    ##--  Initialisation  ....
21    OK_instan=n
22    OK_journe=n
23    OK_mensuel=n
24    ok_hf=n
25
26    case ${config_UserChoices_PeriodLength} in
27        1Y|1y|1M|1m) OK_mensuel=y ;;
28        5D|5d|1D|1d) OK_journe=y ;;
29    esac
30
31    for frequency in ${config_ATM_WriteFrequency} ; do
32        case ${frequency} in
33            5D|5d|1D|1d) OK_journe=y ;;
34        esac
35        case ${frequency} in
36            HF|hf) ok_hf=y ;;
37        esac
38    done
39
40    ##--Variables used by LMDZ in physiq.def --
41    PAT_INST=$(     grep -v ^# ${SUBMIT_DIR}/PARAM/physiq.def  | grep 'OK_instan'  )
42    PAT_JOUR=$(     grep -v ^# ${SUBMIT_DIR}/PARAM/physiq.def  | grep 'OK_journe'  )
43    PAT_MOIS=$(     grep -v ^# ${SUBMIT_DIR}/PARAM/physiq.def  | grep 'OK_mensuel' )
44    PAT_HFRE=$(     grep -v ^# ${SUBMIT_DIR}/PARAM/physiq.def  | grep 'ok_hf'      )
45    ##--Variables used by LMDZ in gcm.def --
46    PAT_iphysiq=$(  grep -v ^# ${SUBMIT_DIR}/PARAM/gcm.def_${RESOL_ATM} | grep iphysiq  )
47    PAT_iperiod=$(  grep -v ^# ${SUBMIT_DIR}/PARAM/gcm.def_${RESOL_ATM} | grep iperiod  )
48    PAT_day_step=$( grep -v ^# ${SUBMIT_DIR}/PARAM/gcm.def_${RESOL_ATM} | grep day_step )
49    PAT_ecritphy=$( grep -v ^# ${SUBMIT_DIR}/PARAM/gcm.def_${RESOL_ATM} | grep ecritphy )
50
51    ## Read LMDZ_adjust option in ${compname}.card --> put adjust=y and save Bands_*.dat in ${SUBMIT_DIR}/PARAM
52    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/${compname}.card UserChoices LMDZ_adjust
53    eval LMDZ_adjust=\${${compname}_UserChoices_LMDZ_adjust} > /dev/null 2>&1
54
55    ##-- This could be define in lmdz.card, inside section [UserChoices]
56    ##-- Otherwise we get the value in *.def
57    iperiod=$( echo ${PAT_iperiod} | awk -F= '{print $2}' )
58    iphysiq=$( echo ${PAT_iphysiq} | awk -F= '{print $2}' )
59    # day_step : number of steps per day (multiple of iperiod)
60    (( day_step = 48 * iphysiq ))
61
62    #[ -f ${SUBMIT_DIR}/PARAM/Bands_${BandsResol}_7prc.dat ] && IGCM_sys_Cp ${SUBMIT_DIR}/PARAM/Bands_${BandsResol}_7prc.dat .
63
64    IGCM_debug_PopStack "ATM_Initialize"
65}
66
67#-----------------------------------------------------------------
68function ATM_Update
69{
70    IGCM_debug_PushStack "ATM_Update"
71
72    ecritphy=${PeriodLengthInDays}
73
74    ##-- Remise ou non a zero de la date initiale de LMDZ pour le fichier run.def
75    if [ ${CumulPeriod} -eq 1 ] ; then
76        RAZ_DATE=1
77    else
78        RAZ_DATE=0
79    fi
80
81    ## Mise en forme du fichier physiq.def
82    sed -e "s/OK_instan=.*/OK_instan=${OK_instan}/"    \
83        -e "s/OK_journe=.*/OK_journe=${OK_journe}/"    \
84        -e "s/OK_mensuel=.*/OK_mensuel=${OK_mensuel}/" \
85        -e "s/ok_hf=.*/ok_hf=${ok_hf}/"                \
86        physiq.def > physiq.def.tmp
87    IGCM_sys_Mv physiq.def.tmp physiq.def
88
89    ## Mise en forme du fichier gcm.def
90    sed -e "s/${PAT_ecritphy}/ecritphy=${ecritphy}/"   \
91        -e "s/${PAT_day_step}/day_step=${day_step}/"   \
92        -e "s/${PAT_iperiod}/iperiod=${iperiod}/"      \
93        -e "s/${PAT_iphysiq}/iphysiq=${iphysiq}/"      \
94        gcm.def > gcm.def.tmp
95    IGCM_sys_Mv gcm.def.tmp gcm.def
96
97    ## Mise en forme du fichier run.def
98    sed -e "s/_dayref_/${InitDay}/"                    \
99        -e "s/_anneeref_/${InitYear}/"                 \
100        -e "s/_nday_/${PeriodLengthInDays}/"           \
101        -e "s/_raz_date_/${RAZ_DATE}/"                 \
102        -e "s/_adjust_/${LMDZ_adjust}/"                \
103        run.def > run.def.tmp
104    IGCM_sys_Mv run.def.tmp run.def
105
106    ## Read ByPass_hgardfou_teta option in ${compname}.card --> divide teta* by 2 if [ $ByPass_hgardfou_teta = 1 ]
107    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/${compname}.card UserChoices ByPass_hgardfou_teta
108    eval ByPass_hgardfou_teta=\${${compname}_UserChoices_ByPass_hgardfou_teta} > /dev/null 2>&1
109    if [ ${ByPass_hgardfou_teta} = y ] ; then
110        awk '{ if ($0 ~ /^teta.*=/) {split($0,a,"=") ; print a[1]"="a[2]/2"."} else print $0}' gcm.def > gcm.def.tmp
111        IGCM_sys_Mv gcm.def.tmp gcm.def
112        echo
113        IGCM_debug_Print 1 "ByPass_hgardfou_teta : ^teta*/2 in gcm.def"
114        echo
115        cat gcm.def
116        ByPass_hgardfou_teta=n
117        IGCM_card_WriteOption ${SUBMIT_DIR}/COMP/${compname}.card UserChoices ByPass_hgardfou_teta "${ByPass_hgardfou_teta}"
118    fi
119
120    ## Read ByPass_hgardfou_mats option in ${compname}.card --> purmats=y 2 if [ $ByPass_hgardfou_mats = 1 ]
121    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/${compname}.card UserChoices ByPass_hgardfou_mats
122    eval ByPass_hgardfou_mats=\${${compname}_UserChoices_ByPass_hgardfou_mats} > /dev/null 2>&1
123    if [ ${ByPass_hgardfou_mats} = y ] ; then
124        sed -e "s/^purmats=.*/purmats=y/" gcm.def > gcm.def.tmp
125        IGCM_sys_Mv gcm.def.tmp gcm.def
126        echo
127        IGCM_debug_Print 1 "ByPass_hgardfou_mats : purmats=y in gcm.def"
128        echo
129        cat gcm.def
130        ByPass_hgardfou_mats=n
131        IGCM_card_WriteOption ${SUBMIT_DIR}/COMP/${compname}.card UserChoices ByPass_hgardfou_mats "${ByPass_hgardfou_mats}"
132    fi
133
134    if ( ${FirstInitialize} ) ; then
135
136        if ( [ "${config_Restarts_OverRule}" = "n" ] && [ "${config_ATM_Restart}" = "n" ] ); then
137            if [ ${DRYRUN} -le 2 ] ; then
138                IGCM_sys_Cp ${R_EXE}/create_etat0_limit.e ${RUN_DIR}/.
139                if [ ${DRYRUN} -le 1 ] ; then
140                    ./create_etat0_limit.e
141                fi
142            else
143                echo "EXECUTION of ./create_etat0_limit.e simulated"
144                echo "EXECUTION of ./create_etat0_limit.e simulated for DRYRUN = " $DRYRUN >> stack
145            fi
146        fi
147
148    fi
149
150    IGCM_debug_PopStack "ATM_Update"
151}
152
153#-----------------------------------
154function ATM_Finalize
155{
156    IGCM_debug_PushStack "ATM_Finalize"
157
158    [ ${LMDZ_adjust} = y ] && IGCM_sys_Cp Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat ${SUBMIT_DIR}/PARAM
159
160    echo FINALIZE ATM !
161
162    IGCM_debug_PopStack "ATM_Finalize"
163}
Note: See TracBrowser for help on using the repository browser.