source: CONFIG/IPSLCM/IPSLCM5/branches/IPSLCM5_WORK/EXP00/COMP/opa9.driver @ 583

Last change on this file since 583 was 583, checked in by aclsce, 15 years ago

Modified IPSLCM5_WORK configuration according to IPSLCM5 configuration
changes :

  • changed nemo by opa9 as component name (config.card,
  • opa9.driver, opa9.card)
  • added 5655 resolution
  • Default resolution ORCA2_LMD9695
  • Modified coupling mode : now conservative mode
  • Added diaeiv cpp key and diaptr calculation
  • Changed ORCA2.1 by ORCA2.2 (to allow diaptr atlas)
  • Property svn:executable set to *
File size: 7.8 KB
Line 
1#!/bin/ksh
2#-----------------------------------------------------------------
3function OCE_Initialize
4{
5    IGCM_debug_PushStack "OCE_Initialize"
6
7    JOB_NAME=${config_UserChoices_JobName}
8    RESOL_OCE=$( echo $RESOL | awk "-Fx" '{print $1}' )
9
10    ORCA_NPDT_JOUR=${opa9_UserChoices_OPA_NPDT_JOURS:=15}
11
12# Local function to find namelists parameters
13        supergrep () {
14            grep "^ *$1 *=" $2 | sed -e "s% *\!.*%%"
15        }
16       
17    ##--Variables used by OPA --
18
19    # cexper experience name for vairmer format
20    # ln_rstart boolean term for restart (true or false)
21    # nrstdt control of the time step (0, 1 or 2)
22    # nit000 number of the first time step
23    # nitend number of the last time step
24    # ndate0 initial calendar date aammjj
25    # nleapy Leap year calendar (1) or not (0), or 360 days calendar (30)
26    # nstock frequency of restart file
27    # nwrite frequency of OUTPUT file
28    # nmsh  =1 create a mesh file (coordinates, scale factors, masks)
29    # nwrihf frequency of HF OUTPUT file
30    # rdt time step in seconds (coming from namelist)
31    # nf_ptr_wri frequency of zonal means and transport output
32
33            PAT_CEXPER=$( supergrep cexper     ${SUBMIT_DIR}/PARAM/namelist_${RESOL_OCE} )
34            PAT_NIT000=$( supergrep nit000     ${SUBMIT_DIR}/PARAM/namelist_${RESOL_OCE} )
35            PAT_NITEND=$( supergrep nitend     ${SUBMIT_DIR}/PARAM/namelist_${RESOL_OCE} )
36            PAT_NWRITE=$( supergrep nwrite     ${SUBMIT_DIR}/PARAM/namelist_${RESOL_OCE} )
37            PAT_NF_PTR=$( supergrep nf_ptr_wri ${SUBMIT_DIR}/PARAM/namelist_${RESOL_OCE} )
38            PAT_RESTAR=$( supergrep ln_rstart  ${SUBMIT_DIR}/PARAM/namelist_${RESOL_OCE} )
39            PAT_NSTOCK=$( supergrep nstock     ${SUBMIT_DIR}/PARAM/namelist_${RESOL_OCE} )
40            PAT_NRSTAR=$( supergrep nrstdt     ${SUBMIT_DIR}/PARAM/namelist_${RESOL_OCE} )
41            PAT_NDATE0=$( supergrep ndate0     ${SUBMIT_DIR}/PARAM/namelist_${RESOL_OCE} )
42            PAT_NLEAPY=$( supergrep nleapy     ${SUBMIT_DIR}/PARAM/namelist_${RESOL_OCE} )
43            PAT_NMSH=$(   supergrep nmsh       ${SUBMIT_DIR}/PARAM/namelist_${RESOL_OCE} )
44       
45            ORCA_RDT=$( supergrep rdt  ${SUBMIT_DIR}/PARAM/namelist_${RESOL_OCE} | sed 's/ *rdt *=//' | sed 's/\. *//' )
46
47    # Period Length In Days between DateBegin and first day of calendar 0001 01 01
48    # /!\ Needed by OPA namelist to compute file names /!\
49    (( DaysSinceJC = $( IGCM_date_DaysSinceJC ${DateBegin} ) + 1 ))
50
51    IGCM_debug_PopStack "OCE_Initialize"
52}
53
54#-----------------------------------------------------------------
55function OCE_Update
56{
57    IGCM_debug_PushStack "OCE_Update"
58
59    NbFreq=$( echo ${config_OCE_WriteFrequency} | wc -w )
60
61    ##--Write Frequency Purpose ....
62    frequency=$( echo ${config_OCE_WriteFrequency} | awk "-F " '{print $1}' )
63    factor=$( echo ${frequency} | sed -e "s/[yYmMdD]//" )
64    case ${frequency} in
65        1Y|1y)
66            (( ORCA_NWRITE = ORCA_NPDT_JOUR * factor * $( IGCM_date_DaysInYear  ${year} ) ))          ;
67            PREFIX_NWRITE=${config_UserChoices_JobName}_${factor}y ;
68            R_OUT_OCE_NWRITE=${R_OUT_OCE_O_Y} ;
69            R_OUT_ICE_NWRITE=${R_OUT_ICE_O_Y} ;
70            WF1=${factor}Y ;;
71        1M|1m)
72            (( ORCA_NWRITE = ORCA_NPDT_JOUR * factor * $( IGCM_date_DaysInMonth ${year} ${month} ) )) ;
73            PREFIX_NWRITE=${config_UserChoices_JobName}_${factor}m ;
74            R_OUT_OCE_NWRITE=${R_OUT_OCE_O_M} ;
75            R_OUT_ICE_NWRITE=${R_OUT_ICE_O_M} ;
76            WF1=${factor}M ;;
77        *D|*d)
78            (( ORCA_NWRITE = ORCA_NPDT_JOUR * factor  ))  ;
79            PREFIX_NWRITE=${config_UserChoices_JobName}_${factor}d ;
80            R_OUT_OCE_NWRITE=${R_OUT_OCE_O_D} ;
81            R_OUT_ICE_NWRITE=${R_OUT_ICE_O_D} ;
82            WF1=${factor}D ;;
83        *)
84            (( ORCA_NWRITE = 0 ))                                                            ;;
85    esac
86
87    ##--Write Frequency Purpose .... concerning the second opa file type.
88    if [ ${NbFreq} -eq 2 ] ; then
89        frequency=$( echo ${config_OCE_WriteFrequency} | awk "-F " '{print $2}' )
90        factor=$( echo ${frequency} | sed -e "s/[yYmMdD]//" )
91        case ${frequency} in
92            *Y|*y)
93                (( ORCA_NWRIHF = ORCA_NPDT_JOUR * factor * $( IGCM_date_DaysInYear  ${year} ) ))          ;
94                PREFIX_NWRIHF=${config_UserChoices_JobName}_${factor}y ;
95                R_OUT_OCE_NWRIHF=${R_OUT_OCE_O_Y} ;
96                WF2=${factor}Y ;;
97            *M|*m)
98                (( ORCA_NWRIHF = ORCA_NPDT_JOUR * factor * $( IGCM_date_DaysInMonth ${year} ${month} ) )) ;
99                PREFIX_NWRIHF=${config_UserChoices_JobName}_${factor}m ;
100                R_OUT_OCE_NWRIHF=${R_OUT_OCE_O_M} ;
101                WF2=${factor}M ;;
102            *D|*d)
103                (( ORCA_NWRIHF = ORCA_NPDT_JOUR * factor ))  ;
104                PREFIX_NWRIHF=${config_UserChoices_JobName}_${factor}d ;
105                R_OUT_OCE_NWRIHF=${R_OUT_OCE_O_D} ;
106                WF2=${factor}D ;;
107            *)
108                (( ORCA_NWRIHF = 0 ))                                                            ;;
109        esac
110    else
111        ORCA_NWRIHF=0
112    fi
113
114    # Period Length In Days between DateBegin and first day of calendar 0001 01 01
115    # Needed by OPA namelist to compute correct file names
116    (( PeriodDaysSinceJC =  $( IGCM_date_DaysSinceJC ${PeriodDateBegin} ) + 1  ))
117
118    ##-- Number of time steps updated : the first, the last and the number of time steps
119    (( ORCA_NIT000 = ( PeriodDaysSinceJC - DaysSinceJC ) * ORCA_NPDT_JOUR + 1 ))
120    (( ORCA_NPDT   = PeriodLengthInDays * ORCA_NPDT_JOUR ))
121    (( ORCA_NITEND = ORCA_NIT000 + ORCA_NPDT - 1))
122
123    ##-- We force one restart file at the end of the trunk
124    ORCA_NSTOCK="${ORCA_NITEND}"
125
126    ##-- Let verify the number of time steps per day
127    (( NB_SEC_JOUR_MODEL = ORCA_NPDT_JOUR * ORCA_RDT ))
128    (( NB_SEC_JOUR = 60 * 60 * 24 ))
129
130    if [ ${NB_SEC_JOUR_MODEL} -ne ${NB_SEC_JOUR} ]
131        then
132        echo " VERIFY ORCA_NPDT_JOUR in opa9.card "
133        exit
134    fi
135
136    ##-- Restart configuration
137    if ( [ "${CumulPeriod}" -eq 1 ] && [ "${config_OCE_Restart}" = "n" ] ) ; then
138
139        ORCA_LRSTAR=.FALSE.
140        ORCA_NRSTDT=0
141        # Put ORCA_NMSH=0 when OPA running in parallel mode
142        ORCA_NMSH=1
143
144        #echo "NO OPA RESTART"
145    elif ( [ "${CumulPeriod}" -eq 1 ] && [ "${config_OCE_Restart}" = "y" ] ) ; then
146
147        ORCA_LRSTAR=.TRUE.
148        ORCA_NRSTDT=0
149        ORCA_NMSH=0
150
151        #echo "OPA RESTART"
152    else
153
154        ORCA_LRSTAR=.TRUE.
155        ORCA_NRSTDT=2
156        ORCA_NMSH=0
157
158        #echo "OPA RESTART"
159    fi
160
161
162    # nleapy configuration
163    case ${config_UserChoices_CalendarType} in
164         leap)
165         ORCA_NLEAPY=1;;
166         noleap)
167         ORCA_NLEAPY=0;;
168         360d)
169         ORCA_NLEAPY=30;;
170         *)
171         ORCA_NLEAPY=30
172    esac
173
174
175    typeset -r PRECIS=8
176    NEMO_END=$( echo $( awk "BEGIN { printf \"%0${PRECIS}d\",${ORCA_NITEND} }" ) ) 
177
178
179    sed -e "s/${PAT_CEXPER}/       cexper=\"${config_UserChoices_JobName}\"/" \
180        -e "s/${PAT_NIT000}/       nit000=${ORCA_NIT000}/"                    \
181        -e "s/${PAT_NITEND}/       nitend=${ORCA_NITEND}/"                    \
182        -e "s/${PAT_NWRITE}/       nwrite=${ORCA_NWRITE}/"                    \
183        -e "s/${PAT_RESTAR}/       ln_rstart=${ORCA_LRSTAR}/"                 \
184        -e "s/${PAT_NPRG}/         nprg=${ORCA_NWRITE}/"                      \
185        -e "s/${PAT_NF_PTR}/       nf_ptr_wri=${ORCA_NWRITE}/"                \
186        -e "s/${PAT_NSTOCK}/       nstock=${ORCA_NSTOCK}/"                    \
187        -e "s/${PAT_NRSTAR}/       nrstdt=${ORCA_NRSTDT}/"                    \
188        -e "s/${PAT_NDATE0}/       ndate0=${PeriodDateBegin}/"                \
189        -e "s%${PAT_NLEAPY}%       nleapy=${ORCA_NLEAPY}%"                    \
190        -e "s/${PAT_NMSH}/         nmsh=${ORCA_NMSH}/"                        \
191        namelist > namelist.tmp
192
193    IGCM_sys_Mv namelist.tmp namelist
194
195    echo 'Variables automatically updated in ORCA namelist'
196    grep AUTO namelist
197
198    IGCM_debug_PopStack "OCE_Update"
199}
200
201#-----------------------------------
202function OCE_Finalize
203{
204    IGCM_debug_PushStack "OCE_Finalize"
205
206    if [ -f date.file ] ; then
207        # Prefix use in opa9.card AND in lim2.card :
208        DATE_OPA=$( cat date.file | \
209            sed "s/\ ${config_UserChoices_JobName}_[0-9]*[a-z]_\([0-9]*_[0-9]*\)_\ */\1/g" )
210        MainPrefix=${config_UserChoices_JobName}_1d_${DATE_OPA}
211        SecondPrefix=${config_UserChoices_JobName}_5d_${DATE_OPA}
212    fi
213
214    echo FINALIZE OCE !!!
215
216    IGCM_debug_PopStack "OCE_Finalize"
217}
Note: See TracBrowser for help on using the repository browser.