source: CONFIG/IPSLCM/IPSLCM5/branches/IPSLCM5_v3/EXP00/COMP/pisces.driver @ 925

Last change on this file since 925 was 925, checked in by mafoipsl, 14 years ago

PC + MAF : first guess for IPSLCM5_v3 for config.card PARAM and COMP files.

File size: 3.1 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    ##--Variables used by OPA --
14
15
16    ##--Variables used by MBG --
17
18    # lrsttr    boolean term for tracer model restart (true or false)
19    # nrsttr    control of the time step (0, 1 or 2)
20   
21    ##--Variables used by PISCES --
22 
23    PAT_TOP_LRSTTR=$( supergrep ln_rsttr          ${SUBMIT_DIR}/PARAM/namelist_top_${RESOL_OCE} )
24    PAT_TOP_NRSTTR=$( supergrep nrsttr            ${SUBMIT_DIR}/PARAM/namelist_top_${RESOL_OCE} )
25    PAT_PIS_LRIVER=$( supergrep ln_river          ${SUBMIT_DIR}/PARAM/namelist_pisces_${RESOL_OCE} )
26
27    IGCM_debug_PopStack "MBG_Initialize"
28}
29
30#-----------------------------------
31function MBG_Update
32{
33    IGCM_debug_PushStack "MBG_Update"
34
35    ##--Write Frequency Purpose
36    Nbfreq=$( echo ${config_MBG_WriteFrequency} | wc -w )
37    typeset -Z1 i=1
38    while [ $i -le ${Nbfreq} ]; do
39       topfrequency=$( echo ${config_MBG_WriteFrequency} | awk -v var="$i" "-F " '{print $var}' )
40       topfactor=$( echo ${topfrequency} | sed -e "s/[yYmMdD]//" )
41       case ${topfrequency} in
42         *Y|*y)
43            eval PREFIX_WFT${i}=${config_UserChoices_JobName}_${topfactor}y_${DatesPeriod} ;
44            eval R_OUT_MBG_WFT${i}=${R_OUT_MBG_O_Y} ;
45            eval WFT${i}=${topfactor}Y ;;
46         *M|*m)
47            eval PREFIX_WFT${i}=${config_UserChoices_JobName}_${topfactor}m_${DatesPeriod} ;
48            eval R_OUT_MBG_WFT${i}=${R_OUT_MBG_O_M} ;
49            eval WFT${i}=${topfactor}M ;;
50         *D|*d)
51            eval PREFIX_WFT${i}=${config_UserChoices_JobName}_${topfactor}d_${DatesPeriod} ;
52            eval R_OUT_MBG_WFT${i}=${R_OUT_MBG_O_D} ;
53            eval WFT${i}=${topfactor}D ;;
54         *)
55      esac
56       let i=$i+1
57    done
58
59    ##-- Restart configuration
60    if ( [ "${CumulPeriod}" -eq 1 ] && [ "${config_MBG_Restart}" = "n" ] ) ; then
61
62        #echo "NO RESTART FOR TOP"
63        TOP_LRSTTR=.FALSE.
64        TOP_NRSTTR=0
65
66        PISCES_LRIVER=.FALSE.
67
68    elif ( [ "${CumulPeriod}" -eq 1 ] && [ "${config_MBG_Restart}" = "y" ] ) ; then
69
70        #echo "RESTART TOP"
71        TOP_LRSTTR=.TRUE.
72        TOP_NRSTTR=0
73
74        PISCES_LRIVER=.TRUE.
75
76    else
77
78        #echo "RESTART TOP"
79        TOP_LRSTTR=.TRUE.
80        TOP_NRSTTR=2
81
82        PISCES_LRIVER=.TRUE.
83
84    fi
85
86# on force les sorties PISCES comme les sorties OPA
87
88    sed -e "s%${PAT_TOP_LRSTTR}%          ln_rsttr=${TOP_LRSTTR}%"                   \
89        -e "s%${PAT_TOP_NRSTTR}%          nrsttr=${TOP_NRSTTR}%"                   \
90        namelist_top > namelist_top.tmp
91
92    IGCM_sys_Mv namelist_top.tmp namelist_top
93
94    sed -e "s%${PAT_PIS_LRIVER}%          ln_river=${PISCES_LRIVER}%"                \
95        namelist_pisces > namelist_pisces.tmp
96
97    IGCM_sys_Mv namelist_pisces.tmp namelist_pisces
98
99
100    IGCM_debug_PopStack "MBG_Update"
101}
102
103#-----------------------------------
104function MBG_Finalize
105{
106    IGCM_debug_PushStack "MBG_Finalize"
107
108    echo FINALIZE MBG !!!
109
110    IGCM_debug_PopStack "MBG_Finalize"
111}
112
Note: See TracBrowser for help on using the repository browser.