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
Line 
1#!/bin/ksh
2
3#-----------------------------------
4function MBG_Initialize
5{ 
6    IGCM_debug_PushStack "MBG_Initialize"
7
8    # Local function to find parameters in LMDZ .def files
9
10lmdzgrep2 () {
11     grep ${1} ${2} | grep -v "#"  | sed -e 's/=//g' -e 's/://g' -e 's/_AUTO_//' -e 's/DEFAULT//' | sed -e "s/${1}//" 
12}
13
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   
19    IGCM_debug_PopStack "MBG_Initialize"
20}
21
22#-----------------------------------
23function MBG_Update
24{
25    IGCM_debug_PushStack "MBG_Update"
26
27    ##-- Restart configuration
28
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
38        #echo "NO RESTART FOR TOP"
39        TOP_LN_RSTR=.FALSE.
40        TOP_NN_RSTR=0
41
42    elif ( [ "${CumulPeriod}" -eq 1 ] && [ "${config_MBG_Restart}" = "y" ] ) ; then
43
44        #echo "RESTART TOP"
45        TOP_LN_RSTR=.TRUE.
46        TOP_NN_RSTR=0
47
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
53    else
54
55        #echo "RESTART TOP"
56        TOP_LN_RSTR=.TRUE.
57        TOP_NN_RSTR=2
58
59    fi
60
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
70    IGCM_debug_Print 1 " 'Informations into iodef.xml : DBIO_ENABLE : ${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_cfg
78    if [ "${pisces_UserChoices_CARBON_CYCLE}" = "y" ]; then
79        IGCM_debug_Print 1 "Special case for carbon cycle"
80        # Activate this case by putting CARBON_CYCLE=y in pisces.card section UserChoices
81        IGCM_debug_Print 1  'Update atcco2 in namelist_pisces_cfg 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        IGCM_debug_Print 1 "IPCC_PIS_CO2 : ${IPCC_PIS_CO2} "
86        IGCM_comp_modifyNamelist force  namelist_pisces_cfg atcco2 ${IPCC_PIS_CO2}
87    else
88        IGCM_debug_Print 1 "Take same CO2 as for LMDZ, in parameter file config.def."
89        # ATM_Update is done before MBG_Update and therefore config.def file contains the correct value for CO2.
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} "
93        IGCM_comp_modifyNamelist force  namelist_pisces_cfg atcco2 ${LMDZ_CO2}
94    fi
95
96    ##-- Update namelist_top_cfg and namelist_pisces_cfg
97    IGCM_comp_modifyNamelist blocker  namelist_top_cfg     ln_rsttr   ${TOP_LN_RSTR}
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"
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.