source: CONFIG/LMDZOR/branches/LMDZ4OR_v3/LMDZOR/COMP/lmdz.driver @ 959

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

-Modifications to fit with IPSLCM5_v2 configuration

  • modifications to run on titane (CCRT machine)
  • Controle seasonal file creation at the file level
  • Can switch off time series with
  • Add the possibility to force higher writing level for aerosol.

2 variables added with default value : LMDZ_Freq_aero=120 and
LMDZ_Length_aero=12

  • add HYDROL_HUMCSTE parameters for root profile.

Change HYDROL_SOIL_DEPTH from 2 meters to 4.
Use values for 4 meters in HYDROL_HUMCSTE,
as that have been decided by Patricia Cadule and Jean-Louis Dufresne.
Suppress RVEG_PFT artificial parameter (put all 1.).

  • monitoring for orchidee and stomate components fit with IPSLCM5_v2 monitoring.
  • Compilation of ce0l, for create_etat0_limit, copied from gcm compilation ie -parallel mpi option set for create_etat0_limit main

program.

File size: 9.3 KB
Line 
1# $Id$
2#
3#!/bin/ksh
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
18function ATM_Initialize
19{
20    IGCM_debug_PushStack "ATM_Initialize"
21
22    RESOL_ATM=$( echo $RESOL | awk "-F-" '{print $1}')
23
24    [ -f ${SUBMIT_DIR}/../.resol ] && eval $(grep RESOL_ATM_3D ${SUBMIT_DIR}/../.resol) || RESOL_ATM_3D=96x95x19
25
26    RESOL_ATM_Z=$( echo ${RESOL_ATM_3D} | awk "-Fx" '{print $3}' )
27
28    ##-- Calendar type for LMDZ
29    case ${config_UserChoices_CalendarType} in
30        leap|gregorian)
31            CalendarTypeForLmdz=earth_366d;;
32        noleap)
33            CalendarTypeForLmdz=earth_365d;;
34        360d)
35            CalendarTypeForLmdz=earth_360d;;
36        *)
37            CalendarTypeForLmdz=earth_360d
38    esac
39
40    ##- Create_etat0_limit version
41    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/lmdz.card UserChoices CREATE
42    CREATE=${lmdz_UserChoices_CREATE}
43    echo create_etat0_limit version : ${CREATE}
44
45    ##- Default number of processor for lmdz
46    NUM_PROC_ATM=1
47    if [ X"${BATCH_NUM_PROC_TOT}" != X ] ; then
48        NUM_PROC_ATM=${BATCH_NUM_PROC_TOT}
49    fi
50 
51    ##--Frequency purpose ....
52    ##--  Initialisation  ....
53    OK_instan=n
54    OK_journe=n
55    OK_mensuel=n
56    ok_hf=n
57
58    case ${config_UserChoices_PeriodLength} in
59        1Y|1y|1M|1m) OK_mensuel=y ;;
60        5D|5d|1D|1d) OK_journe=y ;;
61    esac
62
63    for frequency in ${config_ATM_WriteFrequency} ; do
64        case ${frequency} in
65            5D|5d|1D|1d) OK_journe=y ;;
66        esac
67        case ${frequency} in
68            HF|hf) ok_hf=y ;;
69        esac
70    done
71
72    ##--Variables used by LMDZ in physiq.def --
73    PAT_INST=$(        grep -v ^# ${SUBMIT_DIR}/PARAM/physiq.def_L${RESOL_ATM_Z}  | grep 'OK_instan='   )
74    PAT_JOUR=$(        grep -v ^# ${SUBMIT_DIR}/PARAM/physiq.def_L${RESOL_ATM_Z}  | grep 'OK_journe='   )
75    PAT_MOIS=$(        grep -v ^# ${SUBMIT_DIR}/PARAM/physiq.def_L${RESOL_ATM_Z}  | grep 'OK_mensuel='  )
76    PAT_HFRE=$(        grep -v ^# ${SUBMIT_DIR}/PARAM/physiq.def_L${RESOL_ATM_Z}  | grep 'ok_hf='       )
77    PAT_ecrit_mth=$(   grep -v ^# ${SUBMIT_DIR}/PARAM/physiq.def_L${RESOL_ATM_Z}  | grep 'ecrit_mth='   )
78    PAT_ecrit_ISCCP=$( grep -v ^# ${SUBMIT_DIR}/PARAM/physiq.def_L${RESOL_ATM_Z}  | grep 'ecrit_ISCCP=' )
79
80    ##--Variables used by LMDZ in gcm.def --
81    PAT_iphysiq=$(   grep -v ^# ${SUBMIT_DIR}/PARAM/gcm.def_${RESOL_ATM_3D} | grep iphysiq  )
82    PAT_iperiod=$(   grep -v ^# ${SUBMIT_DIR}/PARAM/gcm.def_${RESOL_ATM_3D} | grep iperiod  )
83    PAT_day_step=$(  grep -v ^# ${SUBMIT_DIR}/PARAM/gcm.def_${RESOL_ATM_3D} | grep day_step )
84
85    ## Read LMDZ_NbPeriod_adjust option in lmdz.card
86    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/lmdz.card UserChoices LMDZ_NbPeriod_adjust
87    eval LMDZ_NbPeriod_adjust=\${lmdz_UserChoices_LMDZ_NbPeriod_adjust} > /dev/null 2>&1
88
89    if [ ${LMDZ_NbPeriod_adjust} -eq 0 ] ; then
90        IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/lmdz.card UserChoices LMDZ_Bands_file_name
91        eval LMDZ_Bands_file_name=\${lmdz_UserChoices_LMDZ_Bands_file_name} > /dev/null 2>&1
92    fi
93
94    ##-- This could be define in lmdz.card, inside section [UserChoices]
95    ##-- Otherwise we get the value in *.def
96    iperiod=$( echo ${PAT_iperiod} | awk -F= '{print $2}' )
97    iphysiq=$( echo ${PAT_iphysiq} | awk -F= '{print $2}' )
98    # day_step : number of steps per day (multiple of iperiod)
99    #(( day_step = 48 * iphysiq ))
100    day_step=$( echo ${PAT_day_step} | awk -F= '{print $2}' )
101
102    ##  Read LMDZ_Freq_aero and LMDZ_Length_aero in lmdz.card
103    eval LMDZ_Freq_aero=\${lmdz_UserChoices_LMDZ_Freq_aero} > /dev/null 2>&1
104    eval LMDZ_Length_aero=\${lmdz_UserChoices_LMDZ_Length_aero} > /dev/null 2>&1
105
106    IGCM_debug_PopStack "ATM_Initialize"
107}
108
109#-----------------------------------------------------------------
110function ATM_Update
111{
112    IGCM_debug_PushStack "ATM_Update"
113
114    case ${config_UserChoices_PeriodLength} in
115        *Y|*y) 
116               LMDZ_ecrit_mth=30.
117               LMDZ_ecrit_ISCCP=30.
118               LMDZ_periodav=30.
119               if [ "${config_UserChoices_CalendarType}" != "360d" ] ; then
120                  echo Change calendartype in config.card. PeriodLength=1Y allowed only for CalendarType=360d
121                  exit
122               fi
123               ;;
124        *)
125               LMDZ_ecrit_mth=${PeriodLengthInDays}.
126               LMDZ_ecrit_ISCCP=${PeriodLengthInDays}.
127               LMDZ_periodav=${PeriodLengthInDays}.
128               ;;
129    esac
130
131    ##-- Remise ou non a zero de la date initiale de LMDZ pour le fichier run.def
132    if [ ${CumulPeriod} -eq 1 ] ; then
133        RAZ_DATE=1
134    else
135        RAZ_DATE=0
136    fi
137
138    ## To have more variables in output files for aerosols. Parameters are set in lmdz.card
139    if [ ${CumulPeriod}%${LMDZ_Freq_aero} -le ${LMDZ_Length_aero} ]; then
140       if [ ${CumulPeriod}%${LMDZ_Freq_aero} -ne 0 ]; then
141          lev_histmth=4
142       else
143          lev_histmth=2   
144       fi
145    else
146       lev_histmth=2
147    fi   
148
149    ## algo : For CumulPeriod=1 ;
150    ##        IF NbPeriod_Adjust = 0, Get Bands file directly from server, store it with _0 suffix
151    ##        ELSE LMDZ_adjust=y ; save Bands file on file server ;
152    ##        For CumulPeriod=2 to LMDZ_NbPeriod_adjust ; Get Bands file from server (CumulPeriod-1) ; LMDZ_adjust=y ; save Bands file on file server ;
153    ##        For CumulPeriod > LMDZ_NbPeriod_adjust ; LMDZ_adjust=n ; Get Bands file from server (CumulPeriod=LMDZ_NbPeriod_adjust 0 to force it) ; Use Bands ;
154
155    if [ ${CumulPeriod} -eq 1 ] ; then
156        if [ ${LMDZ_NbPeriod_adjust} -eq 0 ] ; then
157            IGCM_sys_Get ${LMDZ_Bands_file_name} Bands_${RESOL_ATM_3D}_${NUM_PROC_ATM}prc.dat ; IGCM_sys_Chmod u+w Bands_${RESOL_ATM_3D}_${NUM_PROC_ATM}prc.dat
158            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
159            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"
160        fi
161    fi
162
163    LMDZ_adjust=n
164    [ ${CumulPeriod} -le ${LMDZ_NbPeriod_adjust} ] && LMDZ_adjust=y
165
166    RefPeriod=${LMDZ_NbPeriod_adjust} #0 to use a Bands file from Restart
167    [ ${CumulPeriod} -le ${LMDZ_NbPeriod_adjust} ] && (( RefPeriod = ${CumulPeriod} - 1 )) 
168
169    [ ${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 )
170
171    ## physiq.def parameters modified from initial physiq_L${RESOL_ATM_Z}
172    LMDZ_sed physiq.def OK_instan   ${OK_instan}
173    LMDZ_sed physiq.def OK_journe   ${OK_journe}
174    LMDZ_sed physiq.def OK_mensuel  ${OK_mensuel}
175    LMDZ_sed physiq.def lev_histmth ${lev_histmth}
176    LMDZ_sed physiq.def ok_hf       ${ok_hf}
177    LMDZ_sed physiq.def ecrit_mth   ${LMDZ_ecrit_mth}
178    LMDZ_sed physiq.def ecrit_ISCCP ${LMDZ_ecrit_ISCCP}
179
180    ## gcm.def parameters : no change since gcm.def_${RESOL_ATM_3D} is used and already modified
181
182    ## run.def parameters
183    LMDZ_sed run.def dayref   ${InitDay}
184    LMDZ_sed run.def anneeref ${InitYear}
185    LMDZ_sed run.def calend   ${CalendarTypeForLmdz}
186    LMDZ_sed run.def nday     ${PeriodLengthInDays}
187    LMDZ_sed run.def raz_date ${RAZ_DATE}
188    LMDZ_sed run.def periodav ${LMDZ_periodav}
189    LMDZ_sed run.def adjust   ${LMDZ_adjust}
190
191    ## Read ByPass_hgardfou_teta option in lmdz.card --> divide teta* by 2 if [ $ByPass_hgardfou_teta = 1 ]
192    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/lmdz.card UserChoices ByPass_hgardfou_teta
193    eval ByPass_hgardfou_teta=\${lmdz_UserChoices_ByPass_hgardfou_teta} > /dev/null 2>&1
194    if [ ${ByPass_hgardfou_teta} = y ] ; then
195        awk '{ if ($0 ~ /^teta.*=/) {split($0,a,"=") ; print a[1]"="a[2]/2"."} else print $0}' gcm.def > gcm.def.tmp
196        IGCM_sys_Mv gcm.def.tmp gcm.def
197        echo
198        IGCM_debug_Print 1 "ByPass_hgardfou_teta : ^teta*/2 in gcm.def"
199        echo
200        cat gcm.def
201        ByPass_hgardfou_teta=n
202        IGCM_card_WriteOption ${SUBMIT_DIR}/COMP/lmdz.card UserChoices ByPass_hgardfou_teta "${ByPass_hgardfou_teta}"
203    fi
204
205    ## Read ByPass_hgardfou_mats option in lmdz.card --> purmats=y 2 if [ $ByPass_hgardfou_mats = 1 ]
206    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/lmdz.card UserChoices ByPass_hgardfou_mats
207    eval ByPass_hgardfou_mats=\${lmdz_UserChoices_ByPass_hgardfou_mats} > /dev/null 2>&1
208    if [ ${ByPass_hgardfou_mats} = y ] ; then
209        sed -e "s/^purmats=.*/purmats=y/" gcm.def > gcm.def.tmp
210        IGCM_sys_Mv gcm.def.tmp gcm.def
211        echo
212        IGCM_debug_Print 1 "ByPass_hgardfou_mats : purmats=y in gcm.def"
213        echo
214        cat gcm.def
215        ByPass_hgardfou_mats=n
216        IGCM_card_WriteOption ${SUBMIT_DIR}/COMP/lmdz.card UserChoices ByPass_hgardfou_mats "${ByPass_hgardfou_mats}"
217    fi
218
219    IGCM_debug_PopStack "ATM_Update"
220}
221
222#-----------------------------------
223function ATM_Finalize
224{
225    IGCM_debug_PushStack "ATM_Finalize"
226
227    [ ${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}
228
229    echo FINALIZE ATM !
230
231    IGCM_debug_PopStack "ATM_Finalize"
232}
Note: See TracBrowser for help on using the repository browser.