source: CONFIG/IPSLCM/IPSLCM5-2/EXP00/COMP/pisces.driver @ 1539

Last change on this file since 1539 was 1535, checked in by jgipsl, 13 years ago

Modifications in working configuration :

Modifications in lmdz.card and lmdz.driver

  • GHG forcing files should now be copied in files with standard names such as CO2.txt, CH4.txt, N2O.txt, CFC11.txt and CFC12.txt. Now the

lmdz.driver will update the GHG parameters in physiq.def as soon as one
of theses files are added in lmdz.card.

  • removed CO2_1765_2005.txt from Chistorical/COMP/lmdz.card, the file is not used in this experience

Modifications in pisces.driver and pisces.card

  • add option CARBON_CYCLE=y to be set in pisces.card section UserChoices? for experience Chistorical and CpiControl?. With this option, co2 will

be read from co2.log file as before.

  • modified pisces.driver to read co2 from file CO2.txt if existing. As done in lmdz.driver
  • all pisces.driver are now the same
File size: 3.7 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    ##-- Restart configuration
34    if ( [ "${CumulPeriod}" -eq 1 ] && [ "${config_MBG_Restart}" = "n" ] ) ; then
35
36        #echo "NO RESTART FOR TOP"
37        TOP_LRSTTR=.FALSE.
38        TOP_NRSTTR=0
39
40        PISCES_LRIVER=.FALSE.
41
42    elif ( [ "${CumulPeriod}" -eq 1 ] && [ "${config_MBG_Restart}" = "y" ] ) ; then
43
44        #echo "RESTART TOP"
45        TOP_LRSTTR=.TRUE.
46        TOP_NRSTTR=0
47
48        PISCES_LRIVER=.TRUE.
49
50    else
51
52        #echo "RESTART TOP"
53        TOP_LRSTTR=.TRUE.
54        TOP_NRSTTR=2
55
56        PISCES_LRIVER=.TRUE.
57
58    fi
59
60    ##-- Enable dbio output file
61    DBIO_ENABLE=".FALSE." 
62    eval pisces_DBIO_ENABLE=\${pisces_UserChoices_DBIO_ENABLE} > /dev/null 2>&1
63    if [ "${pisces_DBIO_ENABLE}" = "y" ]; then
64        DBIO_ENABLE=".TRUE."
65    fi
66
67    # update iodef.xml
68
69    echo 'Informations into iodef.xml : DBIO_ENABLE'
70    echo ${DBIO_ENABLE}
71
72    sed -e "s/<DBIO_ENABLE>/${DBIO_ENABLE}/" \
73        iodef.xml > iodef.xml.tmp
74
75    IGCM_sys_Mv iodef.xml.tmp iodef.xml
76
77    ##-- CO2 forcing : update atcco2 value in namelist_pisces for some cases
78    if [ "${piseces_UserChoices_CARBON_CYCLE}" = "y" ]; then
79        # Special case for carbon cycle
80        # Activate this case by putting CARBON_CYCLE=y in pisces.card section UserChoices
81        echo 'Update atcco2 in namelist_pisces with value from file co2.log'
82        PathCO2log=${SUBMIT_DIR}
83        PreviousLinelog=$( tail -1 ${PathCO2log}/co2.log )
84        IPCC_PIS_CO2=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' )
85        sed -e "s%${PAT_PIS_ATCCO2}%          atcco2=${IPCC_PIS_CO2}%"             \
86            namelist_pisces > namelist_pisces.tmp
87        IGCM_sys_Mv namelist_pisces.tmp namelist_pisces
88    elif [ -f CO2.txt ] ; then
89        # This case is activated if the file CO2.txt is found in run directory, add file in BoundaryFiles in pisces.card or lmdz.card
90        echo 'Update atcco2 in namelist_pisces with annual value from file CO2.txt'
91        IPCC_PIS_CO2=`grep Annee_${year} CO2.txt | awk -F= '{print $2}'`
92        sed -e "s%${PAT_PIS_ATCCO2}%          atcco2=${IPCC_PIS_CO2}%"             \
93            namelist_pisces > namelist_pisces.tmp
94        IGCM_sys_Mv namelist_pisces.tmp namelist_pisces
95    fi
96
97    ##-- Update namelist_top and namelist_pisces
98
99    sed -e "s%${PAT_TOP_LRSTTR}%          ln_rsttr=${TOP_LRSTTR}%"                   \
100        -e "s%${PAT_TOP_NRSTTR}%          nrsttr=${TOP_NRSTTR}%"                   \
101        namelist_top > namelist_top.tmp
102
103    IGCM_sys_Mv namelist_top.tmp namelist_top
104
105    sed -e "s%${PAT_PIS_LRIVER}%          ln_river=${PISCES_LRIVER}%"                \
106        namelist_pisces > namelist_pisces.tmp
107
108    IGCM_sys_Mv namelist_pisces.tmp namelist_pisces
109
110
111    IGCM_debug_PopStack "MBG_Update"
112}
113
114#-----------------------------------
115function MBG_Finalize
116{
117    IGCM_debug_PushStack "MBG_Finalize"
118
119    echo FINALIZE MBG !!!
120
121    IGCM_debug_PopStack "MBG_Finalize"
122}
123
Note: See TracBrowser for help on using the repository browser.