source: CONFIG/IPSLCM/IPSLCM5/branches/IPSLCM5_v3/EXP00/COMP/pisces.driver.noiomput @ 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.9 KB
Line 
1#!/bin/ksh
2
3#-----------------------------------
4function TOP_Initialize
5{ 
6    IGCM_debug_PushStack "TOP_Initialize"
7
8    ##--Variables used by TOP --
9
10    # nwritetrc frequency of write in the tracer output file
11    # lrsttr    boolean term for tracer model restart (true or false)
12    # nrsttr    control of the time step (0, 1 or 2)
13    # ntrd_trc   time step frequency of write in the trends file for tracers
14    # ln_trdmld_trc_restart boolean term for trc trends restart (true or false)
15   
16    ##--Variables used by PISCES --
17 
18    # nwritedia frequency of write in the additional diag output file
19
20# Local function to find namelists parameters
21supergrep () {
22    grep "^ *$1 *=" $2 | sed -e "s% *\!.*%%"
23}
24
25    PAT_TOP_NWRITETRC=$( supergrep nwritetrc             ${SUBMIT_DIR}/PARAM/namelist_top_${RESOL_OCE} )
26    PAT_TOP_LRSTTR=$( supergrep ln_rsttr                   ${SUBMIT_DIR}/PARAM/namelist_top_${RESOL_OCE} )
27    PAT_TOP_NRSTTR=$( supergrep nrsttr                   ${SUBMIT_DIR}/PARAM/namelist_top_${RESOL_OCE} )
28    PAT_TOP_NWRITETRD=$( supergrep ntrd_trc              ${SUBMIT_DIR}/PARAM/namelist_top_${RESOL_OCE} )
29    PAT_TOP_RSTRTTRD=$( supergrep ln_trdmld_trc_restart  ${SUBMIT_DIR}/PARAM/namelist_top_${RESOL_OCE} )
30
31    PAT_PIS_NWRITEDIA=$( supergrep nwritedia             ${SUBMIT_DIR}/PARAM/namelist_pisces_${RESOL_OCE} )
32
33    IGCM_debug_PopStack "TOP_Initialize"
34}
35
36#-----------------------------------
37function TOP_Update
38{
39    IGCM_debug_PushStack "TOP_Update"
40
41    ##--Write Frequency Purpose ....
42    topfrequency=$( echo ${config_TOP_WriteFrequency} | awk "-F " '{print $1}' )
43    topfactor=$( echo ${topfrequency} | sed -e "s/[yYmMdD]//" )
44    case ${topfrequency} in
45        1Y|1y)
46            (( TOP_NWRITE = ORCA_NPDT_JOUR * topfactor * $( IGCM_date_DaysInYear  ${year} ) ))          ;
47            PREFIX_NWRITETRC=${config_UserChoices_JobName}_${topfactor}y ;
48            R_OUT_TOP_NWRITE=${R_OUT_TOP_O_Y} ;
49            WFT1=${topfactor}Y ;;
50        1M|1m)
51            (( TOP_NWRITE = ORCA_NPDT_JOUR * topfactor * $( IGCM_date_DaysInMonth  ${year} ${month} ) ))          ;
52            PREFIX_NWRITETRC=${config_UserChoices_JobName}_${topfactor}m ;
53            R_OUT_TOP_NWRITE=${R_OUT_TOP_O_M} ;
54            WFT1=${topfactor}M ;;
55        *D|*d)
56            (( TOP_NWRITE = ORCA_NPDT_JOUR * topfactor  ))          ;
57            PREFIX_NWRITETRC=${config_UserChoices_JobName}_${topfactor}d ;
58            R_OUT_TOP_NWRITE=${R_OUT_TOP_O_D} ;
59            WFT1=${topfactor}D ;;
60        *)
61    esac
62
63    ##-- Restart configuration
64    if ( [ "${CumulPeriod}" -eq 1 ] && [ "${config_TOP_Restart}" = "n" ] ) ; then
65
66        #echo "NO RESTART FOR TOP"
67        TOP_LRSTTR=.FALSE.
68        TOP_NRSTTR=0
69
70    elif ( [ "${CumulPeriod}" -eq 1 ] && [ "${config_TOP_Restart}" = "y" ] ) ; then
71
72        #echo "RESTART TOP"
73        TOP_LRSTTR=.TRUE.
74        TOP_NRSTTR=0
75
76    else
77
78        #echo "RESTART TOP"
79        TOP_LRSTTR=.TRUE.
80        TOP_NRSTTR=2
81    fi
82
83    sed -e "s%${PAT_TOP_NWRITETRC}%       nwritetrc=${TOP_NWRITE}%"               \
84        -e "s%${PAT_TOP_NWRITETRD}%       ntrd_trc=${TOP_NWRITE}%"                \
85        -e "s%${PAT_TOP_LRSTTR}%          ln_rsttr=${TOP_LRSTTR}%"                   \
86        -e "s%${PAT_TOP_NRSTTR}%          nrsttr=${TOP_NRSTTR}%"                   \
87        namelist_top > namelist_top.tmp
88
89    IGCM_sys_Mv namelist_top.tmp namelist_top
90
91# on force les sorties PISCES comme les sorties OPA
92
93    sed -e "s%${PAT_PIS_NWRITEDIA}%       nwritedia=${TOP_NWRITE}%"              \
94        namelist_pisces > namelist_pisces.tmp
95
96    IGCM_sys_Mv namelist_pisces.tmp namelist_pisces
97
98    echo 'Variables automatically updated in namelists'
99    grep AUTO namelist*
100
101    IGCM_debug_PopStack "TOP_Update"
102}
103
104#-----------------------------------
105function TOP_Finalize
106{
107    IGCM_debug_PushStack "TOP_Finalize"
108
109    echo FINALIZE TOP !!!
110
111    IGCM_debug_PopStack "TOP_Finalize"
112}
113
Note: See TracBrowser for help on using the repository browser.