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

Last change on this file since 3406 was 2880, checked in by aclsce, 8 years ago
  • Back to previous revision : problem fixed in libIGCM.
File size: 3.3 KB
RevLine 
[925]1#!/bin/ksh
2
3#-----------------------------------
4function MBG_Initialize
5{ 
6    IGCM_debug_PushStack "MBG_Initialize"
7
[2861]8    # Local function to find parameters in LMDZ .def files
[925]9
[2753]10lmdzgrep2 () {
11     grep ${1} ${2} | grep -v "#"  | sed -e 's/=//g' -e 's/://g' -e 's/_AUTO_//' -e 's/DEFAULT//' | sed -e "s/${1}//" 
[1785]12}
13
[2861]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   
[925]19    IGCM_debug_PopStack "MBG_Initialize"
20}
21
22#-----------------------------------
23function MBG_Update
24{
25    IGCM_debug_PushStack "MBG_Update"
26
27    ##-- Restart configuration
28    if ( [ "${CumulPeriod}" -eq 1 ] && [ "${config_MBG_Restart}" = "n" ] ) ; then
29
30        #echo "NO RESTART FOR TOP"
[2863]31        TOP_LN_RSTR=.FALSE.
[2861]32        TOP_NN_RSTR=0
[925]33
34    elif ( [ "${CumulPeriod}" -eq 1 ] && [ "${config_MBG_Restart}" = "y" ] ) ; then
35
36        #echo "RESTART TOP"
[2863]37        TOP_LN_RSTR=.TRUE.
[2861]38        TOP_NN_RSTR=0
[925]39
[2206]40        # If we start from IPSLCM5* restart files.
41        for file in restart_trc*.nc ; do
42            ncrename -v TRBDSi,TRBGSi -v TRNDSi,TRNGSi -v TRNBSi,TRNDSi -v TRBBSi,TRBDSi ${file} > /dev/null 2>&1
43        done
44
[925]45    else
46
47        #echo "RESTART TOP"
[2863]48        TOP_LN_RSTR=.TRUE.
[2861]49        TOP_NN_RSTR=2
[925]50
51    fi
52
[1437]53    ##-- Enable dbio output file
54    DBIO_ENABLE=".FALSE." 
55    eval pisces_DBIO_ENABLE=\${pisces_UserChoices_DBIO_ENABLE} > /dev/null 2>&1
56    if [ "${pisces_DBIO_ENABLE}" = "y" ]; then
57        DBIO_ENABLE=".TRUE."
58    fi
59
60    # update iodef.xml
61
[2753]62    IGCM_debug_Print 1 " 'Informations into iodef.xml : DBIO_ENABLE : ${DBIO_ENABLE}"
[1437]63
64    sed -e "s/<DBIO_ENABLE>/${DBIO_ENABLE}/" \
65        iodef.xml > iodef.xml.tmp
66
67    IGCM_sys_Mv iodef.xml.tmp iodef.xml
68
[2198]69    ##-- CO2 forcing : update atcco2 value in namelist_pisces_cfg
[1775]70    if [ "${pisces_UserChoices_CARBON_CYCLE}" = "y" ]; then
[2753]71        IGCM_debug_Print 1 "Special case for carbon cycle"
[1535]72        # Activate this case by putting CARBON_CYCLE=y in pisces.card section UserChoices
[2753]73        IGCM_debug_Print 1  'Update atcco2 in namelist_pisces_cfg with value from file co2.log'
[1535]74        PathCO2log=${SUBMIT_DIR}
75        PreviousLinelog=$( tail -1 ${PathCO2log}/co2.log )
76        IPCC_PIS_CO2=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' )
[2753]77        IGCM_debug_Print 1 "IPCC_PIS_CO2 : ${IPCC_PIS_CO2} "
[2861]78        IGCM_comp_modifyNamelist force  namelist_pisces_cfg atcco2 ${IPCC_PIS_CO2}
[1550]79    else
[2753]80        IGCM_debug_Print 1 "Take same CO2 as for LMDZ, in parameter file config.def."
[2861]81        # ATM_Update is done before MBG_Update and therefore config.def file contains the correct value for CO2.
[2753]82        IGCM_debug_Print 1 'Update atcco2 in namelist_pisces_cfg with same value as for LMDZ'
83        LMDZ_CO2=$( lmdzgrep2 co2_ppm config.def )
84        IGCM_debug_Print 1 "LMDZ_CO2 : ${LMDZ_CO2} "
[2861]85        IGCM_comp_modifyNamelist force  namelist_pisces_cfg atcco2 ${LMDZ_CO2}
[1535]86    fi
87
[2198]88    ##-- Update namelist_top_cfg and namelist_pisces_cfg
[2863]89    IGCM_comp_modifyNamelist blocker  namelist_top_cfg     ln_rsttr   ${TOP_LN_RSTR}
[2861]90    IGCM_comp_modifyNamelist blocker  namelist_top_cfg     nn_rsttr   ${TOP_NN_RSTR}
91    IGCM_comp_modifyNamelist blocker  namelist_pisces_cfg  nn_pisdmp  ${OPA_NPDT_YEAR}
92   
93    IGCM_debug_PopStack "MBG_Update"
[925]94}
95
96#-----------------------------------
97function MBG_Finalize
98{
99    IGCM_debug_PushStack "MBG_Finalize"
100
101    echo FINALIZE MBG !!!
102
103    IGCM_debug_PopStack "MBG_Finalize"
104}
105
Note: See TracBrowser for help on using the repository browser.