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

Last change on this file since 2875 was 2875, checked in by cetlod, 8 years ago

Minor updates of NEMO_v6 co,figuration

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