source: CONFIG/UNIFORM/v6/NEMO_v6/GENERAL/DRIVER/opa9.driver @ 2871

Last change on this file since 2871 was 2871, checked in by cetlod, 6 years ago

Change time-step for NEMO ORCA1 configuration

File size: 5.5 KB
Line 
1#!/bin/ksh
2#-----------------------------------------------------------------
3function OCE_Initialize
4{
5    IGCM_debug_PushStack "OCE_Initialize"
6
7    RESOL_OCE=$( echo ${config_UserChoices_ExperimentName} | cut -c1-5 )
8    EXPTYPE=$( echo ${config_UserChoices_ExperimentName} | cut -c6- )
9
10# Local function to find namelists parameters
11supergrep () {
12    grep "^ *$1 *=" $2 | sed -e "s% *\!.*%%"
13}
14
15    OPA_RDT=$( supergrep rn_rdt  ${SUBMIT_DIR}/PARAM/namelist_${RESOL_OCE}${EXPTYPE}_cfg | sed 's/ *rn_rdt *=//' | sed 's/\. *,//' )
16
17    # Period Length In Days between DateBegin and first day of calendar 0001 01 01
18    # /!\ Needed by OPA namelist to compute file names /!\
19    (( DaysSinceJC = $( IGCM_date_DaysSinceJC ${DateBegin} ) + 1 ))
20
21    (( OPA_NDT_DAY  =  86400 / OPA_RDT ))
22    (( OPA_NPDT_YEAR  =  OPA_NPDT_DAY * 365     ))
23
24    # Definition from opa9.card of List_jobsbc and List_runsbc used to do to interannual and climatological runs
25        IGCM_card_DefineArrayFromOption ${SUBMIT_DIR}/COMP/opa9.card Interannual List_jobsbc
26        set -A ListFormulationJobsbc -- \${opa9_Interannual_Listjobsc${opa9_Interannual_List_jobsbc}[*]}
27
28    IGCM_debug_PopStack "OCE_Initialize"
29}
30
31#-----------------------------------------------------------------
32function OCE_Update
33{
34    IGCM_debug_PushStack "OCE_Update"
35
36    NbFreq=$( echo ${config_OCE_WriteFrequency} | wc -w )
37    ##--Write Frequency Purpose ....
38    typeset -Z1 i=1
39    while [ $i -le ${NbFreq} ]; do
40        frequency=$( echo ${config_OCE_WriteFrequency} | awk -v var="$i" "-F " '{print $var}' )
41        factor=$( echo ${frequency} | sed -e "s/[yYmMdDhH]//" )
42
43        case ${frequency} in
44            *Y|*y)
45                eval PREFIX_WF${i}=${config_UserChoices_JobName}_${factor}y_${DatesPeriod} ;
46                eval R_OUT_OCE_WF${i}=${R_OUT_OCE_O_Y} ;
47                eval WF${i}=${factor}Y ;;
48            *M|*m)
49                eval PREFIX_WF${i}=${config_UserChoices_JobName}_${factor}m_${DatesPeriod} ;
50                eval R_OUT_OCE_WF${i}=${R_OUT_OCE_O_M} ;
51                eval WF${i}=${factor}M ;;
52            *D|*d)
53                eval PREFIX_WF${i}=${config_UserChoices_JobName}_${factor}d_${DatesPeriod} ;
54                eval R_OUT_OCE_WF${i}=${R_OUT_OCE_O_D} ;
55                eval WF${i}=${factor}D ;;
56            *H|*h)
57                eval PREFIX_WF${i}=${config_UserChoices_JobName}_${factor}h_${DatesPeriod} ;
58                eval R_OUT_OCE_WF${i}=${R_OUT_OCE_O_H} ;
59                eval WF${i}=${factor}H ;;
60            *)
61        esac
62        let i=$i+1
63
64    done
65    # Period Length In Days between DateBegin and first day of calendar 0001 01 01
66    # Needed by OPA namelist to compute correct file names
67    (( PeriodDaysSinceJC =  $( IGCM_date_DaysSinceJC ${PeriodDateBegin} ) + 1  ))
68
69    ## Count of number of time steps from begin of OPA job
70    (( OPA_NIT000 = ( PeriodDaysSinceJC - DaysSinceJC ) * OPA_NDT_DAY + 1 ))
71    (( OPA_NDT   = PeriodLengthInDays * OPA_NDT_DAY ))
72    (( OPA_NITEND = OPA_NIT000 + OPA_NDT - 1))
73
74    ## Forcing to write one restart file at the end of period
75    OPA_NSTOCK="${OPA_NITEND}"
76
77    ## Verification of number of time steps per day
78    (( NB_SEC_DAY_MODEL = OPA_NDT_DAY * OPA_RDT ))
79    (( NB_SEC_DAY = 60 * 60 * 24 ))
80
81    if [ ${NB_SEC_DAY_MODEL} -ne ${NB_SEC_DAY} ]
82        then
83        echo " NB_SEC_DAY_MODEL "${NB_SEC_DAY_MODEL} "NB_SEC_DAY" ${NB_SEC_DAY} "OPA_NDT_DAY" ${OPA_NDT_DAY} "OPA_RDT" ${OPA_RDT}
84        echo " VERIFY OPA_NDT_DAY in opa9.card "
85        exit
86    fi
87
88    ##-- Restart configuration
89    if ( [ "${CumulPeriod}" -eq 1 ] && [ "${config_OCE_Restart}" = "n" ] ) ; then
90
91        #echo "NO OPA RESTART"
92        OPA_LRSTAR=.FALSE.
93        OPA_NRSTDT=0
94        #Put OPA_NMSH=0 when OPA runnig in parallel mode
95        OPA_NMSH=1
96        ( [ X${mpiTasks} != X ] && [ "${mpiTasks}" -gt 1 ] ) && OPA_NMSH=0
97
98    elif ( [ "${CumulPeriod}" -eq 1 ] && [ "${config_OCE_Restart}" = "y" ] ) ; then
99
100        #echo "OPA RESTART"
101        OPA_LRSTAR=.TRUE.
102        OPA_NRSTDT=0
103        OPA_NMSH=0
104
105    else
106
107        #echo "OPA RESTART"
108        OPA_LRSTAR=.TRUE.
109        OPA_NRSTDT=2
110        OPA_NMSH=0
111
112    fi
113   
114     ## nleapy configuration
115        case ${config_UserChoices_CalendarType} in
116                leap)
117                OPA_NLEAPY=1;;
118                noleap)
119                OPA_NLEAPY=0;;
120                360d)
121                OPA_NLEAPY=30;;
122        esac
123
124
125        typeset -r PRECIS=8
126        NEMO_END=$( echo $( awk "BEGIN { printf \"%0${PRECIS}d\",${OPA_NITEND} }" ) ) 
127
128   IGCM_comp_modifyNamelist blocker    namelist_cfg cn_exp    ${config_UserChoices_JobName}
129   IGCM_comp_modifyNamelist blocker    namelist_cfg nn_it000  ${OPA_NIT000}
130   IGCM_comp_modifyNamelist blocker    namelist_cfg nn_itend  ${OPA_NITEND}
131   IGCM_comp_modifyNamelist blocker    namelist_cfg ln_rstart ${OPA_LRSTAR}
132   IGCM_comp_modifyNamelist blocker    namelist_cfg nn_stock ${OPA_NSTOCK}
133   IGCM_comp_modifyNamelist blocker    namelist_cfg nn_rstctl ${OPA_NRSTDT}
134   IGCM_comp_modifyNamelist blocker    namelist_cfg nn_date0 ${PeriodDateBegin}
135   IGCM_comp_modifyNamelist nonblocker namelist_cfg nn_msh    ${OPA_NMSH}
136   IGCM_comp_modifyNamelist blocker    namelist_cfg nn_leapy  ${OPA_NLEAPY} 
137
138   IGCM_debug_PopStack "OCE_Update"
139}
140
141#-----------------------------------
142function OCE_Finalize
143{
144    IGCM_debug_PushStack "OCE_Finalize"
145
146    if [ -f date.file ] ; then
147        # Prefix use in opa.card AND in lim2.card :
148        DATE_OPA=$( cat date.file | \
149            sed "s/\ ${config_UserChoices_JobName}_[0-9]*[a-z]_\([0-9]*_[0-9]*\)_\ */\1/g" )
150        ###DATE_OPA=$( $DATE_OPABF | cut -c1-30 )
151        MainPrefix=${config_UserChoices_JobName}_1d_${DATE_OPA}
152        SecondPrefix=${config_UserChoices_JobName}_5d_${DATE_OPA}
153    fi
154
155    echo FINALIZE OCE !!!
156
157    IGCM_debug_PopStack "OCE_Finalize"
158}
159
Note: See TracBrowser for help on using the repository browser.