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

Last change on this file since 1437 was 1437, checked in by aclsce, 13 years ago

Modifications to have the same iodef.xml for all IPSLCM5A
configurations : use of DBIO_ENABLE parameter defined in pisced.card
(false for EXP00, true for the others)

File size: 2.9 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    ##-- Enable dbio output file
62    DBIO_ENABLE=".FALSE." 
63    eval pisces_DBIO_ENABLE=\${pisces_UserChoices_DBIO_ENABLE} > /dev/null 2>&1
64    if [ "${pisces_DBIO_ENABLE}" = "y" ]; then
65        DBIO_ENABLE=".TRUE."
66    fi
67
68    # update iodef.xml
69
70    echo 'Informations into iodef.xml : DBIO_ENABLE'
71    echo ${DBIO_ENABLE}
72
73    sed -e "s/<DBIO_ENABLE>/${DBIO_ENABLE}/" \
74        iodef.xml > iodef.xml.tmp
75
76    IGCM_sys_Mv iodef.xml.tmp iodef.xml
77
78    ##-- GHG forcing for the current year. Normally constant
79    PathCO2log=${SUBMIT_DIR}
80    PreviousLinelog=$( tail -1 ${PathCO2log}/co2.log )
81    IPCC_PIS_CO2=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' )
82
83    ##-- Update namelist_top and namelist_pisces
84
85    sed -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    sed -e "s%${PAT_PIS_ATCCO2}%          atcco2=${IPCC_PIS_CO2}%"                \
92        -e "s%${PAT_PIS_LRIVER}%          ln_river=${PISCES_LRIVER}%"                \
93        namelist_pisces > namelist_pisces.tmp
94
95    IGCM_sys_Mv namelist_pisces.tmp  namelist_pisces
96
97
98    IGCM_debug_PopStack "MBG_Update"
99}
100
101#-----------------------------------
102function MBG_Finalize
103{
104    IGCM_debug_PushStack "MBG_Finalize"
105
106    echo FINALIZE MBG !!!
107
108    IGCM_debug_PopStack "MBG_Finalize"
109}
110
Note: See TracBrowser for help on using the repository browser.