source: CONFIG/LMDZORINCA/tags/LMDZORINCA_v4_2/EXP_LOI/COMP/lmdz.driver @ 1798

Last change on this file since 1798 was 1798, checked in by acosce, 10 years ago

Change classification tree for inca's input files
It's change the way to manage differents resolutions

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