Changeset 819


Ignore:
Timestamp:
03/06/13 18:55:34 (11 years ago)
Author:
sdipsl
Message:
  • Generalyze Cyclic functionnalities. DateBegin? can be before CyclicBegin?. JG.
  • Example apply a 1979-2009 forcing cyclically from 1853 to 2009.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libIGCM/libIGCM_config/libIGCM_config.ksh

    r812 r819  
    411411  typeset i 
    412412 
    413   # When Cyclic is active, the simulation MUST start with the same year as the CyclicBegin year. 
    414   if ( [ ! X${config_UserChoices_CyclicBegin} = X ] && [ ! X${config_UserChoices_CyclicEnd} = X ] ) ; then 
    415     IGCM_debug_Print 1 "Check coherence between CyclicBegin year and DateBegin year" 
    416     if [ ${InitYear} -ne ${config_UserChoices_CyclicBegin} ] ; then 
    417       IGCM_debug_Print 1 "The simulation MUST start with the same year as the CyclicBegin year" 
    418       IGCM_debug_Exit "Check your CyclicBegin option in config.card UserChoices section" 
    419     fi 
    420   fi 
    421  
    422413  # Check RebuildFrequency against key frequencies : PeriodLength ; PackFrequency ; TimeSeriesFrequency ; SeasonalFrequency 
    423414  if ( [ ! X${config_Post_RebuildFrequency} = X${NULL_STR} ] && [ ! X${config_Post_RebuildFrequency} = XNONE ] ) ; then 
     
    648639  # To use the variable CyclicYear, one must add in config.card CyclicBegin and CyclicEnd. 
    649640  # CyclicBegin is the first year in the cycle. CyclicEnd is the last year included in the cycle. 
    650   # The simulation MUST start with the same year as the CyclicBegin year. 
    651641  if ( [ ! X${config_UserChoices_CyclicBegin} = X ] && [ ! X${config_UserChoices_CyclicEnd} = X ] ) ; then 
    652642    CycleNb=$(( ${config_UserChoices_CyclicEnd} - ${config_UserChoices_CyclicBegin} + 1 )) 
    653     CyclicYear=$(( ( ( ${year} - ${config_UserChoices_CyclicBegin} ) % ${CycleNb} ) + ${config_UserChoices_CyclicBegin} )) 
    654     CyclicYear_p1=$(( ( ( ${year} + 1 - ${config_UserChoices_CyclicBegin} ) % ${CycleNb} ) + ${config_UserChoices_CyclicBegin} )) 
     643    CyclicYear_p1=NOTDEFINED 
     644 
     645    # For current year 
     646    yeartmp=$year 
     647    diffy=$(( $yeartmp - ${config_UserChoices_CyclicBegin} )) 
     648    while [ $diffy -lt 0 ] ; do 
     649      yeartmp=$(( ${yeartmp} + ${CycleNb} )) 
     650      diffy=$(( $yeartmp - ${config_UserChoices_CyclicBegin} )) 
     651    done 
     652    CyclicYear=$(( ( ${diffy} % ${CycleNb} ) + ${config_UserChoices_CyclicBegin} )) 
     653 
     654    # For next coming year 
     655    yeartmp=$(( $year + 1 )) 
     656    diffy=$(( $yeartmp - ${config_UserChoices_CyclicBegin} )) 
     657    while [ $diffy -lt 0 ] ; do 
     658      yeartmp=$(( ${yeartmp} + ${CycleNb} )) 
     659      diffy=$(( $yeartmp - ${config_UserChoices_CyclicBegin} )) 
     660    done 
     661    CyclicYear_p1=$(( ( ${diffy} % ${CycleNb} ) + ${config_UserChoices_CyclicBegin} )) 
     662 
    655663    IGCM_debug_Print 1 "CyclicYear   = ${CyclicYear}, CyclicYear_p1 = ${CyclicYear_p1}, current year=$year" 
    656664  else 
    657665    CyclicYear="ERROR_CyclicYear_Variable_Not_Defined" 
    658666    CyclicYear_p1="ERROR_CyclicYear_p1_Variable_Not_Defined" 
    659     IGCM_debug_Print 1 "CyclicYear not possible to use without adding CyclicBegin and CyclicEnd in config.card" 
     667    IGCM_debug_Print 1 "CyclicYear wont be use without adding CyclicBegin and CyclicEnd in config.card" 
    660668  fi 
    661669 
Note: See TracChangeset for help on using the changeset viewer.