source: CONFIG/UNIFORM/v6/IPSLCM6/GENERAL/DRIVER/pisces.driver @ 2746

Last change on this file since 2746 was 2451, checked in by aclsce, 9 years ago

Modifications to use new NEMO revision in IPSLCM6_rc1 configuration.

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