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

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

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