# $Id$ # #!/bin/ksh #----------------------------------------------------------------- function ATM_Initialize { IGCM_debug_PushStack "ATM_Initialize" RESOL_ATM=${RESOL} [ -f ${SUBMIT_DIR}/../.resol ] && eval $(grep RESOL_ATM_3D ${SUBMIT_DIR}/../.resol) || RESOL_ATM_3D=96x95x19 RESOL_ATM_Z=$( echo $RESOL_ATM_3D | awk "-Fx" '{print $3}' ) ##- Create_etat0_limit version IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/lmdz.card UserChoices CREATE CREATE=${lmdz_UserChoices_CREATE} echo create_etat0_limit version : ${CREATE} ##- Parameter files directory IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/lmdz.card UserChoices PARAM PARAM=${lmdz_UserChoices_PARAM} echo Parameter files directory : ${PARAM} ##- Default number of processor for lmdz NUM_PROC_ATM=1 if [ X"${BATCH_NUM_PROC_TOT}" != X ] ; then NUM_PROC_ATM=${BATCH_NUM_PROC_TOT} fi ##--Frequency purpose .... ##-- Initialisation .... OK_instan=n OK_journe=n OK_mensuel=n ok_hf=n case ${config_UserChoices_PeriodLength} in 1Y|1y|1M|1m) OK_mensuel=y ;; 5D|5d|1D|1d) OK_journe=y ;; esac for frequency in ${config_ATM_WriteFrequency} ; do case ${frequency} in 5D|5d|1D|1d) OK_journe=y ;; esac case ${frequency} in HF|hf) ok_hf=y ;; esac done ##--Variables used by LMDZ in gcm.def -- PAT_iphysiq=$( grep -v ^# ${SUBMIT_DIR}/${PARAM}/gcm.def_${RESOL_ATM_3D} | grep iphysiq ) PAT_iperiod=$( grep -v ^# ${SUBMIT_DIR}/${PARAM}/gcm.def_${RESOL_ATM_3D} | grep iperiod ) ## Read LMDZ_adjust option in ${compname}.card --> put adjust=y and save Bands_*.dat in ${SUBMIT_DIR}/${PARAM} IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/${compname}.card UserChoices LMDZ_adjust eval LMDZ_adjust=\${${compname}_UserChoices_LMDZ_adjust} > /dev/null 2>&1 ##-- This could be define in lmdz.card, inside section [UserChoices] ##-- Otherwise we get the value in *.def iperiod=$( echo ${PAT_iperiod} | awk -F= '{print $2}' ) iphysiq=$( echo ${PAT_iphysiq} | awk -F= '{print $2}' ) # day_step : number of steps per day (multiple of iperiod and iphysiq) (( day_step = 48 * iphysiq )) IGCM_debug_PopStack "ATM_Initialize" } #----------------------------------------------------------------- function ATM_Update { IGCM_debug_PushStack "ATM_Update" ##-- Remise ou non a zero de la date initiale de LMDZ pour le fichier run.def if [ ${CumulPeriod} -eq 1 ] ; then RAZ_DATE=1 else RAZ_DATE=0 fi ## Mise en forme du fichier physiq.def sed -e "s/_ok_instan_/${OK_instan}/" \ -e "s/_ok_journe_/${OK_journe}/" \ -e "s/_ok_mensuel_/${OK_mensuel}/" \ -e "s/_ok_hf_/${OK_hf}/" \ physiq.def > physiq.def.tmp IGCM_sys_Mv physiq.def.tmp physiq.def ## Mise en forme du fichier gcm.def sed -e "s/_day_step_/${day_step}/" \ -e "s/${PAT_iperiod}/iperiod=${iperiod}/" \ -e "s/${PAT_iphysiq}/iphysiq=${iphysiq}/" \ gcm.def > gcm.def.tmp IGCM_sys_Mv gcm.def.tmp gcm.def ## Mise en forme du fichier run.def sed -e "s/_dayref_/${InitDay}/" \ -e "s/_anneeref_/${InitYear}/" \ -e "s/_nday_/${PeriodLengthInDays}/" \ -e "s/_raz_date_/${RAZ_DATE}/" \ -e "s/_adjust_/${LMDZ_adjust}/" \ run.def > run.def.tmp IGCM_sys_Mv run.def.tmp run.def IGCM_debug_PopStack "ATM_Update" } #----------------------------------- function ATM_Finalize { IGCM_debug_PushStack "ATM_Finalize" [ ${LMDZ_adjust} = y ] && IGCM_sys_Cp Bands_${RESOL_ATM_3D}_${NUM_PROC_ATM}prc.dat ${SUBMIT_DIR}/${PARAM} echo FINALIZE ATM ! IGCM_debug_PopStack "ATM_Finalize" }