source: CONFIG/IPSLCM/IPSLCM5-2/EXPALL/DRIVER/pisces.driver @ 1550

Last change on this file since 1550 was 1550, checked in by jgipsl, 13 years ago
  • Added choice of config.def file : set ConfType?=preind/actuel/annuel in lmdz.card. The file config.def_$ConfType? will be used. The differences are :

preind : aer_type = preind, solar and GHG pre-industrial values, pmagic=0 (as piControl, CpiControl?)
actuel : aer_type = actuel, solar and GHG present values, pmagic=0.008 (as EXP00)
annuel : aer_type = annuel, solar and GHG must be updated with annual values from file, pmagic=0.008 (as historical,Chistorical)

  • For pisces, take same value for CO2 as for LMDZ except for CarbonCycle?=y (same treatment as before).

NB! I suppose that LMDZ ATM_Uptdate always is done before pisces MBG_Update.

  • Added choice of output.def file : set OutLev?=low(as EXP00)/medium(as piControl)/high(as histrical) in lmdz.card. The output are now the same as original IPSLCM5A for each experience.

=> In EXPALL, all 5 experiences correspond to original IPSLCM5A experiences, including possibility of new physics in LMDZ as IPSLCM5B and carbon cycle as IPSLCM5C. More testing is needed.

File size: 3.8 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 MBG --
14
15    # ln_rsttr  boolean term for tracer model restart (true or false)
16    # nrsttr    control of the time step (0, 1 or 2)
17   
18    ##--Variables used by PISCES --
19 
20    PAT_TOP_LRSTTR=$( supergrep ln_rsttr          ${SUBMIT_DIR}/PARAM/namelist_top_${RESOL_OCE} )
21    PAT_TOP_NRSTTR=$( supergrep nrsttr            ${SUBMIT_DIR}/PARAM/namelist_top_${RESOL_OCE} )
22    PAT_PIS_ATCCO2=$( supergrep atcco2            ${SUBMIT_DIR}/PARAM/namelist_pisces_${RESOL_OCE} )
23    PAT_PIS_LRIVER=$( supergrep ln_river          ${SUBMIT_DIR}/PARAM/namelist_pisces_${RESOL_OCE} )
24
25    IGCM_debug_PopStack "MBG_Initialize"
26}
27
28#-----------------------------------
29function MBG_Update
30{
31    IGCM_debug_PushStack "MBG_Update"
32
33    # Local function to find parameters in LMDZ .def files
34    lmdzgrep () {
35        grep $1 $2 |grep -v "#" | awk "-F=" '{print $2}'
36    }
37
38    ##-- Restart configuration
39    if ( [ "${CumulPeriod}" -eq 1 ] && [ "${config_MBG_Restart}" = "n" ] ) ; then
40
41        #echo "NO RESTART FOR TOP"
42        TOP_LRSTTR=.FALSE.
43        TOP_NRSTTR=0
44
45        PISCES_LRIVER=.FALSE.
46
47    elif ( [ "${CumulPeriod}" -eq 1 ] && [ "${config_MBG_Restart}" = "y" ] ) ; then
48
49        #echo "RESTART TOP"
50        TOP_LRSTTR=.TRUE.
51        TOP_NRSTTR=0
52
53        PISCES_LRIVER=.TRUE.
54
55    else
56
57        #echo "RESTART TOP"
58        TOP_LRSTTR=.TRUE.
59        TOP_NRSTTR=2
60
61        PISCES_LRIVER=.TRUE.
62
63    fi
64
65    ##-- Enable dbio output file
66    DBIO_ENABLE=".FALSE." 
67    eval pisces_DBIO_ENABLE=\${pisces_UserChoices_DBIO_ENABLE} > /dev/null 2>&1
68    if [ "${pisces_DBIO_ENABLE}" = "y" ]; then
69        DBIO_ENABLE=".TRUE."
70    fi
71
72    # update iodef.xml
73
74    echo 'Informations into iodef.xml : DBIO_ENABLE'
75    echo ${DBIO_ENABLE}
76
77    sed -e "s/<DBIO_ENABLE>/${DBIO_ENABLE}/" \
78        iodef.xml > iodef.xml.tmp
79
80    IGCM_sys_Mv iodef.xml.tmp iodef.xml
81
82    ##-- CO2 forcing : update atcco2 value in namelist_pisces
83    if [ "${piseces_UserChoices_CARBON_CYCLE}" = "y" ]; then
84        # Special case for carbon cycle
85        # Activate this case by putting CARBON_CYCLE=y in pisces.card section UserChoices
86        echo 'Update atcco2 in namelist_pisces with value from file co2.log'
87        PathCO2log=${SUBMIT_DIR}
88        PreviousLinelog=$( tail -1 ${PathCO2log}/co2.log )
89        IPCC_PIS_CO2=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' )
90        sed -e "s%${PAT_PIS_ATCCO2}%          atcco2=${IPCC_PIS_CO2}%"             \
91            namelist_pisces > namelist_pisces.tmp
92        IGCM_sys_Mv namelist_pisces.tmp namelist_pisces
93    else
94        # Take same CO2 as for LMDZ, in parameter file config.def.
95        # ATM_Update is done before MBG_Update and therefor config.def file contains the correct value for CO2.
96        echo 'Update atcco2 in namelist_pisces with same value as for LMDZ'
97        LMDZ_CO2=$( lmdzgrep co2_ppm config.def )
98        sed -e "s%${PAT_PIS_ATCCO2}%          atcco2=${LMDZ_CO2}%"             \
99            namelist_pisces > namelist_pisces.tmp
100        IGCM_sys_Mv namelist_pisces.tmp namelist_pisces
101    fi
102
103    ##-- Update namelist_top and namelist_pisces
104
105    sed -e "s%${PAT_TOP_LRSTTR}%          ln_rsttr=${TOP_LRSTTR}%"                   \
106        -e "s%${PAT_TOP_NRSTTR}%          nrsttr=${TOP_NRSTTR}%"                   \
107        namelist_top > namelist_top.tmp
108
109    IGCM_sys_Mv namelist_top.tmp namelist_top
110
111    sed -e "s%${PAT_PIS_LRIVER}%          ln_river=${PISCES_LRIVER}%"                \
112        namelist_pisces > namelist_pisces.tmp
113
114    IGCM_sys_Mv namelist_pisces.tmp namelist_pisces
115
116
117    IGCM_debug_PopStack "MBG_Update"
118}
119
120#-----------------------------------
121function MBG_Finalize
122{
123    IGCM_debug_PushStack "MBG_Finalize"
124
125    echo FINALIZE MBG !!!
126
127    IGCM_debug_PopStack "MBG_Finalize"
128}
129
Note: See TracBrowser for help on using the repository browser.