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

Last change on this file was 6443, checked in by cetlod, 12 months ago

merge useless IPSLCM6.5.1 into IPSLCM6.5 CONFIG & restructuration of PARAM sub-directory

File size: 6.8 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 -w ${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    ##--Write Frequency for iomput
28    ## Differents frequencies are allowed for MBG files
29
30    VT1D_ENABLE=".FALSE."
31    VT5D_ENABLE=".FALSE."
32    VT1M_ENABLE=".FALSE."
33    VT1Y_ENABLE=".FALSE."
34
35    for frequency in ${config_MBG_WriteFrequency} ; do
36        case ${frequency} in
37            ( 1D|1d ) VT1D_ENABLE=".TRUE." ;;
38            ( 5D|5d ) VT5D_ENABLE=".TRUE." ;;
39            ( 1M|1m ) VT1M_ENABLE=".TRUE." ;;
40            ( *[yY] ) VT1Y_ENABLE=".TRUE." ;;
41        esac
42    done
43
44    ##-- Restart configuration
45    ##-- Restart configuration
46    if ( [ "${opa9_UserChoices_Reproducibility_after_restart}" = "y" ] && [ "${config_MBG_Restart}" = "y" ] ) ; then
47        TOP_LRSTTR=.TRUE.
48        TOP_NRSTTR=2
49        IGCM_debug_Print 1 'WARNING : dangerous option for NEMO pisces too'
50        IGCM_debug_Print 1 'Reproducibility_after_Restart forced : ' ${opa9_UserChoices_Reproducibility_after_restart}
51
52    elif ( [ "${CumulPeriod}" -eq 1 ] && [ "${config_MBG_Restart}" = "n" ] ) ; then
53
54        #echo "NO RESTART FOR TOP"
55        TOP_LRSTTR=.FALSE.
56        TOP_NRSTTR=0
57
58    elif ( [ "${CumulPeriod}" -eq 1 ] && [ "${config_MBG_Restart}" = "y" ] ) ; then
59
60        #echo "RESTART TOP"
61        TOP_LRSTTR=.TRUE.
62        TOP_NRSTTR=0
63
64        # If we start from IPSLCM5* restart files.
65            for file in restart_trc*.nc ; do
66            IGCM_debug_Print 1 "cmd done to modify IPSLCM5* NEMO pisces restartfile: " ncrename -v TRBDSi,TRBGSi -v TRNDSi,TRNGSi -v TRNBSi,TRNDSi -v TRBBSi,TRBDSi ${file} > /dev/null 2>&1
67            ncrename -v TRBDSi,TRBGSi -v TRNDSi,TRNGSi -v TRNBSi,TRNDSi -v TRBBSi,TRBDSi ${file} > /dev/null 2>&1
68            done
69
70    else
71
72        #echo "RESTART TOP"
73        TOP_LRSTTR=.TRUE.
74        TOP_NRSTTR=2
75
76    fi
77
78    if [ X${pisces_UserChoices_AtmCo2} != X ] ; then
79       ##-- CO2 forcing : update atcco2 value in namelist_pisces_cfg with the value defined in pisces.card
80       IGCM_debug_Print 1 "the atmospheric CO2 is specfied in pisces.card"
81       ATM_CO2=${pisces_UserChoices_AtmCo2}
82    else
83      ##-- CO2 forcing : update atcco2 value in namelist_pisces_cfg with the same one used in LMDZ
84      IGCM_debug_Print 1 "Take same atpmospheric CO2 as for LMDZ, in parameter file config.def."
85      # ATM_Update is done before MBG_Update and therefore config.def file contains the correct value for CO2.
86      ATM_CO2=$( lmdzgrep2 co2_ppm config.def )
87    fi
88    IGCM_debug_Print 1 "Update atcco2 in namelist_pisces_cfg with value AtmCO2 : ${ATM_CO2}"
89    IGCM_comp_modifyNamelist force  namelist_pisces_cfg atcco2 ${ATM_CO2}
90   
91
92    if [ X${config_UserChoices_ConfigType} = XESMCO2 ] ; then
93        ##-- N2O forcing : update atcn2o value in namelist_pisces_cfg with the same one used in LMDZ
94        IGCM_debug_Print 1 "Take same N2O as for LMDZ, in parameter file config.def."
95        # ATM_Update is done before MBG_Update and therefore config.def file contains the correct value for N2O
96        IGCM_debug_Print 1 'Update atcn2o in namelist_pisces_cfg with same value as for LMDZ'
97        LMDZ_N2O=$( lmdzgrep2 N2O_ppb config.def )
98        IGCM_debug_Print 1 "LMDZ_N2O : ${LMDZ_N2O} "
99        IGCM_comp_modifyNamelist force  namelist_pisces_cfg atcn2o ${LMDZ_N2O}
100    fi
101
102   if [ X"${pisces_UserChoices_age}" = X"y" ] ; then
103      echo "Activate age tracer"
104      TOP_AGE=.TRUE.
105      IGCM_comp_modifyXmlFile force file_def_nemo-pisces.xml file38 enabled .TRUE.
106   else
107      TOP_AGE=.FALSE.
108      IGCM_comp_modifyXmlFile force file_def_nemo-pisces.xml file38 enabled .FALSE.
109   fi
110##
111   if [ X"${pisces_UserChoices_cfc11}" = X"y" ] ; then
112      echo "Activate CFC11  tracer"
113      TOP_CFC11=.TRUE.
114      IGCM_comp_modifyXmlFile force file_def_nemo-pisces.xml file39 enabled .FALSE.
115   else
116      TOP_CFC11=.FALSE.
117      IGCM_comp_modifyXmlFile force file_def_nemo-pisces.xml file39 enabled .FALSE.
118   fi
119##
120   if [ X"${pisces_UserChoices_cfc12}" = X"y" ] ; then
121      echo "Activate CFC12  tracer"
122      TOP_CFC12=.TRUE.
123      IGCM_comp_modifyXmlFile force file_def_nemo-pisces.xml file40 enabled .TRUE.
124   else
125      TOP_CFC12=.FALSE.
126      IGCM_comp_modifyXmlFile force file_def_nemo-pisces.xml file40 enabled .FALSE.
127   fi
128##
129   ##-- Update namelist_top_cfg and namelist_pisces_cfg
130    IGCM_comp_modifyNamelist blocker    namelist_top_cfg     ln_rsttr  ${TOP_LRSTTR}
131    IGCM_comp_modifyNamelist blocker    namelist_top_cfg     nn_rsttr  ${TOP_NRSTTR}
132    IGCM_comp_modifyNamelist blocker    namelist_top_cfg     ln_age    ${TOP_AGE}
133    IGCM_comp_modifyNamelist blocker    namelist_top_cfg     ln_cfc11  ${TOP_CFC11}
134    IGCM_comp_modifyNamelist blocker    namelist_top_cfg     ln_cfc12  ${TOP_CFC12}
135    IGCM_comp_modifyNamelist blocker    namelist_pisces_cfg  nn_pisdmp ${OPA_NPDT_YEAR}
136
137    # Update iodef.xml
138
139    IGCM_debug_Print 1 'Informations into iodef.xml : VT1D_ENABLE VT5D_ENABLE VT1M_ENABLE VT1Y_ENABLE '
140    IGCM_debug_Print 1 ${VT1D_ENABLE}  ${VT5D_ENABLE} ${VT1M_ENABLE} ${VT1Y_ENABLE}
141
142    IGCM_comp_modifyXmlFile nonblocker file_def_nemo-pisces.xml 1d_pis enabled ${VT1D_ENABLE}
143    IGCM_comp_modifyXmlFile nonblocker file_def_nemo-pisces.xml 5d_pis enabled ${VT5D_ENABLE}
144    IGCM_comp_modifyXmlFile nonblocker file_def_nemo-pisces.xml 1m_pis enabled ${VT1M_ENABLE}
145    IGCM_comp_modifyXmlFile nonblocker file_def_nemo-pisces.xml 1y_pis enabled ${VT1Y_ENABLE}
146
147    IGCM_comp_modifyXmlFile nonblocker file_def_nemo-pisces.xml 1d_pis output_level ${pisces_UserChoices_OutputLevel}
148    IGCM_comp_modifyXmlFile nonblocker file_def_nemo-pisces.xml 5d_pis output_level ${pisces_UserChoices_OutputLevel}
149    IGCM_comp_modifyXmlFile nonblocker file_def_nemo-pisces.xml 1m_pis output_level ${pisces_UserChoices_OutputLevel}
150    IGCM_comp_modifyXmlFile nonblocker file_def_nemo-pisces.xml 1y_pis output_level ${pisces_UserChoices_OutputLevel}
151
152#    if [ X${config_UserChoices_ConfigType} = XESMCO2 ] ; then
153#      # Output file with PISCES gas variables
154#      IGCM_comp_modifyXmlFile force file_def_nemo-pisces.xml file41 enabled .TRUE.
155#    else
156#      IGCM_comp_modifyXmlFile force file_def_nemo-pisces.xml file41 enabled .FALSE.
157#    fi
158   
159   
160    IGCM_debug_PopStack "MBG_Update"
161}
162
163#-----------------------------------
164function MBG_Finalize
165{
166    IGCM_debug_PushStack "MBG_Finalize"
167
168    echo FINALIZE MBG !!!
169
170    IGCM_debug_PopStack "MBG_Finalize"
171}
172
Note: See TracBrowser for help on using the repository browser.