source: CONFIG/UNIFORM/v6/IPSLCM5A2/GENERAL/DRIVER/pisces.driver @ 4873

Last change on this file since 4873 was 4873, checked in by acosce, 4 years ago

Add flag Reproducibility_after_restart in OPA to allow simulation to be identical even if we make a restart during the simulation

File size: 3.6 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
[4873]29    ##-- Restart configuration
30    if ( [ "${opa9_UserChoices_Reproducibility_after_restart}" = "y" ] ) ; then
31        TOP_LN_RSTR=.TRUE.
32        TOP_NN_RSTR=2
33        IGCM_debug_Print 1 'WARNING : dangerous option for NEMO pisces too'
34        IGCM_debug_Print 1 'Reproducibility_after_Restart forced : ' ${opa9_UserChoices_Reproducibility_after_restart}
35
36    elif ( [ "${CumulPeriod}" -eq 1 ] && [ "${config_MBG_Restart}" = "n" ] ) ; then
37
[925]38        #echo "NO RESTART FOR TOP"
[2863]39        TOP_LN_RSTR=.FALSE.
[2861]40        TOP_NN_RSTR=0
[925]41
42    elif ( [ "${CumulPeriod}" -eq 1 ] && [ "${config_MBG_Restart}" = "y" ] ) ; then
43
44        #echo "RESTART TOP"
[2863]45        TOP_LN_RSTR=.TRUE.
[2861]46        TOP_NN_RSTR=0
[925]47
[2206]48        # If we start from IPSLCM5* restart files.
49        for file in restart_trc*.nc ; do
50            ncrename -v TRBDSi,TRBGSi -v TRNDSi,TRNGSi -v TRNBSi,TRNDSi -v TRBBSi,TRBDSi ${file} > /dev/null 2>&1
51        done
52
[925]53    else
54
55        #echo "RESTART TOP"
[2863]56        TOP_LN_RSTR=.TRUE.
[2861]57        TOP_NN_RSTR=2
[925]58
59    fi
60
[1437]61    ##-- Enable dbio output file
62    DBIO_ENABLE=".FALSE." 
63    eval pisces_DBIO_ENABLE=\${pisces_UserChoices_DBIO_ENABLE} > /dev/null 2>&1
64    if [ "${pisces_DBIO_ENABLE}" = "y" ]; then
65        DBIO_ENABLE=".TRUE."
66    fi
67
68    # update iodef.xml
69
[2753]70    IGCM_debug_Print 1 " 'Informations into iodef.xml : DBIO_ENABLE : ${DBIO_ENABLE}"
[1437]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
[2198]77    ##-- CO2 forcing : update atcco2 value in namelist_pisces_cfg
[1775]78    if [ "${pisces_UserChoices_CARBON_CYCLE}" = "y" ]; then
[2753]79        IGCM_debug_Print 1 "Special case for carbon cycle"
[1535]80        # Activate this case by putting CARBON_CYCLE=y in pisces.card section UserChoices
[2753]81        IGCM_debug_Print 1  'Update atcco2 in namelist_pisces_cfg with value from file co2.log'
[1535]82        PathCO2log=${SUBMIT_DIR}
83        PreviousLinelog=$( tail -1 ${PathCO2log}/co2.log )
84        IPCC_PIS_CO2=$( echo "${PreviousLinelog[*]}" | gawk -F '|' '{gsub(" ",""); print $4}' )
[2753]85        IGCM_debug_Print 1 "IPCC_PIS_CO2 : ${IPCC_PIS_CO2} "
[2861]86        IGCM_comp_modifyNamelist force  namelist_pisces_cfg atcco2 ${IPCC_PIS_CO2}
[1550]87    else
[2753]88        IGCM_debug_Print 1 "Take same CO2 as for LMDZ, in parameter file config.def."
[2861]89        # ATM_Update is done before MBG_Update and therefore config.def file contains the correct value for CO2.
[2753]90        IGCM_debug_Print 1 'Update atcco2 in namelist_pisces_cfg with same value as for LMDZ'
91        LMDZ_CO2=$( lmdzgrep2 co2_ppm config.def )
92        IGCM_debug_Print 1 "LMDZ_CO2 : ${LMDZ_CO2} "
[2861]93        IGCM_comp_modifyNamelist force  namelist_pisces_cfg atcco2 ${LMDZ_CO2}
[1535]94    fi
95
[2198]96    ##-- Update namelist_top_cfg and namelist_pisces_cfg
[2863]97    IGCM_comp_modifyNamelist blocker  namelist_top_cfg     ln_rsttr   ${TOP_LN_RSTR}
[2861]98    IGCM_comp_modifyNamelist blocker  namelist_top_cfg     nn_rsttr   ${TOP_NN_RSTR}
99    IGCM_comp_modifyNamelist blocker  namelist_pisces_cfg  nn_pisdmp  ${OPA_NPDT_YEAR}
100   
101    IGCM_debug_PopStack "MBG_Update"
[925]102}
103
104#-----------------------------------
105function MBG_Finalize
106{
107    IGCM_debug_PushStack "MBG_Finalize"
108
109    echo FINALIZE MBG !!!
110
111    IGCM_debug_PopStack "MBG_Finalize"
112}
113
Note: See TracBrowser for help on using the repository browser.