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

Last change on this file since 5025 was 5025, checked in by cetlod, 4 years ago

NEMOv6.5 : update config

File size: 10.0 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
15       if [ X$ResolOce != X ]; then
16          #ResolOce is set in config.card
17          RESOL_OCE=${ResolOce}
18       else
19          RESOL_OCE=${config_UserChoices_ExpType%%_*}
20       fi
21       ORCAGRID=${opa9_UserChoices_ORCA_version%%.*}
22       exptype=${config_UserChoices_ExpType##*/}
23
24       IGCM_debug_Print 1 " "
25       IGCM_debug_Print 1 "RESOL_OCE        : ${RESOL_OCE}"
26       IGCM_debug_Print 1 "ORCAGRID         : ${ORCAGRID}"
27       IGCM_debug_Print 1 "EXPERIMENT TYPE  : ${exptype}"
28
29
30       OPA_RDT=$( supergrep rn_rdt  ${SUBMIT_DIR}/PARAM/NAMELIST/${RESOL_OCE}/namelist_offline_${exptype}_cfg | sed 's/ *rn_rdt *=//' | sed 's/\. *,//' )
31       # Period Length In Days between DateBegin and first day of calendar 0001 01 01
32       # /!\ Needed by OPA namelist to compute file names /!\
33       (( DaysSinceJC = $( IGCM_date_DaysSinceJC ${DateBegin} ) + 1 ))
34
35       (( OPA_NPDT_DAY  =  86400 / OPA_RDT ))
36       (( OPA_NPDT_YEAR  =  OPA_NPDT_DAY * 365     ))
37
38
39       IGCM_debug_Print 1 " "
40       IGCM_debug_Print 1 "OPA_RDT        ${OPA_RDT}"
41       IGCM_debug_Print 1 "OPA_NPDT_DAY   ${OPA_NPDT_DAY}"
42       IGCM_debug_Print 1 "OPA_NPDT_YEAR  ${OPA_NPDT_YEAR}"
43
44     fi
45
46    IGCM_debug_PopStack "MBG_Initialize"
47}
48
49#-----------------------------------
50function MBG_Update
51{
52    IGCM_debug_PushStack "MBG_Update"
53
54   
55    ##--Write Frequency for iomput
56    ## Differents frequencies are allowed for MBG files
57
58    VT1D_ENABLE=".FALSE."
59    VT5D_ENABLE=".FALSE."
60    VT1M_ENABLE=".FALSE."
61    VT1Y_ENABLE=".FALSE."
62
63    for frequency in ${config_MBG_WriteFrequency} ; do
64        case ${frequency} in
65            ( 1D|1d ) VT1D_ENABLE=".TRUE." ;;
66            ( 5D|5d ) VT5D_ENABLE=".TRUE." ;;
67            ( 1M|1m ) VT1M_ENABLE=".TRUE." ;;
68            ( *[yY] ) VT1Y_ENABLE=".TRUE." ;;
69        esac
70    done
71
72
73    if [ X"${pisces_UserChoices_Offline_Mode}" = X"y" ] ; then
74
75       # Period Length In Days between DateBegin and first day of calendar 0001 01 01
76       # Needed by OPA namelist to compute correct file names
77       (( PeriodDaysSinceJC =  $( IGCM_date_DaysSinceJC ${PeriodDateBegin} ) + 1  ))
78
79       ## Count of number of time steps from begin of OPA job
80       (( OPA_NIT000 = ( PeriodDaysSinceJC - DaysSinceJC ) * OPA_NPDT_DAY + 1 ))
81       (( OPA_NDT   = PeriodLengthInDays * OPA_NPDT_DAY ))
82       (( OPA_NITEND = OPA_NIT000 + OPA_NDT - 1))
83
84       ## Forcing to write one restart file at the end of period
85       OPA_NSTOCK="${OPA_NITEND}"
86
87       # nleapy configuration
88       case ${config_UserChoices_CalendarType} in
89           leap)
90               OPA_NLEAPY=1;;
91           noleap)
92               OPA_NLEAPY=0;;
93           360d)
94               OPA_NLEAPY=30;;
95       esac
96
97       typeset -r PRECIS=8
98       NEMO_END=$( echo $( awk "BEGIN { printf \"%0${PRECIS}d\",${OPA_NITEND} }" ) )
99
100
101       DYN_SSH_INI=.TRUE.
102       if [ "${exptype}" = "ia"   ] ; then
103          NbDynFile=${#pisces_UserChoices_DynFiles[*]}
104          (( LengthForcing=${pisces_UserChoices_DynYearEnd} - ${pisces_UserChoices_DynYearStart} + 1 ))
105          (( DiffForcing=abs( ${pisces_UserChoices_DynYearEnd} - ${year} ) ))
106          (( ModuloForcing=${DiffForcing} % ${LengthForcing} ))
107          if [ ${ModuloForcing} -eq 0 ] ; then
108             (( year_forcing=${pisces_UserChoices_DynYearEnd} ))
109          else
110             if [ ${year} -ge ${pisces_UserChoices_DynYearStart} ] && [ ${year} -le ${pisces_UserChoices_DynYearEnd} ] ; then
111                year_forcing=${year}
112             elif [ ${year} -lt ${pisces_UserChoices_DynYearStart} ] ; then
113                (( year_forcing=${pisces_UserChoices_DynYearEnd} - ${ModuloForcing} ))
114             else
115                (( year_forcing=${pisces_UserChoices_DynYearStart} + ${ModuloForcing} - 1 ))
116             fi
117          fi
118          (( year_forcing_m1 = ${year_forcing} - 1))
119          (( year_forcing_p1 = ${year_forcing} + 1))
120          eval CurrDateFor=${year_forcing}0101_${year_forcing}1231
121          eval PrevDateFor=${year_forcing_m1}0101_${year_forcing_m1}1231
122          eval NextDateFor=${year_forcing_p1}0101_${year_forcing_p1}1231
123          (( i = 0 ))
124           while [ $i -lt ${NbDynFile} ] ; do
125             eval Suffix=${pisces_UserChoices_DynFiles[$i]}
126             eval RunFileName=${pisces_UserChoices_DynRunName}_${Suffix}
127             eval PrevDynFileName=${pisces_UserChoices_DynName}_${PrevDateFor}_${pisces_UserChoices_DynFreq}_${Suffix}
128             eval CurrDynFileName=${pisces_UserChoices_DynName}_${CurrDateFor}_${pisces_UserChoices_DynFreq}_${Suffix}
129             eval NextDynFileName=${pisces_UserChoices_DynName}_${NextDateFor}_${pisces_UserChoices_DynFreq}_${Suffix}
130             IGCM_sys_Get ${pisces_UserChoices_R_DYN}/${PrevDynFileName}.nc  ${RunFileName}_y${year_m1}.nc
131             IGCM_sys_Get ${pisces_UserChoices_R_DYN}/${CurrDynFileName}.nc  ${RunFileName}_y${year}.nc
132             IGCM_sys_Get ${pisces_UserChoices_R_DYN}/${NextDynFileName}.nc  ${RunFileName}_y${year_p1}.nc
133             ln -sf ${RunFileName}_y${year}.nc ${RunFileName}.nc
134             (( i = i + 1 ))
135          done
136          if [ ${year_forcing} = ${pisces_UserChoices_DynYearStart} ] ; then
137             DYN_SSH_INI=.TRUE.
138          else
139             DYN_SSH_INI=.FALSE
140          fi
141       fi
142    fi
143
144    ##-- Restart configuration
145    if ( [ "${CumulPeriod}" -eq 1 ] && [ "${config_MBG_Restart}" = "n" ] ) ; then
146
147        #echo "NO RESTART FOR TOP"
148        TOP_LRSTTR=.FALSE.
149        TOP_NRSTTR=0
150
151    elif ( [ "${CumulPeriod}" -eq 1 ] && [ "${config_MBG_Restart}" = "y" ] ) ; then
152
153        #echo "RESTART TOP"
154        TOP_LRSTTR=.TRUE.
155        TOP_NRSTTR=0
156
157    else
158
159        #echo "RESTART TOP"
160        TOP_LRSTTR=.TRUE.
161        TOP_NRSTTR=2
162    fi
163
164# on force les sorties PISCES comme les sorties OPA
165    if [ X"${pisces_UserChoices_Offline_Mode}" = X"y" ] ; then
166      IGCM_comp_modifyNamelist blocker    namelist_cfg cn_exp    ${config_UserChoices_JobName}
167      IGCM_comp_modifyNamelist blocker    namelist_cfg nn_it000  ${OPA_NIT000}
168      IGCM_comp_modifyNamelist blocker    namelist_cfg nn_itend  ${OPA_NITEND}
169      IGCM_comp_modifyNamelist blocker    namelist_cfg nn_stock ${OPA_NSTOCK}
170      IGCM_comp_modifyNamelist blocker    namelist_cfg nn_date0 ${PeriodDateBegin}
171      IGCM_comp_modifyNamelist blocker    namelist_cfg nn_leapy  ${OPA_NLEAPY}
172
173# update domain_def.xml file
174      case ${RESOL_OCE} in
175          ( *ORCA025* ) 
176            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 
177            IGCM_sys_Mv domain_def.xml.tmp domain_def_nemo.xml  ;
178      esac
179
180      IGCM_comp_modifyXmlFile force context_nemo.xml ref_year NONE ${InitYear}
181
182   fi
183
184   if [ X"${pisces_UserChoices_age}" = X"y" ] ; then
185      echo "Activate age tracer"
186      TOP_AGE=.TRUE.
187      IGCM_comp_modifyXmlFile force file_def_nemo-pisces.xml file38 enabled .TRUE.
188   else
189      TOP_AGE=.FALSE.
190      IGCM_comp_modifyXmlFile force file_def_nemo-pisces.xml file38 enabled .FALSE.
191   fi
192##
193   if [ X"${pisces_UserChoices_cfc11}" = X"y" ] ; then
194      echo "Activate CFC11  tracer"
195      TOP_CFC11=.TRUE.
196      IGCM_comp_modifyXmlFile force file_def_nemo-pisces.xml file39 enabled .FALSE.
197   else
198      TOP_CFC11=.FALSE.
199      IGCM_comp_modifyXmlFile force file_def_nemo-pisces.xml file39 enabled .FALSE.
200   fi
201##
202   if [ X"${pisces_UserChoices_cfc12}" = X"y" ] ; then
203      echo "Activate CFC12  tracer"
204      TOP_CFC12=.TRUE.
205      IGCM_comp_modifyXmlFile force file_def_nemo-pisces.xml file40 enabled .TRUE.
206   else
207      TOP_CFC12=.FALSE.
208      IGCM_comp_modifyXmlFile force file_def_nemo-pisces.xml file40 enabled .FALSE.
209   fi
210##
211   if [ X"${pisces_UserChoices_Co2Anthr}" = X"y" ] ; then
212      LCO2INT=.TRUE.
213   else
214      LCO2INT=.FALSE.
215   fi
216   ##-- Update namelist_top_cfg and namelist_pisces_cfg
217    IGCM_comp_modifyNamelist blocker    namelist_top_cfg     ln_rsttr  ${TOP_LRSTTR}
218    IGCM_comp_modifyNamelist blocker    namelist_top_cfg     nn_rsttr  ${TOP_NRSTTR}
219    IGCM_comp_modifyNamelist blocker    namelist_top_cfg     ln_age    ${TOP_AGE}
220    IGCM_comp_modifyNamelist blocker    namelist_top_cfg     ln_cfc11  ${TOP_CFC11}
221    IGCM_comp_modifyNamelist blocker    namelist_top_cfg     ln_cfc12  ${TOP_CFC12}
222    IGCM_comp_modifyNamelist blocker    namelist_pisces_cfg  ln_co2int ${LCO2INT}
223    IGCM_comp_modifyNamelist blocker    namelist_pisces_cfg  atcco2    ${pisces_UserChoices_AtmCo2}
224    IGCM_comp_modifyNamelist blocker    namelist_pisces_cfg  nrdttrc   ${pisces_UserChoices_PisFreq}
225    IGCM_comp_modifyNamelist blocker    namelist_pisces_cfg  nn_pisdmp ${OPA_NPDT_YEAR}
226
227 
228    # Update iodef.xml
229
230    IGCM_debug_Print 1 'Informations into iodef.xml : VT1D_ENABLE VT5D_ENABLE VT1M_ENABLE VT1Y_ENABLE '
231    IGCM_debug_Print 1 ${VT1D_ENABLE}  ${VT5D_ENABLE} ${VT1M_ENABLE} ${VT1Y_ENABLE}
232
233    IGCM_comp_modifyXmlFile nonblocker file_def_nemo-pisces.xml 1d_pis enabled ${VT1D_ENABLE}
234    IGCM_comp_modifyXmlFile nonblocker file_def_nemo-pisces.xml 5d_pis enabled ${VT5D_ENABLE}
235    IGCM_comp_modifyXmlFile nonblocker file_def_nemo-pisces.xml 1m_pis enabled ${VT1M_ENABLE}
236    IGCM_comp_modifyXmlFile nonblocker file_def_nemo-pisces.xml 1y_pis enabled ${VT1Y_ENABLE}
237
238    IGCM_comp_modifyXmlFile nonblocker file_def_nemo-pisces.xml 1d_pis output_level ${pisces_UserChoices_OutputLevel}
239    IGCM_comp_modifyXmlFile nonblocker file_def_nemo-pisces.xml 5d_pis output_level ${pisces_UserChoices_OutputLevel}
240    IGCM_comp_modifyXmlFile nonblocker file_def_nemo-pisces.xml 1m_pis output_level ${pisces_UserChoices_OutputLevel}
241    IGCM_comp_modifyXmlFile nonblocker file_def_nemo-pisces.xml 1y_pis output_level ${pisces_UserChoices_OutputLevel}
242
243
244
245   IGCM_debug_PopStack "MBG_Update"
246}
247
248#-----------------------------------
249function MBG_Finalize
250{
251    IGCM_debug_PushStack "MBG_Finalize"
252
253    echo FINALIZE MBG !!!
254
255    IGCM_debug_PopStack "MBG_Finalize"
256}
257
Note: See TracBrowser for help on using the repository browser.