source: CONFIG/LMDZORINCA/branches/LMDZORINCA3_HET/EXP_NMHCAER_SOA/COMP/lmdz.driver @ 1561

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

New branche for INCA4_HET model

File size: 5.0 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        LMD7245)   BandsResol=72x45x19   ;;
27        LMD9671)   BandsResol=96x71x19   ;;
28        LMD9672)   BandsResol=96x72x19   ;;
29        LMD9695)   BandsResol=96x95x19   ;;
30        LMD14496)  BandsResol=144x96x19  ;;
31        LMD144142) BandsResol=144x142x19 ;;
32    esac
33
34
35    ##-- Calendar type for LMDZ
36    case ${config_UserChoices_CalendarType} in
37        leap|gregorian)
38            CalendarTypeForLmdz=earth_366d;;
39        noleap)
40            CalendarTypeForLmdz=earth_365d;;
41        360d)
42            CalendarTypeForLmdz=earth_360d;;
43        *)
44            CalendarTypeForLmdz=earth_360d
45    esac
46
47    ##- Default number of processor for lmdz
48    NUM_PROC_ATM=1
49    if [ X"${BATCH_NUM_PROC_TOT}" != X ] ; then
50        NUM_PROC_ATM=${BATCH_NUM_PROC_TOT}
51    fi
52
53
54    ##-- Output frequency purpose ....
55    ##--  Initialisation  ....
56    ok_mensuel=y
57    ok_journe=n
58    ok_hf=n
59    ok_hf3h=n
60    ok_hf3hm=n
61    ok_stn=n
62
63
64
65    ## Read LMDZ_NbPeriod_adjust option in lmdz.card
66    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/lmdz.card UserChoices LMDZ_NbPeriod_adjust
67    eval LMDZ_NbPeriod_adjust=\${lmdz_UserChoices_LMDZ_NbPeriod_adjust} > /dev/null 2>&1
68
69    if [ ${LMDZ_NbPeriod_adjust} -eq 0 ] ; then
70        IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/lmdz.card UserChoices LMDZ_Bands_file_name
71        eval LMDZ_Bands_file_name=\${lmdz_UserChoices_LMDZ_Bands_file_name} > /dev/null 2>&1
72    fi
73
74
75    IGCM_debug_PopStack "ATM_Initialize"
76}
77
78#-----------------------------------------------------------------
79function ATM_Update
80{
81    IGCM_debug_PushStack "ATM_Update"
82
83    ecritphy=${PeriodLengthInDays}
84    LMDZ_ecrit_ISCCP=${PeriodLengthInDays}.
85    LMDZ_periodav=${PeriodLengthInDays}.
86
87    ##-- Remise ou non a zero de la date initiale de LMDZ pour le fichier run.def
88    if [ ${CumulPeriod} -eq 1 ] ; then
89        RAZ_DATE=1
90    else
91        RAZ_DATE=0
92    fi
93
94    if [ ${CumulPeriod} -eq 1 ] ; then
95        if [ ${LMDZ_NbPeriod_adjust} -eq 0 ] ; then
96            IGCM_sys_Get ${LMDZ_Bands_file_name} Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat
97            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
98            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"
99            IGCM_sys_Chmod u+w Bands_${BandsResol}_${NUM_PROC_ATM}prc.dat
100        fi
101    fi
102
103    LMDZ_adjust=n
104    [ ${CumulPeriod} -le ${LMDZ_NbPeriod_adjust} ] && LMDZ_adjust=y
105
106    RefPeriod=${LMDZ_NbPeriod_adjust} #0 to use a Bands file from Restart
107    [ ${CumulPeriod} -le ${LMDZ_NbPeriod_adjust} ] && (( RefPeriod = ${CumulPeriod} - 1 )) 
108
109    [ ${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 )
110
111
112    ## physiq.def parameters modified from initial physiq.def
113    #  columns in phys_output_filekeys refer to the filenames given in phys_out_filenames in output.def : 
114    #                                            histmth       histday        histhf    histfh3h   histhf3hm   histstn
115    LMDZ_sed physiq.def phys_out_filekeys       "${ok_mensuel} ${ok_journe}   ${ok_hf}  ${ok_hf3h} ${ok_hf3hm} ${ok_stn}"
116    LMDZ_sed physiq.def ecrit_ISCCP ${LMDZ_ecrit_ISCCP}
117
118
119    ## run.def parameters
120    LMDZ_sed run.def dayref   ${InitDay}
121    LMDZ_sed run.def anneeref ${InitYear}
122    LMDZ_sed run.def calend   ${CalendarTypeForLmdz}
123    LMDZ_sed run.def nday     ${PeriodLengthInDays}
124    LMDZ_sed run.def raz_date ${RAZ_DATE}
125    LMDZ_sed run.def periodav ${LMDZ_periodav}
126    LMDZ_sed run.def adjust   ${LMDZ_adjust}
127
128    ## Other specific parameters to this experience
129    if [ ! X${lmdz_UserChoices_aer_type} = X ] ; then
130        LMDZ_sed physiq.def aer_type ${lmdz_UserChoices_aer_type}
131    fi
132    if [ ! X${lmdz_UserChoices_pmagic} = X ] ; then
133        LMDZ_sed physiq.def pmagic   ${lmdz_UserChoices_pmagic}
134    fi
135
136    IGCM_debug_PopStack "ATM_Update"
137}
138
139#-----------------------------------
140function ATM_Finalize
141{
142    IGCM_debug_PushStack "ATM_Finalize"
143
144    [ ${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}
145    echo FINALIZE ATM !
146
147    IGCM_debug_PopStack "ATM_Finalize"
148}
Note: See TracBrowser for help on using the repository browser.