- Timestamp:
- 03/23/18 15:32:55 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
CONFIG/UNIFORM/v6/IPSLCM6CHT/GENERAL/DRIVER/orchidee.driver
r2456 r3688 1 1 #!/bin/ksh 2 # D- Driver du script pourORCHIDEE2 ## Driver for the component SRF corresponding to the sechiba part of ORCHIDEE 3 3 #----------------------------------------------------------------- 4 4 function SRF_Initialize … … 6 6 IGCM_debug_PushStack "SRF_Initialize" 7 7 8 RESOL_SRF=ALL9 10 for frequency in ${config_SRF_WriteFrequency} ; do11 case ${frequency} in12 HF|hf) SRF_ok_hf=y ;;13 esac14 done15 16 8 ##- Define variable DefSuffix set in orchidee.card 17 ## This variable is used in orchidee.card to choose 18 ## parameter file(orchidee.def_DefSuffix). 9 ## This variable is used in orchidee.card to choose 10 ## parameter file(orchidee.def_DefSuffix). 19 11 if [ ! X${orchidee_UserChoices_DefSuffix} = X ] ; then 20 12 DefSuffix=${orchidee_UserChoices_DefSuffix} 21 13 else 22 14 DefSuffix=Choi 23 15 fi 24 16 … … 31 23 IGCM_debug_PushStack "SRF_Update" 32 24 25 ## 1. Modifications in orchidee.def parameter file 26 33 27 # Activate STOMATE if the compontent SBG=stomate is set in config.card 34 28 if [ X${config_ListOfComponents_SBG} = Xstomate ] ; then 35 IGCM_comp_modifyDefFile blocker orchidee.def STOMATE_OK_STOMATE y 29 # Activate stomate in orchidee.def 30 IGCM_comp_modifyDefFile blocker orchidee.def STOMATE_OK_STOMATE y 36 31 else 37 IGCM_comp_modifyDefFile blocker orchidee.def STOMATE_OK_STOMATE n 32 # Deactivate stomate in orchidee.def 33 IGCM_comp_modifyDefFile blocker orchidee.def STOMATE_OK_STOMATE n 34 # Deactivate output files for stomate 35 IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate1 enabled .FALSE. 36 IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate1 output_level 0 37 IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate1 output_freq 1mo 38 IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate2 enabled .FALSE. 39 IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate2 output_level 0 40 IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate2 output_freq 1mo 38 41 fi 39 42 40 typeset SECHIBA_WRITE_STEP 41 42 if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then 43 IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 enabled .FALSE. 44 IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba2 enabled .FALSE. 45 IGCM_comp_modifyDefFile nonblocker orchidee.def XIOS_ORCHIDEE_OK y 43 # Define in orchidee.def if restart file should be used 44 if ( [ ${CumulPeriod} -ne 1 ] || [ "${config_SRF_Restart}" != "n" ] ) ; then 45 IGCM_comp_modifyDefFile blocker orchidee.def SECHIBA_restart_in sechiba_rest_in.nc 46 46 else 47 IGCM_comp_modifyDefFile nonblocker orchidee.def XIOS_ORCHIDEE_OK n 48 fi 49 50 SRF_WriteFrequency=$( echo ${config_SRF_WriteFrequency} | sed -e 's/\([0-9]*[yYmMdDs]\).*/\1/' ) 51 case ${SRF_WriteFrequency} in 52 *Y|*y) 53 WriteInYears=$( echo ${SRF_WriteFrequency} | awk -F '[yY]' '{print $1}' ) 54 PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' ) 55 (( SECHIBA_WRITE_STEP = PeriodLengthInDays * WriteInYears / PeriodLengthInYears * 86400 )) 56 if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then 57 IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 enabled .TRUE. 58 IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 output_freq ${WriteInYears}y 59 IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 name sechiba_history 60 fi 61 ;; 62 1M) 63 if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then 64 IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 enabled .TRUE. 65 IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 output_freq 1mo 66 IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 name sechiba_history 67 fi 68 case ${config_UserChoices_PeriodLength} in 69 *Y|*y) 70 SECHIBA_WRITE_STEP=-1. 71 ;; 72 *M|*m) 73 SECHIBA_WRITE_STEP=-1. 74 ;; 75 *) 76 (( SECHIBA_WRITE_STEP = $( IGCM_date_DaysInMonth $year $month ) * 86400 )) 77 ;; 78 esac 79 ;; 80 *M|*m) 81 WriteInMonths=$( echo ${SRF_WriteFrequency} | awk -F '[mM]' '{print $1}' ) 82 if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then 83 IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 enabled .TRUE. 84 IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 output_freq ${WriteInMonths}mo 85 IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 name sechiba_history 86 fi 87 case ${config_UserChoices_PeriodLength} in 88 *Y|*y) 89 PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' ) 90 (( SECHIBA_WRITE_STEP = PeriodLengthInDays * 86400 / PeriodLengthInYears / 12 )) 91 ;; 92 *M|*m) 93 PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | awk -F '[mM]' '{print $1}' ) 94 (( SECHIBA_WRITE_STEP = PeriodLengthInDays * WriteInMonths * 86400 / PeriodLengthInMonths )) 95 ;; 96 *) 97 (( SECHIBA_WRITE_STEP = $( IGCM_date_DaysInMonth $year $month ) * 86400 )) 98 if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then 99 IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 enabled .TRUE. 100 IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 output_freq ${SECHIBA_WRITE_STEP}s 101 IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 name sechiba_history 102 fi 103 ;; 104 esac 105 ;; 106 5D|5d) 107 if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then 108 IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 enabled .TRUE. 109 IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 output_freq 5d 110 IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 name sechiba_history 111 fi 112 (( SECHIBA_WRITE_STEP = 5 * 86400 )) 113 ;; 114 1D|1d) 115 if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then 116 IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 enabled .TRUE. 117 IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 output_freq 1d 118 IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 name sechiba_history 119 fi 120 (( SECHIBA_WRITE_STEP = 86400 )) 121 ;; 122 *s) 123 WriteInSeconds=$( echo ${SRF_WriteFrequency} | awk -F '[s]' '{print $1}' ) 124 if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then 125 IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 enabled .TRUE. 126 IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 output_freq ${WriteInSeconds}s 127 IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba1 name sechiba_history 128 fi 129 (( SECHIBA_WRITE_STEP = WriteInSeconds )) ;; 130 *) 131 IGCM_debug_Exit "SRF_Update " ${SRF_WriteFrequency} " invalid WriteFrequency : choose in 1Y, 1M, 5D, 1D." 132 IGCM_debug_Verif_Exit ;; 133 esac 134 135 #Use of XIOS ouputs only 136 137 if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then 138 (( SECHIBA_WRITE_STEP = 0 )) 139 fi 140 IGCM_comp_modifyDefFile nonblocker orchidee.def WRITE_STEP ${SECHIBA_WRITE_STEP} 141 IGCM_comp_modifyDefFile nonblocker orchidee.def SECHIBA_HISTLEVEL ${orchidee_UserChoices_sechiba_LEVEL} 142 143 # Outputs HF in HISTFILE2 if required 144 if [ X${SRF_ok_hf} = Xy ] ; then 145 IGCM_comp_modifyDefFile nonblocker orchidee.def SECHIBA_HISTFILE2 y 146 if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then 147 IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba2 enabled .TRUE. 148 IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba2 output_freq 10800s 149 IGCM_comp_modifyXmlFile force file_def_orchidee.xml sechiba2 name sechiba_out_2 150 fi 151 else 152 IGCM_comp_modifyDefFile nonblocker orchidee.def SECHIBA_HISTFILE2 n 153 fi 154 IGCM_comp_modifyDefFile nonblocker orchidee.def SECHIBA_HISTLEVEL2 1 155 IGCM_comp_modifyDefFile nonblocker orchidee.def WRITE_STEP2 10800.0 156 157 if ( [ ${CumulPeriod} -ne 1 ] || [ "${config_SRF_Restart}" != "n" ] ) ; then 158 IGCM_comp_modifyDefFile blocker orchidee.def SECHIBA_restart_in sechiba_rest_in.nc 159 else 160 IGCM_comp_modifyDefFile blocker orchidee.def SECHIBA_restart_in NONE 47 IGCM_comp_modifyDefFile blocker orchidee.def SECHIBA_restart_in NONE 161 48 fi 162 49 163 # Modify in orchidee.def VEGET_UPDATE and LAND_COVER_CHANGE if they are set in orchidee.card section UserChoices 164 if [ ! X${orchidee_UserChoices_VEGET_UPDATE} = X ] ; then 165 IGCM_comp_modifyDefFile nonblocker orchidee.def VEGET_UPDATE ${orchidee_UserChoices_VEGET_UPDATE} 166 else 167 IGCM_comp_modifyDefFile nonblocker orchidee.def VEGET_UPDATE 0Y 168 fi 169 if [ ! X${orchidee_UserChoices_LAND_COVER_CHANGE} = X ] ; then 170 IGCM_comp_modifyDefFile nonblocker orchidee.def LAND_COVER_CHANGE ${orchidee_UserChoices_LAND_COVER_CHANGE} 171 else 172 IGCM_comp_modifyDefFile nonblocker orchidee.def LAND_COVER_CHANGE n 50 # Set VEGET_UPDATE=1Y in orchidee.def if VEGET_UPDATE_at_start=y in orchidee.card and if it is the first cumul periond (start of new simulation) 51 if [ X${orchidee_UserChoices_VEGET_UPDATE_at_start} = Xy ] && [ ${CumulPeriod} -eq 1 ] ; then 52 IGCM_comp_modifyDefFile nonblocker orchidee.def VEGET_UPDATE 1Y 173 53 fi 174 54 175 #IGCM_sys_Cp ${RUN_DIR}/orchidee.def ${RUN_DIR}/run.def 176 #IGCM_sys_Put_Out ${RUN_DIR}/run.def ${R_SAVE}/${PREFIX}_run.def 55 # Modify in orchidee.def VEGET_UPDATE if it is set in orchidee.card section UserChoices 56 # Note: if the variable has been set by VEGET_UPDATE_at_start, this section will not overwrite it. 57 if [ ! X${orchidee_UserChoices_VEGET_UPDATE} = X ] ; then 58 IGCM_comp_modifyDefFile nonblocker orchidee.def VEGET_UPDATE ${orchidee_UserChoices_VEGET_UPDATE} 59 else 60 IGCM_comp_modifyDefFile nonblocker orchidee.def VEGET_UPDATE 0Y 61 fi 177 62 178 #Temporary way to fix bug on cimean variable 179 IGCM_comp_modifyXmlFile force field_def_orchidee.xml cimean enabled .FALSE. 63 # Activate creation of river description file only for the first period 64 if [ ${CumulPeriod} -eq 1 ] ; then 65 IGCM_comp_modifyDefFile nonblocker orchidee.def RIVER_DESC y 66 else 67 IGCM_comp_modifyDefFile nonblocker orchidee.def RIVER_DESC n 68 fi 180 69 181 if [ X${orchidee_UserChoices_XIOS} = Xy ] ; then 70 71 ## 2. Mangement of output and modifications of related xml files 72 # Modify file_def_orchidee.xml file using settings from orchidee.card 73 # We here suppose that for each file, in orchidee.card UserChoices section, if the parameter 74 # output_level_filename is set, then also output_freq_filename must be set. The existance of output_freq_filename will not be checked. 75 # If output_level_filename=NONE or if it is not set, the corresponding file will be deactivated. 76 # Settings in config.card WriteFrequency are not used any more. 77 78 if [ X${orchidee_UserChoices_output_level_sechiba_history} = X ] || [ X${orchidee_UserChoices_output_level_sechiba_history} = XNONE ] ; then 79 # output_level_sechiba_history is not set in orchidee.card or it is set to NONE. 80 # Deactivate the file. 81 IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml sechiba1 enabled .FALSE. 82 IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml sechiba1 output_level 0 83 IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml sechiba1 output_freq 1mo 84 else 85 IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml sechiba1 enabled .TRUE. 86 IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml sechiba1 output_level ${orchidee_UserChoices_output_level_sechiba_history} 87 IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml sechiba1 output_freq ${orchidee_UserChoices_output_freq_sechiba_history} 88 fi 89 90 if [ X${orchidee_UserChoices_output_level_sechiba_out_2} = X ] || [ X${orchidee_UserChoices_output_level_sechiba_out_2} = XNONE ] ; then 91 # output_level_sechiba_out_2 is not set in orchidee.card or it is set to NONE. 92 # Deactivate the file. 93 IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml sechiba2 enabled .FALSE. 94 IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml sechiba2 output_level 0 95 IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml sechiba2 output_freq 1mo 96 else 97 IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml sechiba2 enabled .TRUE. 98 IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml sechiba2 output_level ${orchidee_UserChoices_output_level_sechiba_out_2} 99 IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml sechiba2 output_freq ${orchidee_UserChoices_output_freq_sechiba_out_2} 100 fi 101 102 if [ X${orchidee_UserChoices_output_level_sechiba_history_4dim} = X ] || [ X${orchidee_UserChoices_output_level_sechiba_history_4dim} = XNONE ] ; then 103 # output_level_sechiba_history_4dim is not set in orchidee.card or it is set to NONE. 104 # Deactivate the file. 105 IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml sechiba3 enabled .FALSE. 106 IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml sechiba3 output_level 0 107 IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml sechiba3 output_freq 1mo 108 else 109 IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml sechiba3 enabled .TRUE. 110 IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml sechiba3 output_level ${orchidee_UserChoices_output_level_sechiba_history_4dim} 111 IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml sechiba3 output_freq ${orchidee_UserChoices_output_freq_sechiba_history_4dim} 112 fi 113 114 182 115 # Add include of orchidee context in iodef.xml 183 116 # In iodef.xml add on next line after "COMPONENT CONTEXT" 184 117 # <context id="orchidee" src="./context_orchidee.xml"/> 185 echo '<context id="orchidee" src="./context_orchidee.xml"/>' > add.tmp 186 cp iodef.xml iodef.xml.tmp 187 sed -e "/COMPONENT CONTEXT/r add.tmp" \ 188 iodef.xml.tmp > iodef.xml 189 rm iodef.xml.tmp add.tmp 118 echo '<context id="orchidee" src="./context_orchidee.xml"/>' > add.tmp 119 if [ X"$( echo ${config_UserChoices_ExpType} | grep CMIP6 )" != "X" ] ; then 120 echo '<context id="orchidee" src="./ping_orchidee.xml"/>' >> add.tmp 121 echo '<context id="orchidee" src="./dr2xml_orchidee.xml"/>' >> add.tmp 190 122 fi 123 cp iodef.xml iodef.xml.tmp 124 sed -e "/COMPONENT CONTEXT/r add.tmp" iodef.xml.tmp > iodef.xml 125 rm iodef.xml.tmp add.tmp 126 127 # Add LongName as global attribute in XIOS output files (if LongName is not empty) 128 if [ ! "X${config_UserChoices_LongName}" = "X" ] ; then 129 listfile=$(ls file_def*orchidee.xml) 130 echo "<variable id=\"LongName\" type=\"string\">${config_UserChoices_LongName}</variable>" > add.tmp 131 for file in ${listfile} 132 do 133 cp ${file} ${file}.tmp 134 sed -e "/<file id/r add.tmp" \ 135 ${file}.tmp > ${file} 136 rm ${file}.tmp 137 done 138 rm add.tmp 139 fi 140 191 141 192 142 IGCM_debug_PopStack "SRF_Update" … … 198 148 IGCM_debug_PushStack "SRF_Finalize" 199 149 200 #IGCM_sys_Put_Out ${RUN_DIR}/used_run.def ${R_SAVE}/${PREFIX}_used_run.def201 202 echo FINALIZE SRF !!!203 204 150 IGCM_debug_PopStack "SRF_Finalize" 205 151 }
Note: See TracChangeset
for help on using the changeset viewer.