Ignore:
Timestamp:
12/19/19 17:35:10 (4 years ago)
Author:
acosce
Message:

Add flag Reproducibility_after_restart in OPA to allow simulation to be identical even if we make a restart during the simulation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • CONFIG/UNIFORM/v6/IPSLCM5A2/GENERAL/DRIVER/opa9.driver

    r2876 r4873  
    105105    OPA_NSTOCK="${OPA_NITEND}" 
    106106 
     107    ##-- Additionnal Restart Option to force reproducibility ; force kt to kt red in restart file 
     108    ## ${opa9_UserChoices_Reproducibility_after_restart} 
     109     
     110    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/COMP/opa9.card UserChoices Reproducibility_after_restart 
     111 
    107112    ##-- Restart configuration 
    108     if ( [ "${CumulPeriod}" -eq 1 ] && [ "${config_OCE_Restart}" = "n" ] ) ; then 
     113    if ( [ "${opa9_UserChoices_Reproducibility_after_restart}" = "y" ] ) ; then 
     114        OPA_LRSTAR=.TRUE. 
     115        OPA_NRSTDT=2 
     116        #echo "OPA RESTART" 
     117        IGCM_debug_Print 1 'WARNING : dangerous option for NEMO opa9 pisces lim3' 
     118        IGCM_debug_Print 1 'Reproducibility_after_Restart forced ie kt forced to kt red in restart file : ' ${opa9_UserChoices_Reproducibility_after_restart} 
     119        OPA_NMSH=0 
     120    elif ( [ "${CumulPeriod}" -eq 1 ] && [ "${config_OCE_Restart}" = "n" ] ) ; then 
    109121        OPA_LRSTAR=.FALSE. 
    110122        OPA_NRSTDT=0 
     
    140152    esac 
    141153 
     154    if ( [ "${opa9_UserChoices_Reproducibility_after_restart}" = "y" ] ) ; then 
     155        ##-- choose the right restart file 
     156        NEMO_RESTART_FILE=restartopa.nc 
     157        [ -f restartopa_0000.nc ] && NEMO_RESTART_FILE=restartopa_0000.nc 
     158        ##-- Getting from restart file the last time step of the run at which we want to re-start 
     159        NEMO_KT_FROM_RESTART=$(ncdump -v kt ${NEMO_RESTART_FILE}|grep 'kt ='|awk '{print $3}' ) 
     160 
     161        if ( [ "${CumulPeriod}" -eq 1 ] ) ; then 
     162            ## Force the date in the restart file to be the last day before the begining of the new run 
     163            dateendprevious=$( IGCM_date_AddDaysToGregorianDate ${DateBegin} -1 ) 
     164            IGCM_debug_Print 1 "Previous Date  ${dateendprevious}" 
     165            IGCM_debug_Print 1 "cmd done to modify NEMO restartfile:   ncap2 -s ndastp=${dateendprevious} ${NEMO_RESTART_FILE}  tmp.nc" 
     166            if [ -f restartopa_0000.nc ] ; then 
     167                typeset -Z4 ncpu=0 
     168                while [ $ncpu -lt ${OCE_PROC_MPI} ] ; do 
     169                    ncap2 -s "ndastp=${dateendprevious}" restartopa_${ncpu}.nc  tmp.nc 
     170                    mv tmp.nc restartopa_${ncpu}.nc 
     171                    (( ncpu = ncpu + 1 )) 
     172                done 
     173            else 
     174                ncap2 -s "ndastp=${dateendprevious}" ${NEMO_RESTART_FILE}  tmp.nc 
     175                mv tmp.nc ${NEMO_RESTART_FILE} 
     176            fi 
     177            ##-- Getting from restart file the "new" restart date of run at which we want to re-start 
     178            NEMO_NDASTP_FROM_RESTART=$(ncdump -v ndastp ${NEMO_RESTART_FILE}|grep 'ndastp ='|awk '{print $3}' ) 
     179            IGCM_debug_Print 1 "NEMO_NDASTP (from Restart) for 1st Period       : ${NEMO_NDASTP_FROM_RESTART}" 
     180 
     181        fi 
     182 
     183        (( NEMO_NIT000 = NEMO_KT_FROM_RESTART + 1 )) 
     184        (( NEMO_NITEND = NEMO_KT_FROM_RESTART + OPA_NITEND - OPA_NIT000 + 1 )) 
     185        IGCM_debug_Print 1 "NEMO_NIT000 (from Restart)        : ${NEMO_NIT000}" 
     186        IGCM_debug_Print 1 "NEMO_NITEND (from Restart + ... ) : ${NEMO_NITEND}" 
     187        ##-- We force one restart file at the end of the trunk 
     188        OPA_NSTOCK="${NEMO_NITEND}" 
     189        OPA_NIT000="${NEMO_NIT000}" 
     190        OPA_NITEND="${NEMO_NITEND}" 
     191    fi 
     192 
    142193    typeset -r PRECIS=8 
    143194    NEMO_END=$( echo $( awk "BEGIN { printf \"%0${PRECIS}d\",${OPA_NITEND} }" ) )  
Note: See TracChangeset for help on using the changeset viewer.