source: CONFIG/LMDZORINCA/branches/LMDZORINCA3_39/EXP_GES/COMP/lmdz.driver

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

Add stomate in configuration LMDZORINCA - 39 levels - GES

  • Property svn:executable set to *
File size: 5.4 KB
Line 
1#- $Id: lmdz.driver 841 2009-12-08 09:48:13Z acosce $
2#!/bin/ksh
3
4#-----------------------------------------------------------------
5function LMDZ_sed
6{
7    IGCM_debug_PushStack "LMDZ_sed"
8
9    sed -e "s/^${2}\ *=.*/${2}= ${3}/" ${1} > ${1}.tmp
10    RET=$?
11    echo "LMDZ_sed : ${1} ${2} ${3}"
12    \mv ${1}.tmp ${1}
13
14    IGCM_debug_PopStack "LMDZ_sed"
15    return $RET
16}
17
18#-----------------------------------------------------------------
19
20function ATM_Initialize
21{
22    IGCM_debug_PushStack "ATM_Initialize"
23
24    RESOL_ATM=$( echo $RESOL | awk "-Fx" '{print $2}' )
25    case ${RESOL_ATM} in
26        LMD9695-L39)   BandsResol=96x95x39   ;;
27    esac
28
29
30    ##-- Calendar type for LMDZ
31    case ${config_UserChoices_CalendarType} in
32        leap|gregorian)
33            CalendarTypeForLmdz=earth_366d;;
34        noleap)
35            CalendarTypeForLmdz=earth_365d;;
36        360d)
37            CalendarTypeForLmdz=earth_360d;;
38        *)
39            CalendarTypeForLmdz=earth_360d
40    esac
41
42    ##- Default number of processor for lmdz
43    NUM_PROC_ATM=1
44    if [ X"${BATCH_NUM_PROC_TOT}" != X ] ; then
45        NUM_PROC_ATM=${BATCH_NUM_PROC_TOT}
46    fi
47
48
49    ##-- Output frequency purpose ....
50    ##--  Initialisation  ....
51    ok_mensuel=y
52    ok_journe=n
53    ok_hf=n
54    ok_hf3h=n
55    ok_hf3hm=n
56    ok_stn=n
57
58
59
60    ## Read LMDZ_NbPeriod_adjust option in lmdz.card
61    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/lmdz.card UserChoices LMDZ_NbPeriod_adjust
62    eval LMDZ_NbPeriod_adjust=\${lmdz_UserChoices_LMDZ_NbPeriod_adjust} > /dev/null 2>&1
63
64    if [ ${LMDZ_NbPeriod_adjust} -eq 0 ] ; then
65        IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/lmdz.card UserChoices LMDZ_Bands_file_name
66        eval LMDZ_Bands_file_name=\${lmdz_UserChoices_LMDZ_Bands_file_name} > /dev/null 2>&1
67    fi
68
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    LMDZ_ecrit_ISCCP=${PeriodLengthInDays}.
80    LMDZ_periodav=${PeriodLengthInDays}.
81
82    ##-- Remise ou non a zero de la date initiale de LMDZ pour le fichier run.def
83    if [ ${CumulPeriod} -eq 1 ] ; then
84        RAZ_DATE=1
85    else
86        RAZ_DATE=0
87    fi
88
89
90    ## algo : For CumulPeriod=1 ;
91    ##        IF NbPeriod_Adjust = 0, Get Bands file directly from server, store it with _0 suffix
92    ##        ELSE LMDZ_adjust=y ; save Bands file on file server ;
93    ##        For CumulPeriod=2 to LMDZ_NbPeriod_adjust ; Get Bands file from server (CumulPeriod-1) ; LMDZ_adjust=y ; save Bands file on file server ;
94    ##        For CumulPeriod > LMDZ_NbPeriod_adjust ; LMDZ_adjust=n ; Get Bands file from server (CumulPeriod=LMDZ_NbPeriod_adjust 0 to force it) ; Use Bands ;
95
96    if [ ${CumulPeriod} -eq 1 ] ; then
97        if [ ${LMDZ_NbPeriod_adjust} -eq 0 ] ; then
98            IGCM_sys_Get ${LMDZ_Bands_file_name} Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat
99            IGCM_sys_Put_Out Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat ${R_OUT_ATM_D}/${config_UserChoices_JobName}_Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat_0
100            IGCM_debug_Print 1 "Bands file forced to ${LMDZ_Bands_file_name} and stored in ${config_UserChoices_JobName}_Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat_0"
101            IGCM_sys_Chmod u+w Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat
102        fi
103    fi
104
105    LMDZ_adjust=n
106    [ ${CumulPeriod} -le ${LMDZ_NbPeriod_adjust} ] && LMDZ_adjust=y
107
108    RefPeriod=${LMDZ_NbPeriod_adjust} #0 to use a Bands file from Restart
109    [ ${CumulPeriod} -le ${LMDZ_NbPeriod_adjust} ] && (( RefPeriod = ${CumulPeriod} - 1 )) 
110
111    [ ${CumulPeriod} -gt 1 ] && ( IGCM_sys_Get ${R_OUT_ATM_D}/${config_UserChoices_JobName}_Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat_${RefPeriod} Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat; IGCM_sys_Chmod u+w Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat )
112
113
114    ## physiq.def parameters modified from initial physiq.def
115    #  columns in phys_output_filekeys refer to the filenames given in phys_out_filenames in output.def : 
116    #                                            histmth       histday        histhf    histfh3h   histhf3hm   histstn
117    LMDZ_sed physiq.def phys_out_filekeys       "${ok_mensuel} ${ok_journe}   ${ok_hf}  ${ok_hf3h} ${ok_hf3hm} ${ok_stn}"
118    LMDZ_sed physiq.def ecrit_ISCCP ${LMDZ_ecrit_ISCCP}
119
120    if [ ! X${lmdz_UserChoices_ok_guide} = X ] ; then
121        LMDZ_sed guide.def ok_guide  ${lmdz_UserChoices_ok_guide}
122    fi
123
124    ## run.def parameters
125    LMDZ_sed run.def dayref   ${InitDay}
126    LMDZ_sed run.def anneeref ${InitYear}
127    LMDZ_sed run.def calend   ${CalendarTypeForLmdz}
128    LMDZ_sed run.def nday     ${PeriodLengthInDays}
129    LMDZ_sed run.def raz_date ${RAZ_DATE}
130    LMDZ_sed run.def periodav ${LMDZ_periodav}
131    LMDZ_sed run.def adjust   ${LMDZ_adjust}
132
133    ## Other specific parameters to this experience
134    if [ ! X${lmdz_UserChoices_aer_type} = X ] ; then
135        LMDZ_sed physiq.def aer_type ${lmdz_UserChoices_aer_type}
136    fi
137    if [ ! X${lmdz_UserChoices_pmagic} = X ] ; then
138        LMDZ_sed physiq.def pmagic   ${lmdz_UserChoices_pmagic}
139    fi
140
141    IGCM_debug_PopStack "ATM_Update"
142}
143
144#-----------------------------------
145function ATM_Finalize
146{
147    IGCM_debug_PushStack "ATM_Finalize"
148
149    [ ${CumulPeriod} -le ${LMDZ_NbPeriod_adjust} ] && IGCM_sys_Put_Out Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat ${R_OUT_ATM_D}/${config_UserChoices_JobName}_Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat_${CumulPeriod}
150    echo FINALIZE ATM !
151
152    IGCM_debug_PopStack "ATM_Finalize"
153}
Note: See TracBrowser for help on using the repository browser.