[925] | 1 | #!/bin/ksh |
---|
| 2 | |
---|
| 3 | #----------------------------------- |
---|
| 4 | function MBG_Initialize |
---|
| 5 | { |
---|
| 6 | IGCM_debug_PushStack "MBG_Initialize" |
---|
| 7 | |
---|
[2861] | 8 | # Local function to find parameters in LMDZ .def files |
---|
[925] | 9 | |
---|
[2753] | 10 | lmdzgrep2 () { |
---|
[3579] | 11 | grep -w ${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 | #----------------------------------- |
---|
| 23 | function MBG_Update |
---|
| 24 | { |
---|
| 25 | IGCM_debug_PushStack "MBG_Update" |
---|
| 26 | |
---|
[3434] | 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 | |
---|
[925] | 44 | ##-- Restart configuration |
---|
[3775] | 45 | ##-- Restart configuration |
---|
[3786] | 46 | if ( [ "${opa9_UserChoices_Reproducibility_after_restart}" = "y" ] ) ; then |
---|
[3775] | 47 | TOP_LN_RSTR=.TRUE. |
---|
| 48 | TOP_NN_RSTR=2 |
---|
[3785] | 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} |
---|
[925] | 51 | |
---|
[3775] | 52 | elif ( [ "${CumulPeriod}" -eq 1 ] && [ "${config_MBG_Restart}" = "n" ] ) ; then |
---|
| 53 | |
---|
[925] | 54 | #echo "NO RESTART FOR TOP" |
---|
[2863] | 55 | TOP_LN_RSTR=.FALSE. |
---|
[2861] | 56 | TOP_NN_RSTR=0 |
---|
[925] | 57 | |
---|
| 58 | elif ( [ "${CumulPeriod}" -eq 1 ] && [ "${config_MBG_Restart}" = "y" ] ) ; then |
---|
| 59 | |
---|
| 60 | #echo "RESTART TOP" |
---|
[2863] | 61 | TOP_LN_RSTR=.TRUE. |
---|
[2861] | 62 | TOP_NN_RSTR=0 |
---|
[925] | 63 | |
---|
[2206] | 64 | # If we start from IPSLCM5* restart files. |
---|
[3785] | 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 |
---|
[2206] | 67 | ncrename -v TRBDSi,TRBGSi -v TRNDSi,TRNGSi -v TRNBSi,TRNDSi -v TRBBSi,TRBDSi ${file} > /dev/null 2>&1 |
---|
[3785] | 68 | done |
---|
[2206] | 69 | |
---|
[925] | 70 | else |
---|
| 71 | |
---|
| 72 | #echo "RESTART TOP" |
---|
[2863] | 73 | TOP_LN_RSTR=.TRUE. |
---|
[2861] | 74 | TOP_NN_RSTR=2 |
---|
[925] | 75 | |
---|
| 76 | fi |
---|
| 77 | |
---|
[3635] | 78 | |
---|
[3638] | 79 | ##-- CO2 forcing : update atcco2 value in namelist_pisces_cfg with the same one used in LMDZ |
---|
| 80 | IGCM_debug_Print 1 "Take same CO2 as for LMDZ, in parameter file config.def." |
---|
| 81 | # ATM_Update is done before MBG_Update and therefore config.def file contains the correct value for CO2. |
---|
| 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} " |
---|
| 85 | IGCM_comp_modifyNamelist force namelist_pisces_cfg atcco2 ${LMDZ_CO2} |
---|
[3635] | 86 | |
---|
[4477] | 87 | if [ X${config_UserChoices_ConfigType} = XESMCO2 ] ; then |
---|
| 88 | ##-- N2O forcing : update atcn2o value in namelist_pisces_cfg with the same one used in LMDZ |
---|
| 89 | IGCM_debug_Print 1 "Take same N2O as for LMDZ, in parameter file config.def." |
---|
| 90 | # ATM_Update is done before MBG_Update and therefore config.def file contains the correct value for N2O |
---|
| 91 | IGCM_debug_Print 1 'Update atcn2o in namelist_pisces_cfg with same value as for LMDZ' |
---|
| 92 | LMDZ_N2O=$( lmdzgrep2 N2O_ppb config.def ) |
---|
| 93 | IGCM_debug_Print 1 "LMDZ_N2O : ${LMDZ_N2O} " |
---|
| 94 | IGCM_comp_modifyNamelist force namelist_pisces_cfg atcn2o ${LMDZ_N2O} |
---|
| 95 | fi |
---|
| 96 | |
---|
[2198] | 97 | ##-- Update namelist_top_cfg and namelist_pisces_cfg |
---|
[2863] | 98 | IGCM_comp_modifyNamelist blocker namelist_top_cfg ln_rsttr ${TOP_LN_RSTR} |
---|
[2861] | 99 | IGCM_comp_modifyNamelist blocker namelist_top_cfg nn_rsttr ${TOP_NN_RSTR} |
---|
| 100 | IGCM_comp_modifyNamelist blocker namelist_pisces_cfg nn_pisdmp ${OPA_NPDT_YEAR} |
---|
[3434] | 101 | |
---|
| 102 | # Update iodef.xml |
---|
| 103 | |
---|
| 104 | IGCM_debug_Print 1 'Informations into iodef.xml : VT1D_ENABLE VT5D_ENABLE VT1M_ENABLE VT1Y_ENABLE ' |
---|
| 105 | IGCM_debug_Print 1 ${VT1D_ENABLE} ${VT5D_ENABLE} ${VT1M_ENABLE} ${VT1Y_ENABLE} |
---|
| 106 | |
---|
[3491] | 107 | IGCM_comp_modifyXmlFile nonblocker file_def_nemo-pisces.xml 1d_pis enabled ${VT1D_ENABLE} |
---|
| 108 | IGCM_comp_modifyXmlFile nonblocker file_def_nemo-pisces.xml 5d_pis enabled ${VT5D_ENABLE} |
---|
| 109 | IGCM_comp_modifyXmlFile nonblocker file_def_nemo-pisces.xml 1m_pis enabled ${VT1M_ENABLE} |
---|
| 110 | IGCM_comp_modifyXmlFile nonblocker file_def_nemo-pisces.xml 1y_pis enabled ${VT1Y_ENABLE} |
---|
[3634] | 111 | |
---|
| 112 | IGCM_comp_modifyXmlFile nonblocker file_def_nemo-pisces.xml 1d_pis output_level ${pisces_UserChoices_OutputLevel} |
---|
| 113 | IGCM_comp_modifyXmlFile nonblocker file_def_nemo-pisces.xml 5d_pis output_level ${pisces_UserChoices_OutputLevel} |
---|
| 114 | IGCM_comp_modifyXmlFile nonblocker file_def_nemo-pisces.xml 1m_pis output_level ${pisces_UserChoices_OutputLevel} |
---|
| 115 | IGCM_comp_modifyXmlFile nonblocker file_def_nemo-pisces.xml 1y_pis output_level ${pisces_UserChoices_OutputLevel} |
---|
| 116 | |
---|
[4477] | 117 | if [ X${config_UserChoices_ConfigType} = XESMCO2 ] ; then |
---|
| 118 | # Output file with PISCES gas variables |
---|
| 119 | IGCM_comp_modifyXmlFile force file_def_nemo-pisces.xml file41 enabled .TRUE. |
---|
| 120 | else |
---|
| 121 | IGCM_comp_modifyXmlFile force file_def_nemo-pisces.xml file41 enabled .FALSE. |
---|
| 122 | fi |
---|
| 123 | |
---|
[3434] | 124 | |
---|
[2861] | 125 | IGCM_debug_PopStack "MBG_Update" |
---|
[925] | 126 | } |
---|
| 127 | |
---|
| 128 | #----------------------------------- |
---|
| 129 | function MBG_Finalize |
---|
| 130 | { |
---|
| 131 | IGCM_debug_PushStack "MBG_Finalize" |
---|
| 132 | |
---|
| 133 | echo FINALIZE MBG !!! |
---|
| 134 | |
---|
| 135 | IGCM_debug_PopStack "MBG_Finalize" |
---|
| 136 | } |
---|
| 137 | |
---|