#!/bin/ksh

#-----------------------------------
function ICE_Initialize
{ 
    IGCM_debug_PushStack "ICE_Initialize"

    #echo INITIALIZE ICE !!!
    RESOL_ICE=$( echo $RESOL | awk "-Fx" '{print $1}' )

    IGCM_debug_PopStack "ICE_Initialize"
}

#-----------------------------------
function ICE_Update
{
    IGCM_debug_PushStack "ICE_Update"

    ##--Write Frequency Purpose ....

    ##-- NOTICE THAT ICE_UPDATE 
    ##-- MUST BE DONE AFTER OCE_UPDATE

    (( ICE_NSTOCK = ORCA_NWRITE ))

    ##-- Restart configuration
    if ( [ "${CumulPeriod}" -eq 1 ] && [ "${config_ICE_Restart}" = "n" ] ) ; then
	LIMSTAR=2
	#echo "PAS DE RESTART GLACE UCL"
    else
	LIMSTAR=1
	#echo "RESTART GLACE UCL"
    fi

    #- pas de restart glace au debut de la simulation pour ORCA
    sed -e "s/KKKKKKK/${LIMSTAR}/" \
	-e "s/SSSSSSS/${ICE_NSTOCK}/" \
	run.param.li > run.param.li.tmp

    IGCM_sys_Mv run.param.li.tmp run.param.li

    IGCM_debug_PopStack "ICE_Update"
}

#-----------------------------------
function ICE_Finalize
{
    IGCM_debug_PushStack "ICE_Finalize"

    echo FINALIZE ICE !!!

    IGCM_debug_PopStack "ICE_Finalize"
}
