[541] | 1 | # $Id$ |
---|
| 2 | # |
---|
| 3 | #!/bin/ksh |
---|
| 4 | #----------------------------------------------------------------- |
---|
| 5 | function ATM_Initialize |
---|
| 6 | { |
---|
| 7 | IGCM_debug_PushStack "ATM_Initialize" |
---|
| 8 | |
---|
| 9 | RESOL_ATM=${RESOL} |
---|
| 10 | |
---|
[699] | 11 | [ -f ${SUBMIT_DIR}/../.resol ] && eval $(grep RESOL_ATM_3D ${SUBMIT_DIR}/../.resol) || RESOL_ATM_3D=96x95x19 |
---|
| 12 | RESOL_ATM_Z=$( echo $RESOL_ATM_3D | awk "-Fx" '{print $3}' ) |
---|
| 13 | |
---|
[541] | 14 | ##- Create_etat0_limit version |
---|
| 15 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/lmdz.card UserChoices CREATE |
---|
| 16 | CREATE=${lmdz_UserChoices_CREATE} |
---|
| 17 | echo create_etat0_limit version : ${CREATE} |
---|
| 18 | |
---|
| 19 | ##- Parameter files directory |
---|
| 20 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/lmdz.card UserChoices PARAM |
---|
| 21 | PARAM=${lmdz_UserChoices_PARAM} |
---|
| 22 | echo Parameter files directory : ${PARAM} |
---|
| 23 | |
---|
| 24 | ##- Default number of processor for lmdz |
---|
| 25 | NUM_PROC_ATM=1 |
---|
| 26 | if [ X"${BATCH_NUM_PROC_TOT}" != X ] ; then |
---|
| 27 | NUM_PROC_ATM=${BATCH_NUM_PROC_TOT} |
---|
| 28 | fi |
---|
| 29 | |
---|
| 30 | ##--Frequency purpose .... |
---|
| 31 | ##-- Initialisation .... |
---|
| 32 | OK_instan=n |
---|
| 33 | OK_journe=n |
---|
| 34 | OK_mensuel=n |
---|
| 35 | ok_hf=n |
---|
| 36 | |
---|
| 37 | case ${config_UserChoices_PeriodLength} in |
---|
| 38 | 1Y|1y|1M|1m) OK_mensuel=y ;; |
---|
| 39 | 5D|5d|1D|1d) OK_journe=y ;; |
---|
| 40 | esac |
---|
| 41 | |
---|
| 42 | for frequency in ${config_ATM_WriteFrequency} ; do |
---|
| 43 | case ${frequency} in |
---|
| 44 | 5D|5d|1D|1d) OK_journe=y ;; |
---|
| 45 | esac |
---|
| 46 | case ${frequency} in |
---|
| 47 | HF|hf) ok_hf=y ;; |
---|
| 48 | esac |
---|
| 49 | done |
---|
| 50 | |
---|
| 51 | ##--Variables used by LMDZ in gcm.def -- |
---|
[699] | 52 | PAT_iphysiq=$( grep -v ^# ${SUBMIT_DIR}/${PARAM}/gcm.def_${RESOL_ATM_3D} | grep iphysiq ) |
---|
| 53 | PAT_iperiod=$( grep -v ^# ${SUBMIT_DIR}/${PARAM}/gcm.def_${RESOL_ATM_3D} | grep iperiod ) |
---|
[541] | 54 | |
---|
| 55 | ## Read LMDZ_adjust option in ${compname}.card --> put adjust=y and save Bands_*.dat in ${SUBMIT_DIR}/${PARAM} |
---|
| 56 | IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/${compname}.card UserChoices LMDZ_adjust |
---|
| 57 | eval LMDZ_adjust=\${${compname}_UserChoices_LMDZ_adjust} > /dev/null 2>&1 |
---|
| 58 | |
---|
| 59 | ##-- This could be define in lmdz.card, inside section [UserChoices] |
---|
| 60 | ##-- Otherwise we get the value in *.def |
---|
| 61 | iperiod=$( echo ${PAT_iperiod} | awk -F= '{print $2}' ) |
---|
| 62 | iphysiq=$( echo ${PAT_iphysiq} | awk -F= '{print $2}' ) |
---|
| 63 | # day_step : number of steps per day (multiple of iperiod and iphysiq) |
---|
| 64 | (( day_step = 48 * iphysiq )) |
---|
[699] | 65 | |
---|
[541] | 66 | IGCM_debug_PopStack "ATM_Initialize" |
---|
| 67 | } |
---|
| 68 | |
---|
| 69 | #----------------------------------------------------------------- |
---|
| 70 | function ATM_Update |
---|
| 71 | { |
---|
| 72 | IGCM_debug_PushStack "ATM_Update" |
---|
| 73 | |
---|
| 74 | ##-- Remise ou non a zero de la date initiale de LMDZ pour le fichier run.def |
---|
| 75 | if [ ${CumulPeriod} -eq 1 ] ; then |
---|
| 76 | RAZ_DATE=1 |
---|
| 77 | else |
---|
| 78 | RAZ_DATE=0 |
---|
| 79 | fi |
---|
| 80 | |
---|
| 81 | ## Mise en forme du fichier physiq.def |
---|
| 82 | sed -e "s/_ok_instan_/${OK_instan}/" \ |
---|
| 83 | -e "s/_ok_journe_/${OK_journe}/" \ |
---|
| 84 | -e "s/_ok_mensuel_/${OK_mensuel}/" \ |
---|
| 85 | -e "s/_ok_hf_/${OK_hf}/" \ |
---|
| 86 | physiq.def > physiq.def.tmp |
---|
| 87 | IGCM_sys_Mv physiq.def.tmp physiq.def |
---|
| 88 | |
---|
| 89 | ## Mise en forme du fichier gcm.def |
---|
| 90 | sed -e "s/_day_step_/${day_step}/" \ |
---|
| 91 | -e "s/${PAT_iperiod}/iperiod=${iperiod}/" \ |
---|
| 92 | -e "s/${PAT_iphysiq}/iphysiq=${iphysiq}/" \ |
---|
| 93 | gcm.def > gcm.def.tmp |
---|
| 94 | IGCM_sys_Mv gcm.def.tmp gcm.def |
---|
| 95 | |
---|
| 96 | ## Mise en forme du fichier run.def |
---|
| 97 | sed -e "s/_dayref_/${InitDay}/" \ |
---|
| 98 | -e "s/_anneeref_/${InitYear}/" \ |
---|
| 99 | -e "s/_nday_/${PeriodLengthInDays}/" \ |
---|
| 100 | -e "s/_raz_date_/${RAZ_DATE}/" \ |
---|
| 101 | -e "s/_adjust_/${LMDZ_adjust}/" \ |
---|
| 102 | run.def > run.def.tmp |
---|
| 103 | IGCM_sys_Mv run.def.tmp run.def |
---|
| 104 | |
---|
| 105 | IGCM_debug_PopStack "ATM_Update" |
---|
| 106 | } |
---|
| 107 | |
---|
| 108 | #----------------------------------- |
---|
| 109 | function ATM_Finalize |
---|
| 110 | { |
---|
| 111 | IGCM_debug_PushStack "ATM_Finalize" |
---|
| 112 | |
---|
[699] | 113 | [ ${LMDZ_adjust} = y ] && IGCM_sys_Cp Bands_${RESOL_ATM_3D}_${NUM_PROC_ATM}prc.dat ${SUBMIT_DIR}/${PARAM} |
---|
[541] | 114 | |
---|
| 115 | echo FINALIZE ATM ! |
---|
| 116 | |
---|
| 117 | IGCM_debug_PopStack "ATM_Finalize" |
---|
| 118 | } |
---|