[5479] | 1 | #!/bin/ksh |
---|
| 2 | |
---|
| 3 | #D- Driver for ORCHIDEE stomate component (SBG) |
---|
| 4 | |
---|
| 5 | #----------------------------------------------------------------- |
---|
| 6 | function SBG_Initialize |
---|
| 7 | { |
---|
| 8 | IGCM_debug_PushStack "SBG_Initialize" |
---|
| 9 | |
---|
[6417] | 10 | # Define the resolution only if the composant ICO for DYNAMICO is set in config.card |
---|
| 11 | if [ ! X${config_ListOfComponents_ICO} = X ] ; then |
---|
[6662] | 12 | RESOL_SBG="nbp${RESOL_NBP}" |
---|
[6417] | 13 | fi |
---|
[6667] | 14 | # Define the resolution only if the composant ICO for DYNAMICO is set in config.card |
---|
| 15 | if [ ! X${config_ListOfComponents_ICO} = X ] ; then |
---|
| 16 | RESOL_SBG="nbp${RESOL_NBP}" |
---|
| 17 | fi |
---|
[6417] | 18 | |
---|
[5479] | 19 | IGCM_debug_PopStack "SBG_Initialize" |
---|
| 20 | } |
---|
| 21 | |
---|
| 22 | #----------------------------------------------------------------- |
---|
| 23 | function SBG_Update |
---|
| 24 | { |
---|
| 25 | IGCM_debug_PushStack "SBG_Update" |
---|
| 26 | |
---|
| 27 | # Output management |
---|
| 28 | # Modify file_def_orchidee.xml file using settings from stomate.card |
---|
| 29 | # We here suppose that for each file, in stomate.card UserChoices section, if the parameter |
---|
| 30 | # output_level_filename is set, then also output_freq_filename must be set. The existance of output_freq_filename will not be checked. |
---|
| 31 | # If output_level_filename=NONE or if it is not set, the corresponding file will be deactivated. |
---|
| 32 | |
---|
| 33 | if [ X${stomate_UserChoices_output_level_stomate_history} = X ] || [ X${stomate_UserChoices_output_level_stomate_history} = XNONE ] ; then |
---|
| 34 | # output_level_stomate_history is not set in stomate.card or it is set to NONE. |
---|
| 35 | # Deactivate the file. |
---|
| 36 | IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate1 enabled .FALSE. |
---|
| 37 | IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate1 output_level 0 |
---|
| 38 | IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate1 output_freq 1mo |
---|
| 39 | else |
---|
| 40 | IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate1 enabled .TRUE. |
---|
| 41 | IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate1 output_level ${stomate_UserChoices_output_level_stomate_history} |
---|
| 42 | IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate1 output_freq ${stomate_UserChoices_output_freq_stomate_history} |
---|
[6662] | 43 | if [ ! X${config_ListOfComponents_ICO} = X ] ; then |
---|
| 44 | IGCM_comp_modifyXmlFile force file_def_orchidee.xml groupremap_stomate1 group_ref remap_${stomate_UserChoices_output_freq_stomate_history} |
---|
| 45 | fi |
---|
[5479] | 46 | fi |
---|
| 47 | |
---|
| 48 | if [ X${stomate_UserChoices_output_level_stomate_ipcc_history} = X ] || [ X${stomate_UserChoices_output_level_stomate_ipcc_history} = XNONE ] ; then |
---|
| 49 | # output_level_stomate_ipcc_history is not set in stomate.card or it is set to NONE. |
---|
| 50 | # Deactivate the file. |
---|
| 51 | IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate2 enabled .FALSE. |
---|
| 52 | IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate2 output_level 0 |
---|
| 53 | IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate2 output_freq 1mo |
---|
| 54 | else |
---|
| 55 | IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate2 enabled .TRUE. |
---|
| 56 | IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate2 output_level ${stomate_UserChoices_output_level_stomate_ipcc_history} |
---|
| 57 | IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate2 output_freq ${stomate_UserChoices_output_freq_stomate_ipcc_history} |
---|
[6662] | 58 | if [ ! X${config_ListOfComponents_ICO} = X ] ; then |
---|
| 59 | IGCM_comp_modifyXmlFile force file_def_orchidee.xml groupremap_stomate2 group_ref remap_${stomate_UserChoices_output_freq_stomate_ipcc_history} |
---|
| 60 | fi |
---|
[5479] | 61 | fi |
---|
| 62 | |
---|
| 63 | |
---|
| 64 | if [ X${stomate_UserChoices_output_level_stomate_history_4dim} = X ] || [ X${stomate_UserChoices_output_level_stomate_history_4dim} = XNONE ] ; then |
---|
| 65 | # output_level_stomate_history_4dim is not set in stomate.card or it is set to NONE. |
---|
| 66 | # Deactivate the file. |
---|
| 67 | IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate3 enabled .FALSE. |
---|
| 68 | IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate3 output_level 0 |
---|
| 69 | IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate3 output_freq 1mo |
---|
| 70 | else |
---|
| 71 | IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate3 enabled .TRUE. |
---|
| 72 | IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate3 output_level ${stomate_UserChoices_output_level_stomate_history_4dim} |
---|
| 73 | IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate3 output_freq ${stomate_UserChoices_output_freq_stomate_history_4dim} |
---|
[6662] | 74 | if [ ! X${config_ListOfComponents_ICO} = X ] ; then |
---|
| 75 | IGCM_comp_modifyXmlFile force file_def_orchidee.xml groupremap_stomate3 group_ref remap_${stomate_UserChoices_output_freq_stomate_history_4dim} |
---|
| 76 | fi |
---|
[5479] | 77 | fi |
---|
| 78 | |
---|
| 79 | |
---|
[6417] | 80 | if [ X${stomate_UserChoices_output_level_stomate_fixed_dia} = X ] || [ X${stomate_UserChoices_output_level_stomate_fixed_dia} = XNONE ] ; then |
---|
| 81 | # output_level_stomate_fixed_dia is not set in stomate.card or it is set to NONE. |
---|
| 82 | # Deactivate the file. |
---|
| 83 | IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate4 enabled .FALSE. |
---|
| 84 | IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate4 output_level 0 |
---|
| 85 | IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate4 output_freq 1mo |
---|
| 86 | else |
---|
| 87 | IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate4 enabled .TRUE. |
---|
| 88 | IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate4 output_level ${stomate_UserChoices_output_level_stomate_fixed_dia} |
---|
| 89 | IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate4 output_freq ${stomate_UserChoices_output_freq_stomate_fixed_dia} |
---|
[6662] | 90 | if [ ! X${config_ListOfComponents_ICO} = X ] ; then |
---|
| 91 | IGCM_comp_modifyXmlFile force file_def_orchidee.xml groupremap_stomate4 group_ref remap_${stomate_UserChoices_output_freq_stomate_history_fixed_dia} |
---|
| 92 | fi |
---|
[6417] | 93 | fi |
---|
| 94 | |
---|
| 95 | |
---|
[5479] | 96 | # Define in orchidee.def if restart file should be used |
---|
| 97 | if ( [ ${CumulPeriod} -eq 1 ] && [ "${config_SBG_Restart}" = "n" ] ) ; then |
---|
| 98 | echo "STOMATE : without restart" |
---|
| 99 | IGCM_comp_modifyDefFile blocker orchidee.def STOMATE_RESTART_FILEIN NONE |
---|
| 100 | else |
---|
| 101 | IGCM_comp_modifyDefFile blocker orchidee.def STOMATE_RESTART_FILEIN stomate_rest_in.nc |
---|
| 102 | fi |
---|
| 103 | |
---|
| 104 | |
---|
| 105 | # Modify in orchidee.def NINPUT_UPDATE if it is set in stomate.card section UserChoices |
---|
| 106 | # NINPUT_UPDATE inidcates if the nitrogen maps should be updated and at which frequency |
---|
| 107 | if [ ! X${stomate_UserChoices_NINPUT_UPDATE} = X ] ; then |
---|
| 108 | # Take the value from stomate.card |
---|
| 109 | IGCM_comp_modifyDefFile nonblocker orchidee.def NINPUT_UPDATE ${stomate_UserChoices_NINPUT_UPDATE} |
---|
| 110 | else |
---|
| 111 | # Set default value 0Y |
---|
| 112 | IGCM_comp_modifyDefFile nonblocker orchidee.def NINPUT_UPDATE 0Y |
---|
| 113 | fi |
---|
| 114 | |
---|
| 115 | # Modify in orchidee.def STOMATE_IMPOSE_CN if it is set in stomate.card section UserChoices |
---|
| 116 | # STOMATE_IMPOSE_CN inidcates if the nitrogen should be imposed or not. |
---|
| 117 | if [ ! X${stomate_UserChoices_STOMATE_IMPOSE_CN} = X ] ; then |
---|
| 118 | # Take the value from stomate.card |
---|
| 119 | IGCM_comp_modifyDefFile nonblocker orchidee.def STOMATE_IMPOSE_CN ${stomate_UserChoices_STOMATE_IMPOSE_CN} |
---|
| 120 | else |
---|
| 121 | # Set default value n (nitrogen is not imposed) |
---|
| 122 | IGCM_comp_modifyDefFile nonblocker orchidee.def STOMATE_IMPOSE_CN n |
---|
| 123 | fi |
---|
| 124 | |
---|
[6667] | 125 | # Set the appropriate monitoring file depending on grid and resolution if ICO component |
---|
| 126 | if [ ${CumulPeriod} -eq 1 ] ; then |
---|
| 127 | if [ ! X${config_ListOfComponents_ICO} = X ] ; then |
---|
| 128 | IGCM_sys_Cp ${SUBMIT_DIR}/POST/monitoring01_stomate_${ResolAtm}.cfg ${SUBMIT_DIR}/POST/monitoring01_stomate.cfg |
---|
| 129 | else |
---|
| 130 | IGCM_sys_Cp ${SUBMIT_DIR}/POST/monitoring01_stomate_REG.cfg ${SUBMIT_DIR}/POST/monitoring01_stomate.cfg |
---|
| 131 | fi |
---|
| 132 | fi |
---|
[5479] | 133 | |
---|
| 134 | IGCM_debug_PopStack "SBG_Update" |
---|
| 135 | } |
---|
| 136 | |
---|
| 137 | #----------------------------------------------------------------- |
---|
| 138 | function SBG_Finalize |
---|
| 139 | { |
---|
| 140 | IGCM_debug_PushStack "SBG_Finalize" |
---|
| 141 | |
---|
| 142 | IGCM_debug_PopStack "SBG_Finalize" |
---|
| 143 | } |
---|