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

Last change on this file since 3408 was 3408, checked in by cetlod, 7 years ago

Update NEMO card & driver

  • Property svn:executable set to *
File size: 7.3 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=${config_UserChoices_ExpType%%_*}
15       EXPTYPE=${config_UserChoices_ExpType##*/}
16
17       IGCM_debug_Print 1 " "
18       IGCM_debug_Print 1 "RESOL_OCE        : ${RESOL_OCE}"
19       IGCM_debug_Print 1 "EXPERIMENT TYPE  : ${EXPTYPE}"
20
21       OPA_RDT=$( supergrep rn_rdt  ${SUBMIT_DIR}/PARAM/namelist_${RESOL_OCE}${EXPTYPE}_offline_cfg | sed 's/ *rn_rdt *=//' | sed 's/\. *,//' )
22       # Period Length In Days between DateBegin and first day of calendar 0001 01 01
23       # /!\ Needed by OPA namelist to compute file names /!\
24       (( DaysSinceJC = $( IGCM_date_DaysSinceJC ${DateBegin} ) + 1 ))
25
26       (( OPA_NPDT_DAY  =  86400 / OPA_RDT ))
27       (( OPA_NPDT_YEAR  =  OPA_NPDT_DAY * 365     ))
28
29
30       IGCM_debug_Print 1 " "
31       IGCM_debug_Print 1 "OPA_RDT        ${OPA_RDT}"
32       IGCM_debug_Print 1 "OPA_NPDT_DAY   ${OPA_NPDT_DAY}"
33       IGCM_debug_Print 1 "OPA_NPDT_YEAR  ${OPA_NPDT_YEAR}"
34
35     fi
36
37    IGCM_debug_PopStack "MBG_Initialize"
38}
39
40#-----------------------------------
41function MBG_Update
42{
43    IGCM_debug_PushStack "MBG_Update"
44
45    V1D_ENABLE=".FALSE."
46    V5D_ENABLE=".FALSE."
47    V1M_ENABLE=".FALSE."
48    V1Y_ENABLE=".FALSE."
49
50    for frequency in ${config_OCE_WriteFrequency} ; do
51        case ${frequency} in
52            ( 1D|1d ) V1D_ENABLE=".TRUE." ;;
53            ( 5D|5d ) V5D_ENABLE=".TRUE." ;;
54            ( 1M|1m ) V1M_ENABLE=".TRUE." ;;
55            ( *[yY] ) V1Y_ENABLE=".TRUE." ;;
56        esac
57    done
58
59
60    if [ X"${pisces_UserChoices_Offline_Mode}" = X"y" ] ; then
61
62       # Period Length In Days between DateBegin and first day of calendar 0001 01 01
63       # Needed by OPA namelist to compute correct file names
64       (( PeriodDaysSinceJC =  $( IGCM_date_DaysSinceJC ${PeriodDateBegin} ) + 1  ))
65
66       ## Count of number of time steps from begin of OPA job
67       (( OPA_NIT000 = ( PeriodDaysSinceJC - DaysSinceJC ) * OPA_NPDT_DAY + 1 ))
68       (( OPA_NDT   = PeriodLengthInDays * OPA_NPDT_DAY ))
69       (( OPA_NITEND = OPA_NIT000 + OPA_NDT - 1))
70
71       ## Forcing to write one restart file at the end of period
72       OPA_NSTOCK="${OPA_NITEND}"
73
74       # nleapy configuration
75       case ${config_UserChoices_CalendarType} in
76           leap)
77               OPA_NLEAPY=1;;
78           noleap)
79               OPA_NLEAPY=0;;
80           360d)
81               OPA_NLEAPY=30;;
82       esac
83
84       typeset -r PRECIS=8
85       NEMO_END=$( echo $( awk "BEGIN { printf \"%0${PRECIS}d\",${OPA_NITEND} }" ) )
86
87
88       DYN_SSH_INI=.TRUE.
89       if [ "${EXPTYPE}" = "ia"   ] ; then
90          NbDynFile=${#pisces_UserChoices_DynFiles[*]}
91          (( LengthForcing=${pisces_UserChoices_DynYearEnd} - ${pisces_UserChoices_DynYearStart} + 1 ))
92          (( DiffForcing=abs( ${pisces_UserChoices_DynYearEnd} - ${year} ) ))
93          (( ModuloForcing=${DiffForcing} % ${LengthForcing} ))
94          if [ ${ModuloForcing} -eq 0 ] ; then
95             (( year_forcing=${pisces_UserChoices_DynYearEnd} ))
96          else
97             if [ ${year} -ge ${pisces_UserChoices_DynYearStart} ] && [ ${year} -le ${pisces_UserChoices_DynYearEnd} ] ; then
98                year_forcing=${year}
99             elif [ ${year} -lt ${pisces_UserChoices_DynYearStart} ] ; then
100                (( year_forcing=${pisces_UserChoices_DynYearEnd} - ${ModuloForcing} ))
101             else
102                (( year_forcing=${pisces_UserChoices_DynYearStart} + ${ModuloForcing} - 1 ))
103             fi
104          fi
105          (( year_forcing_m1 = ${year_forcing} - 1))
106          (( year_forcing_p1 = ${year_forcing} + 1))
107          eval CurrDateFor=${year_forcing}0101_${year_forcing}1231
108          eval PrevDateFor=${year_forcing_m1}0101_${year_forcing_m1}1231
109          eval NextDateFor=${year_forcing_p1}0101_${year_forcing_p1}1231
110          (( i = 0 ))
111           while [ $i -lt ${NbDynFile} ] ; do
112             eval Suffix=${pisces_UserChoices_DynFiles[$i]}
113             eval RunFileName=${pisces_UserChoices_DynRunName}_${Suffix}
114             eval PrevDynFileName=${pisces_UserChoices_DynName}_${PrevDateFor}_${pisces_UserChoices_DynFreq}_${Suffix}
115             eval CurrDynFileName=${pisces_UserChoices_DynName}_${CurrDateFor}_${pisces_UserChoices_DynFreq}_${Suffix}
116             eval NextDynFileName=${pisces_UserChoices_DynName}_${NextDateFor}_${pisces_UserChoices_DynFreq}_${Suffix}
117##             IGCM_sys_Get ${pisces_UserChoices_R_DYN}/${PrevDynFileName}.nc  ${RunFileName}_y${year_m1}.nc
118             IGCM_sys_Get ${pisces_UserChoices_R_DYN}/${CurrDynFileName}.nc  ${RunFileName}_y${year}.nc
119##             IGCM_sys_Get ${pisces_UserChoices_R_DYN}/${NextDynFileName}.nc  ${RunFileName}_y${year_p1}.nc
120             (( i = i + 1 ))
121          done
122          if [ ${year_forcing} = ${pisces_UserChoices_DynYearStart} ] ; then
123             DYN_SSH_INI=.TRUE.
124          else
125             DYN_SSH_INI=.FALSE
126          fi
127       fi
128    fi
129
130    ##-- Restart configuration
131    if ( [ "${CumulPeriod}" -eq 1 ] && [ "${config_MBG_Restart}" = "n" ] ) ; then
132
133        #echo "NO RESTART FOR TOP"
134        TOP_LRSTTR=.FALSE.
135        TOP_NRSTTR=0
136
137    elif ( [ "${CumulPeriod}" -eq 1 ] && [ "${config_MBG_Restart}" = "y" ] ) ; then
138
139        #echo "RESTART TOP"
140        TOP_LRSTTR=.TRUE.
141        TOP_NRSTTR=0
142
143    else
144
145        #echo "RESTART TOP"
146        TOP_LRSTTR=.TRUE.
147        TOP_NRSTTR=2
148    fi
149
150# on force les sorties PISCES comme les sorties OPA
151    if [ X"${pisces_UserChoices_Offline_Mode}" = X"y" ] ; then
152      IGCM_comp_modifyNamelist blocker    namelist_cfg cn_exp    ${config_UserChoices_JobName}
153      IGCM_comp_modifyNamelist blocker    namelist_cfg nn_it000  ${OPA_NIT000}
154      IGCM_comp_modifyNamelist blocker    namelist_cfg nn_itend  ${OPA_NITEND}
155      IGCM_comp_modifyNamelist blocker    namelist_cfg nn_stock ${OPA_NSTOCK}
156      IGCM_comp_modifyNamelist blocker    namelist_cfg nn_date0 ${PeriodDateBegin}
157      IGCM_comp_modifyNamelist blocker    namelist_cfg nn_leapy  ${OPA_NLEAPY}
158
159# update domain_def.xml file
160      case ${RESOL_OCE} in
161          ( *ORCA025* ) 
162            sed -e 's/<zoom_domain id="1point" ibegin="139" jbegin="119"/<zoom_domain id="1point" ibegin="600" jbegin="600"/' domain_def_nemo.xml > domain_def.xml.tmp 
163            IGCM_sys_Mv domain_def.xml.tmp domain_def_nemo.xml  ;
164      esac
165
166   fi
167
168   IGCM_comp_modifyNamelist blocker    namelist_top_cfg ln_rsttr  ${TOP_LRSTTR}
169   IGCM_comp_modifyNamelist blocker    namelist_top_cfg nn_rsttr  ${TOP_NRSTTR}
170   IGCM_comp_modifyNamelist blocker    namelist_pisces_cfg  atcco2    ${pisces_UserChoices_AtmCo2}
171   IGCM_comp_modifyNamelist blocker    namelist_pisces_cfg  nn_pisdmp  ${OPA_NPDT_YEAR}
172   IGCM_comp_modifyNamelist blocker    namelist_pisces_cfg  nrdttrc    ${pisces_UserChoices_PisFreq}
173
174
175   IGCM_comp_modifyXmlFile nonblocker file_def_nemo-pisces.xml 1d enabled ${V1D_ENABLE}
176   IGCM_comp_modifyXmlFile nonblocker file_def_nemo-pisces.xml 1m enabled ${V1M_ENABLE}
177   IGCM_comp_modifyXmlFile nonblocker file_def_nemo-pisces.xml 1y enabled ${V1Y_ENABLE}
178
179
180   IGCM_debug_PopStack "MBG_Update"
181}
182
183#-----------------------------------
184function MBG_Finalize
185{
186    IGCM_debug_PushStack "MBG_Finalize"
187
188    echo FINALIZE MBG !!!
189
190    IGCM_debug_PopStack "MBG_Finalize"
191}
192
Note: See TracBrowser for help on using the repository browser.