[4785] | 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 | |
---|
| 10 | IGCM_debug_PopStack "SBG_Initialize" |
---|
| 11 | } |
---|
| 12 | |
---|
| 13 | #----------------------------------------------------------------- |
---|
| 14 | function SBG_Update |
---|
| 15 | { |
---|
| 16 | IGCM_debug_PushStack "SBG_Update" |
---|
| 17 | |
---|
| 18 | # Output management |
---|
| 19 | # Modify file_def_orchidee.xml file using settings from stomate.card |
---|
| 20 | # We here suppose that for each file, in stomate.card UserChoices section, if the parameter |
---|
| 21 | # output_level_filename is set, then also output_freq_filename must be set. The existance of output_freq_filename will not be checked. |
---|
| 22 | # If output_level_filename=NONE or if it is not set, the corresponding file will be deactivated. |
---|
| 23 | |
---|
| 24 | if [ X${stomate_UserChoices_output_level_stomate_history} = X ] || [ X${stomate_UserChoices_output_level_stomate_history} = XNONE ] ; then |
---|
| 25 | # output_level_stomate_history is not set in stomate.card or it is set to NONE. |
---|
| 26 | # Deactivate the file. |
---|
| 27 | IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate1 enabled .FALSE. |
---|
| 28 | IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate1 output_level 0 |
---|
| 29 | IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate1 output_freq 1mo |
---|
| 30 | else |
---|
| 31 | IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate1 enabled .TRUE. |
---|
| 32 | IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate1 output_level ${stomate_UserChoices_output_level_stomate_history} |
---|
| 33 | IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate1 output_freq ${stomate_UserChoices_output_freq_stomate_history} |
---|
| 34 | fi |
---|
| 35 | |
---|
| 36 | if [ X${stomate_UserChoices_output_level_stomate_ipcc_history} = X ] || [ X${stomate_UserChoices_output_level_stomate_ipcc_history} = XNONE ] ; then |
---|
| 37 | # output_level_stomate_ipcc_history is not set in stomate.card or it is set to NONE. |
---|
| 38 | # Deactivate the file. |
---|
| 39 | IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate2 enabled .FALSE. |
---|
| 40 | IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate2 output_level 0 |
---|
| 41 | IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate2 output_freq 1mo |
---|
| 42 | else |
---|
| 43 | IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate2 enabled .TRUE. |
---|
| 44 | IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate2 output_level ${stomate_UserChoices_output_level_stomate_ipcc_history} |
---|
| 45 | IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate2 output_freq ${stomate_UserChoices_output_freq_stomate_ipcc_history} |
---|
| 46 | fi |
---|
| 47 | |
---|
| 48 | |
---|
| 49 | if [ X${stomate_UserChoices_output_level_stomate_history_4dim} = X ] || [ X${stomate_UserChoices_output_level_stomate_history_4dim} = XNONE ] ; then |
---|
| 50 | # output_level_stomate_history_4dim is not set in stomate.card or it is set to NONE. |
---|
| 51 | # Deactivate the file. |
---|
| 52 | IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate3 enabled .FALSE. |
---|
| 53 | IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate3 output_level 0 |
---|
| 54 | IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate3 output_freq 1mo |
---|
| 55 | else |
---|
| 56 | IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate3 enabled .TRUE. |
---|
| 57 | IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate3 output_level ${stomate_UserChoices_output_level_stomate_history_4dim} |
---|
| 58 | IGCM_comp_modifyXmlFile nonblocker file_def_orchidee.xml stomate3 output_freq ${stomate_UserChoices_output_freq_stomate_history_4dim} |
---|
| 59 | fi |
---|
| 60 | |
---|
| 61 | |
---|
| 62 | # Define in orchidee.def if restart file should be used |
---|
| 63 | if ( [ ${CumulPeriod} -eq 1 ] && [ "${config_SBG_Restart}" = "n" ] ) ; then |
---|
| 64 | echo "STOMATE : without restart" |
---|
| 65 | IGCM_comp_modifyDefFile blocker orchidee.def STOMATE_RESTART_FILEIN NONE |
---|
| 66 | else |
---|
| 67 | IGCM_comp_modifyDefFile blocker orchidee.def STOMATE_RESTART_FILEIN stomate_rest_in.nc |
---|
| 68 | fi |
---|
| 69 | |
---|
| 70 | |
---|
| 71 | # Modify in orchidee.def NINPUT_UPDATE if it is set in stomate.card section UserChoices |
---|
| 72 | # NINPUT_UPDATE inidcates if the nitrogen maps should be updated and at which frequency |
---|
| 73 | if [ ! X${stomate_UserChoices_NINPUT_UPDATE} = X ] ; then |
---|
| 74 | # Take the value from stomate.card |
---|
| 75 | IGCM_comp_modifyDefFile nonblocker orchidee.def NINPUT_UPDATE ${stomate_UserChoices_NINPUT_UPDATE} |
---|
| 76 | else |
---|
| 77 | # Set default value 0Y |
---|
| 78 | IGCM_comp_modifyDefFile nonblocker orchidee.def NINPUT_UPDATE 0Y |
---|
| 79 | fi |
---|
| 80 | |
---|
| 81 | # Modify in orchidee.def STOMATE_IMPOSE_CN if it is set in stomate.card section UserChoices |
---|
| 82 | # STOMATE_IMPOSE_CN inidcates if the nitrogen should be imposed or not. |
---|
| 83 | if [ ! X${stomate_UserChoices_STOMATE_IMPOSE_CN} = X ] ; then |
---|
| 84 | # Take the value from stomate.card |
---|
| 85 | IGCM_comp_modifyDefFile nonblocker orchidee.def STOMATE_IMPOSE_CN ${stomate_UserChoices_STOMATE_IMPOSE_CN} |
---|
| 86 | else |
---|
| 87 | # Set default value n (nitrogen is not imposed) |
---|
| 88 | IGCM_comp_modifyDefFile nonblocker orchidee.def STOMATE_IMPOSE_CN n |
---|
| 89 | fi |
---|
| 90 | |
---|
| 91 | |
---|
| 92 | IGCM_debug_PopStack "SBG_Update" |
---|
| 93 | } |
---|
| 94 | |
---|
| 95 | #----------------------------------------------------------------- |
---|
| 96 | function SBG_Finalize |
---|
| 97 | { |
---|
| 98 | IGCM_debug_PushStack "SBG_Finalize" |
---|
| 99 | |
---|
| 100 | IGCM_debug_PopStack "SBG_Finalize" |
---|
| 101 | } |
---|