source: CONFIG/LMDZORINCA/tags/LMDZORINCA_v2/EXP_LOI/COMP/lmdz.driver @ 1630

Last change on this file since 1630 was 1630, checked in by acosce, 12 years ago

Add new resolution with 39 levels in INCA config

  • Property svn:executable set to *
File size: 5.7 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
26    [ -f ${SUBMIT_DIR}/../.resol ] && eval $(grep RESOL_ATM_3D ${SUBMIT_DIR}/../.resol) || RESOL_ATM_3D=96x95x19
27
28    RESOL_ATM_Z=$( echo ${RESOL_ATM_3D} | awk "-Fx" '{print $3}' | awk "-F-" '{print $1}')
29
30
31    ##-- Calendar type for LMDZ
32    case ${config_UserChoices_CalendarType} in
33        leap|gregorian)
34            CalendarTypeForLmdz=earth_366d;;
35        noleap)
36            CalendarTypeForLmdz=earth_365d;;
37        360d)
38            CalendarTypeForLmdz=earth_360d;;
39        *)
40            CalendarTypeForLmdz=earth_360d
41    esac
42
43    ##- Default number of processor for lmdz
44    NUM_PROC_ATM=1
45    if [ X"${BATCH_NUM_PROC_TOT}" != X ] ; then
46        NUM_PROC_ATM=${BATCH_NUM_PROC_TOT}
47    fi
48
49
50    ##-- Output frequency purpose ....
51    ##--  Initialisation  ....
52    ok_mensuel=y
53    ok_journe=n
54    ok_hf=n
55    ok_hf3h=n
56    ok_hf3hm=n
57    ok_stn=n
58
59
60
61    ## Read LMDZ_NbPeriod_adjust option in lmdz.card
62    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/lmdz.card UserChoices LMDZ_NbPeriod_adjust
63    eval LMDZ_NbPeriod_adjust=\${lmdz_UserChoices_LMDZ_NbPeriod_adjust} > /dev/null 2>&1
64
65    if [ ${LMDZ_NbPeriod_adjust} -eq 0 ] ; then
66        IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/lmdz.card UserChoices LMDZ_Bands_file_name
67        eval LMDZ_Bands_file_name=\${lmdz_UserChoices_LMDZ_Bands_file_name} > /dev/null 2>&1
68    fi
69
70
71    IGCM_debug_PopStack "ATM_Initialize"
72}
73
74#-----------------------------------------------------------------
75function ATM_Update
76{
77    IGCM_debug_PushStack "ATM_Update"
78
79    ecritphy=${PeriodLengthInDays}
80    LMDZ_ecrit_ISCCP=${PeriodLengthInDays}.
81    LMDZ_periodav=${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
91    ## algo : For CumulPeriod=1 ;
92    ##        IF NbPeriod_Adjust = 0, Get Bands file directly from server, store it with _0 suffix
93    ##        ELSE LMDZ_adjust=y ; save Bands file on file server ;
94    ##        For CumulPeriod=2 to LMDZ_NbPeriod_adjust ; Get Bands file from server (CumulPeriod-1) ; LMDZ_adjust=y ; save Bands file on file server ;
95    ##        For CumulPeriod > LMDZ_NbPeriod_adjust ; LMDZ_adjust=n ; Get Bands file from server (CumulPeriod=LMDZ_NbPeriod_adjust 0 to force it) ; Use Bands ;
96
97    if [ ${CumulPeriod} -eq 1 ] ; then
98        if [ ${LMDZ_NbPeriod_adjust} -eq 0 ] ; then
99            if [ ! X${LMDZ_Bands_file_name} = X] ; then
100               IGCM_sys_Get ${LMDZ_Bands_file_name} Bands_${RESOL_ATM_3D}_${NUM_PROC_ATM}prc.dat
101               IGCM_sys_Put_Out Bands_${RESOL_ATM_3D}_${NUM_PROC_ATM}prc.dat ${R_OUT_ATM_D}/${config_UserChoices_JobName}_Bands_${RESOL_ATM_3D}_${NUM_PROC_ATM}prc.dat_0
102               IGCM_debug_Print 1 "Bands file forced to ${LMDZ_Bands_file_name} and stored in ${config_UserChoices_JobName}_Bands_${RESOL_ATM_3D}_${NUM_PROC_ATM}prc.dat_0"
103               IGCM_sys_Chmod u+w Bands_${RESOL_ATM_3D}_${NUM_PROC_ATM}prc.dat
104            fi
105        fi
106    fi
107
108    LMDZ_adjust=n
109    [ ${CumulPeriod} -le ${LMDZ_NbPeriod_adjust} ] && LMDZ_adjust=y
110
111    RefPeriod=${LMDZ_NbPeriod_adjust} #0 to use a Bands file from Restart
112    [ ${CumulPeriod} -le ${LMDZ_NbPeriod_adjust} ] && (( RefPeriod = ${CumulPeriod} - 1 )) 
113
114    [ ${CumulPeriod} -gt 1 ] && ( IGCM_sys_Get ${R_OUT_ATM_D}/${config_UserChoices_JobName}_Bands_${RESOL_ATM_3D}_${NUM_PROC_ATM}prc.dat_${RefPeriod} Bands_${RESOL_ATM_3D}_${NUM_PROC_ATM}prc.dat; IGCM_sys_Chmod u+w Bands_${RESOL_ATM_3D}_${NUM_PROC_ATM}prc.dat )
115
116    ## physiq.def parameters modified from initial physiq_L${RESOL_ATM_Z}
117    #  columns in phys_output_filekeys refer to the filenames given in phys_out_filenames in output.def : 
118    #                                            histmth       histday        histhf    histfh3h   histhf3hm   histstn
119    LMDZ_sed physiq.def phys_out_filekeys       "${ok_mensuel} ${ok_journe}   ${ok_hf}  ${ok_hf3h} ${ok_hf3hm} ${ok_stn}"
120    LMDZ_sed physiq.def ecrit_ISCCP ${LMDZ_ecrit_ISCCP}
121
122    if [ ! X${lmdz_UserChoices_ok_guide} = X ] ; then
123        LMDZ_sed guide.def ok_guide  ${lmdz_UserChoices_ok_guide}
124    fi
125
126    ## run.def parameters
127    LMDZ_sed run.def dayref   ${InitDay}
128    LMDZ_sed run.def anneeref ${InitYear}
129    LMDZ_sed run.def calend   ${CalendarTypeForLmdz}
130    LMDZ_sed run.def nday     ${PeriodLengthInDays}
131    LMDZ_sed run.def raz_date ${RAZ_DATE}
132    LMDZ_sed run.def periodav ${LMDZ_periodav}
133    LMDZ_sed run.def adjust   ${LMDZ_adjust}
134
135    ## Other specific parameters to this experience
136    if [ ! X${lmdz_UserChoices_aer_type} = X ] ; then
137        LMDZ_sed physiq.def aer_type ${lmdz_UserChoices_aer_type}
138    fi
139    if [ ! X${lmdz_UserChoices_pmagic} = X ] ; then
140        LMDZ_sed physiq.def pmagic   ${lmdz_UserChoices_pmagic}
141    fi
142
143    IGCM_debug_PopStack "ATM_Update"
144}
145
146#-----------------------------------
147function ATM_Finalize
148{
149    IGCM_debug_PushStack "ATM_Finalize"
150
151    [ ${CumulPeriod} -le ${LMDZ_NbPeriod_adjust} ] && IGCM_sys_Put_Out Bands_${RESOL_ATM_3D}_${NUM_PROC_ATM}prc.dat ${R_OUT_ATM_D}/${config_UserChoices_JobName}_Bands_${RESOL_ATM_3D}_${NUM_PROC_ATM}prc.dat_${CumulPeriod}
152    echo FINALIZE ATM !
153
154    IGCM_debug_PopStack "ATM_Finalize"
155}
Note: See TracBrowser for help on using the repository browser.