#!/bin/ksh #----------------------------------- function MBG_Initialize { IGCM_debug_PushStack "MBG_Initialize" # Local function to find parameters in LMDZ .def files lmdzgrep2 () { grep ${1} ${2} | grep -v "#" | sed -e 's/=//g' -e 's/://g' -e 's/_AUTO_//' -e 's/DEFAULT//' | sed -e "s/${1}//" } ##--Variables used by MBG -- # ln_rsttr boolean term for tracer model restart (true or false) # nrsttr control of the time step (0, 1 or 2) IGCM_debug_PopStack "MBG_Initialize" } #----------------------------------- function MBG_Update { IGCM_debug_PushStack "MBG_Update" ##-- Restart configuration if ( [ "${CumulPeriod}" -eq 1 ] && [ "${config_MBG_Restart}" = "n" ] ) ; then #echo "NO RESTART FOR TOP" TOP_LN_RSTR=.FALSE. TOP_NN_RSTR=0 elif ( [ "${CumulPeriod}" -eq 1 ] && [ "${config_MBG_Restart}" = "y" ] ) ; then #echo "RESTART TOP" TOP_LN_RSTR=.TRUE. TOP_NN_RSTR=0 # If we start from IPSLCM5* restart files. for file in restart_trc*.nc ; do ncrename -v TRBDSi,TRBGSi -v TRNDSi,TRNGSi -v TRNBSi,TRNDSi -v TRBBSi,TRBDSi ${file} > /dev/null 2>&1 done else #echo "RESTART TOP" TOP_LN_RSTR=.TRUE. TOP_NN_RSTR=2 fi ##-- Enable dbio output file DBIO_ENABLE=".FALSE." eval pisces_DBIO_ENABLE=\${pisces_UserChoices_DBIO_ENABLE} > /dev/null 2>&1 if [ "${pisces_DBIO_ENABLE}" = "y" ]; then DBIO_ENABLE=".TRUE." fi # update iodef.xml IGCM_debug_Print 1 " 'Informations into iodef.xml : DBIO_ENABLE : ${DBIO_ENABLE}" sed -e "s//${DBIO_ENABLE}/" \ iodef.xml > iodef.xml.tmp IGCM_sys_Mv iodef.xml.tmp iodef.xml ##-- CO2 forcing : update atcco2 value in namelist_pisces_cfg if [ "${pisces_UserChoices_CARBON_CYCLE}" = "y" ]; then IGCM_debug_Print 1 "Special case for carbon cycle" # Activate this case by putting CARBON_CYCLE=y in pisces.card section UserChoices IGCM_debug_Print 1 'Update atcco2 in namelist_pisces_cfg with value from file co2.log' PathCO2log=${SUBMIT_DIR} PreviousLinelog=$( tail -1 ${PathCO2log}/co2.log ) IPCC_PIS_CO2=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' ) IGCM_debug_Print 1 "IPCC_PIS_CO2 : ${IPCC_PIS_CO2} " IGCM_comp_modifyNamelist force namelist_pisces_cfg atcco2 ${IPCC_PIS_CO2} else IGCM_debug_Print 1 "Take same CO2 as for LMDZ, in parameter file config.def." # ATM_Update is done before MBG_Update and therefore config.def file contains the correct value for CO2. IGCM_debug_Print 1 'Update atcco2 in namelist_pisces_cfg with same value as for LMDZ' LMDZ_CO2=$( lmdzgrep2 co2_ppm config.def ) IGCM_debug_Print 1 "LMDZ_CO2 : ${LMDZ_CO2} " IGCM_comp_modifyNamelist force namelist_pisces_cfg atcco2 ${LMDZ_CO2} fi ##-- Update namelist_top_cfg and namelist_pisces_cfg IGCM_comp_modifyNamelist blocker namelist_top_cfg ln_rsttr ${TOP_LN_RSTR} IGCM_comp_modifyNamelist blocker namelist_top_cfg nn_rsttr ${TOP_NN_RSTR} IGCM_comp_modifyNamelist blocker namelist_pisces_cfg nn_pisdmp ${OPA_NPDT_YEAR} IGCM_debug_PopStack "MBG_Update" } #----------------------------------- function MBG_Finalize { IGCM_debug_PushStack "MBG_Finalize" echo FINALIZE MBG !!! IGCM_debug_PopStack "MBG_Finalize" }