source: CONFIG/UNIFORM/v6/NEMO_v7_dev/GENERAL/DRIVER/pisces.driver @ 3829

Last change on this file since 3829 was 3186, checked in by flavoni, 7 years ago

add NEMO_v7_dev to run NEMO forced mode, trunk version

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