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