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