source: CONFIG/IPSLCM/IPSLCM5A/Chistorical/COMP/pisces.driver @ 1316

Last change on this file since 1316 was 1316, checked in by cetlod, 13 years ago

Improvment of interactive scripts for IPSLCM5A_C configuration

File size: 2.5 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
14    ##--Variables used by MBG --
15
16    # ln_rsttr  boolean term for tracer model restart (true or false)
17    # nrsttr    control of the time step (0, 1 or 2)
18   
19    ##--Variables used by PISCES --
20 
21    PAT_TOP_LRSTTR=$( supergrep ln_rsttr          ${SUBMIT_DIR}/PARAM/namelist_top_${RESOL_OCE} )
22    PAT_TOP_NRSTTR=$( supergrep nrsttr            ${SUBMIT_DIR}/PARAM/namelist_top_${RESOL_OCE} )
23    PAT_PIS_ATCCO2=$( supergrep atcco2            ${SUBMIT_DIR}/PARAM/namelist_pisces_${RESOL_OCE} )
24    PAT_PIS_LRIVER=$( supergrep ln_river          ${SUBMIT_DIR}/PARAM/namelist_pisces_${RESOL_OCE} )
25
26    IGCM_debug_PopStack "MBG_Initialize"
27}
28
29#-----------------------------------
30function MBG_Update
31{
32    IGCM_debug_PushStack "MBG_Update"
33
34    ##-- Restart configuration
35    if ( [ "${CumulPeriod}" -eq 1 ] && [ "${config_MBG_Restart}" = "n" ] ) ; then
36
37        #echo "NO RESTART FOR TOP"
38        TOP_LRSTTR=.FALSE.
39        TOP_NRSTTR=0
40
41        PISCES_LRIVER=.FALSE.
42
43    elif ( [ "${CumulPeriod}" -eq 1 ] && [ "${config_MBG_Restart}" = "y" ] ) ; then
44
45        #echo "RESTART TOP"
46        TOP_LRSTTR=.TRUE.
47        TOP_NRSTTR=0
48
49        PISCES_LRIVER=.TRUE.
50
51    else
52
53        #echo "RESTART TOP"
54        TOP_LRSTTR=.TRUE.
55        TOP_NRSTTR=2
56
57        PISCES_LRIVER=.TRUE.
58
59    fi
60
61    ##-- GHG forcing for the current year. Normally constant
62    PathCO2log=${SUBMIT_DIR}
63    PreviousLinelog=$( tail -1 ${PathCO2log}/co2.log )
64    IPCC_PIS_CO2=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' )
65
66    ##-- Update namelist_top and namelist_pisces
67
68    sed -e "s%${PAT_TOP_LRSTTR}%          ln_rsttr=${TOP_LRSTTR}%"                   \
69        -e "s%${PAT_TOP_NRSTTR}%          nrsttr=${TOP_NRSTTR}%"                   \
70        namelist_top > namelist_top.tmp
71
72    IGCM_sys_Mv namelist_top.tmp namelist_top
73
74    sed -e "s%${PAT_PIS_ATCCO2}%          atcco2=${IPCC_PIS_CO2}%"                \
75        -e "s%${PAT_PIS_LRIVER}%          ln_river=${PISCES_LRIVER}%"                \
76        namelist_pisces > namelist_pisces.tmp
77
78    IGCM_sys_Mv namelist_pisces.tmp  namelist_pisces
79
80
81    IGCM_debug_PopStack "MBG_Update"
82}
83
84#-----------------------------------
85function MBG_Finalize
86{
87    IGCM_debug_PushStack "MBG_Finalize"
88
89    echo FINALIZE MBG !!!
90
91    IGCM_debug_PopStack "MBG_Finalize"
92}
93
Note: See TracBrowser for help on using the repository browser.