source: CONFIG/UNIFORM/v6/NEMO_v6/GENERAL/DRIVER/pisces.driver @ 2848

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

Take an ocean point -ORCA2/ORCA1/eORCA1- for NEMO scalar

  • Property svn:executable set to *
File size: 4.8 KB
Line 
1#!/bin/ksh
2
3#-----------------------------------
4function MBG_Initialize
5{ 
6    IGCM_debug_PushStack "MBG_Initialize"
7
8# Local function to find namelists parameters
9supergrep () {
10    grep "^ *$1 *=" $2 | sed -e "s% *\!.*%%"
11}
12
13    if [ X"${pisces_UserChoices_Offline_Mode}" = X"y" ] ; then
14       RESOL_OCE=$( echo ${config_UserChoices_ExperimentName} | cut -c1-5 )
15       EXPTYPE=$( echo ${config_UserChoices_ExperimentName} | cut -c6- )
16       OPA_RDT=$( supergrep rn_rdt  ${SUBMIT_DIR}/PARAM/namelist_${RESOL_OCE}${EXPTYPE}_offline_cfg | sed 's/ *rn_rdt *=//' | sed 's/\. *,//' )
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     fi
23
24    IGCM_debug_PopStack "MBG_Initialize"
25}
26
27#-----------------------------------
28function MBG_Update
29{
30    IGCM_debug_PushStack "MBG_Update"
31
32
33    ##--Write Frequency Purpose
34    Nbfreq=$( echo ${config_MBG_WriteFrequency} | wc -w )
35    typeset -Z1 i=1
36    while [ $i -le ${Nbfreq} ]; do
37       topfrequency=$( echo ${config_MBG_WriteFrequency} | awk -v var="$i" "-F " '{print $var}' )
38       topfactor=$( echo ${topfrequency} | sed -e "s/[yYmMdD]//" )
39       case ${topfrequency} in
40         *Y|*y)
41            eval PREFIX_WFT${i}=${config_UserChoices_JobName}_${topfactor}y_${DatesPeriod} ;
42            eval R_OUT_MBG_WFT${i}=${R_OUT_MBG_O_Y} ;
43            eval WFT${i}=${topfactor}Y ;;
44         *M|*m)
45            eval PREFIX_WFT${i}=${config_UserChoices_JobName}_${topfactor}m_${DatesPeriod} ;
46            eval R_OUT_MBG_WFT${i}=${R_OUT_MBG_O_M} ;
47            eval WFT${i}=${topfactor}M ;;
48         *D|*d)
49            eval PREFIX_WFT${i}=${config_UserChoices_JobName}_${topfactor}d_${DatesPeriod} ;
50            eval R_OUT_MBG_WFT${i}=${R_OUT_MBG_O_D} ;
51            eval WFT${i}=${topfactor}D ;;
52         *)
53      esac
54       let i=$i+1
55    done
56
57    if [ X"${pisces_UserChoices_Offline_Mode}" = X"y" ] ; then
58
59
60       # Period Length In Days between DateBegin and first day of calendar 0001 01 01
61       # Needed by OPA namelist to compute correct file names
62       (( PeriodDaysSinceJC =  $( IGCM_date_DaysSinceJC ${PeriodDateBegin} ) + 1  ))
63
64       ## Count of number of time steps from begin of OPA job
65       (( OPA_NIT000 = ( PeriodDaysSinceJC - DaysSinceJC ) * OPA_NDT_DAY + 1 ))
66       (( OPA_NDT   = PeriodLengthInDays * OPA_NDT_DAY ))
67       (( OPA_NITEND = OPA_NIT000 + OPA_NDT - 1))
68
69       ## Forcing to write one restart file at the end of period
70       OPA_NSTOCK="${OPA_NITEND}"
71
72       ## Verification of number of time steps per day
73       (( NB_SEC_DAY_MODEL = OPA_NDT_DAY * OPA_RDT ))
74       (( NB_SEC_DAY = 60 * 60 * 24 ))
75
76       if [ ${NB_SEC_DAY_MODEL} -ne ${NB_SEC_DAY} ] ; then
77           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}
78           echo " VERIFY OPA_NDT_DAY in opa9.card "
79           exit
80       fi
81       
82       # nleapy configuration
83       case ${config_UserChoices_CalendarType} in
84           leap)
85               OPA_NLEAPY=1;;
86           noleap)
87               OPA_NLEAPY=0;;
88           360d)
89               OPA_NLEAPY=30;;
90       esac
91
92       typeset -r PRECIS=8
93       NEMO_END=$( echo $( awk "BEGIN { printf \"%0${PRECIS}d\",${OPA_NITEND} }" ) )
94    fi
95
96    ##-- Restart configuration
97    if ( [ "${CumulPeriod}" -eq 1 ] && [ "${config_MBG_Restart}" = "n" ] ) ; then
98
99        #echo "NO RESTART FOR TOP"
100        TOP_LRSTTR=.FALSE.
101        TOP_NRSTTR=0
102
103    elif ( [ "${CumulPeriod}" -eq 1 ] && [ "${config_MBG_Restart}" = "y" ] ) ; then
104
105        #echo "RESTART TOP"
106        TOP_LRSTTR=.TRUE.
107        TOP_NRSTTR=0
108
109    else
110
111        #echo "RESTART TOP"
112        TOP_LRSTTR=.TRUE.
113        TOP_NRSTTR=2
114
115    fi
116
117# on force les sorties PISCES comme les sorties OPA
118    if [ X"${pisces_UserChoices_Offline_Mode}" = X"y" ] ; then
119      IGCM_comp_modifyNamelist blocker    namelist_cfg cn_exp    ${config_UserChoices_JobName}
120      IGCM_comp_modifyNamelist blocker    namelist_cfg nn_it000  ${OPA_NIT000}
121      IGCM_comp_modifyNamelist blocker    namelist_cfg nn_itend  ${OPA_NITEND}
122      IGCM_comp_modifyNamelist blocker    namelist_cfg nn_stock ${OPA_NSTOCK}
123      IGCM_comp_modifyNamelist blocker    namelist_cfg nn_date0 ${PeriodDateBegin}
124      IGCM_comp_modifyNamelist blocker    namelist_cfg nn_leapy  ${OPA_NLEAPY}
125   fi
126
127   IGCM_comp_modifyNamelist blocker    namelist_top_cfg ln_rsttr  ${TOP_LRSTTR}
128   IGCM_comp_modifyNamelist blocker    namelist_top_cfg nn_rsttr  ${TOP_NRSTTR}
129
130   IGCM_debug_PopStack "MBG_Update"
131}
132
133#-----------------------------------
134function MBG_Finalize
135{
136    IGCM_debug_PushStack "MBG_Finalize"
137
138    echo FINALIZE MBG !!!
139
140    IGCM_debug_PopStack "MBG_Finalize"
141}
142
Note: See TracBrowser for help on using the repository browser.