source: CONFIG/UNIFORM/v6_rc0/IPSLCM6/GENERAL/DRIVER/pisces.driver @ 2566

Last change on this file since 2566 was 2566, checked in by sdipsl, 9 years ago
  • Reference or actions related to IOIPSL output management has been removed
  • XIOS is used by default
  • Use a low level of output by default
  • Add missing variables related to monitoring01*cfg files (sohtc300, tro3, solaire, co2_ppm, CH4_ppb, N2O_ppb, CFC11_ppt, CFC12_ppt)
  • Remove dbio_T from pisces.card and pisces.driver
  • Waiting for file_def_histhf3h_lmdz.xml and file_def_histhf3hm_lmdz.xml integration in LMDZ/DefLists
  • Still need to homogenize OUTPUT_LEVEL like option in comp.card
  • Will be propagate to sister v6_rc0 confiurations when fully completed
  • Has been tested
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    PAT_PIS_LRIVER=$( supergrep ln_river          ${NAMELIST_PISCES_CFG} )
33
34    IGCM_debug_PopStack "MBG_Initialize"
35}
36
37#-----------------------------------
38function MBG_Update
39{
40    IGCM_debug_PushStack "MBG_Update"
41
42    ##-- Restart configuration
43    if ( [ "${CumulPeriod}" -eq 1 ] && [ "${config_MBG_Restart}" = "n" ] ) ; then
44
45        #echo "NO RESTART FOR TOP"
46        TOP_LRSTTR=.FALSE.
47        TOP_NRSTTR=0
48
49        PISCES_LRIVER=.FALSE.
50
51    elif ( [ "${CumulPeriod}" -eq 1 ] && [ "${config_MBG_Restart}" = "y" ] ) ; then
52
53        #echo "RESTART TOP"
54        TOP_LRSTTR=.TRUE.
55        TOP_NRSTTR=0
56
57        PISCES_LRIVER=.TRUE.
58
59        # If we start from IPSLCM5* restart files.
60        for file in restart_trc*.nc ; do
61            ncrename -v TRBDSi,TRBGSi -v TRNDSi,TRNGSi -v TRNBSi,TRNDSi -v TRBBSi,TRBDSi ${file} > /dev/null 2>&1
62        done
63
64    else
65
66        #echo "RESTART TOP"
67        TOP_LRSTTR=.TRUE.
68        TOP_NRSTTR=2
69
70        PISCES_LRIVER=.FALSE.
71
72    fi
73
74    ##-- CO2 forcing : update atcco2 value in namelist_pisces_cfg
75    if [ "${pisces_UserChoices_CARBON_CYCLE}" = "y" ]; then
76        # Special case for carbon cycle
77        # Activate this case by putting CARBON_CYCLE=y in pisces.card section UserChoices
78        echo 'Update atcco2 in namelist_pisces_cfg with value from file co2.log'
79        PathCO2log=${SUBMIT_DIR}
80        PreviousLinelog=$( tail -1 ${PathCO2log}/co2.log )
81        IPCC_PIS_CO2=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' )
82        sed -e "s%${PAT_PIS_ATCCO2}%          atcco2=${IPCC_PIS_CO2}%"             \
83            namelist_pisces_cfg > namelist_pisces_cfg.tmp
84        IGCM_sys_Mv namelist_pisces_cfg.tmp namelist_pisces_cfg
85    else
86        # Take same CO2 as for LMDZ, in parameter file config.def.
87        # ATM_Update is done before MBG_Update and therefor config.def file contains the correct value for CO2.
88        echo 'Update atcco2 in namelist_pisces_cfg with same value as for LMDZ'
89        LMDZ_CO2=$( lmdzgrep co2_ppm config.def )
90        sed -e "s%${PAT_PIS_ATCCO2}%          atcco2=${LMDZ_CO2}%"             \
91            namelist_pisces_cfg > namelist_pisces_cfg.tmp
92        IGCM_sys_Mv namelist_pisces_cfg.tmp namelist_pisces_cfg
93    fi
94
95    ##-- Update namelist_top_cfg and namelist_pisces_cfg
96
97    sed -e "s%${PAT_TOP_LRSTTR}%          ln_rsttr=${TOP_LRSTTR}%"                   \
98        -e "s%${PAT_TOP_NRSTTR}%          nn_rsttr=${TOP_NRSTTR}%"                   \
99        namelist_top_cfg > namelist_top_cfg.tmp
100
101    IGCM_sys_Mv namelist_top_cfg.tmp namelist_top_cfg
102
103    sed -e "s%${PAT_PIS_LRIVER}%          ln_river=${PISCES_LRIVER}%"                \
104        namelist_pisces_cfg > namelist_pisces_cfg.tmp
105
106    IGCM_sys_Mv namelist_pisces_cfg.tmp namelist_pisces_cfg
107
108
109    IGCM_debug_PopStack "MBG_Update"
110}
111
112#-----------------------------------
113function MBG_Finalize
114{
115    IGCM_debug_PushStack "MBG_Finalize"
116
117    echo FINALIZE MBG !!!
118
119    IGCM_debug_PopStack "MBG_Finalize"
120}
Note: See TracBrowser for help on using the repository browser.