[4180] | 1 | #!/bin/ksh |
---|
| 2 | #----------------------------------------------------------------- |
---|
[4281] | 3 | function ICO_Initialize |
---|
[4180] | 4 | { |
---|
[4281] | 5 | IGCM_debug_PushStack "ICO_Initialize" |
---|
[4180] | 6 | |
---|
[4281] | 7 | ##- Horizontal resolution read from dynamic.card |
---|
| 8 | if [ ! X${dynamico_UserChoices_RESOL_NBP} = X ] ; then |
---|
| 9 | RESOL_NBP=${dynamico_UserChoices_RESOL_NBP} |
---|
[4180] | 10 | else |
---|
| 11 | # Set default resolution |
---|
| 12 | RESOL_NBP=20 |
---|
| 13 | fi |
---|
| 14 | |
---|
[4281] | 15 | ##- Horizontal resolution read from dynamico.card |
---|
| 16 | if [ ! X${dynamico_UserChoices_RESOL_ATM_Z} = X ] ; then |
---|
| 17 | RESOL_ATM_Z=${dynamico_UserChoices_RESOL_ATM_Z} |
---|
[4180] | 18 | else |
---|
[4281] | 19 | # RESOL_ATM_Z is not set in dynamico.card but this is needed |
---|
| 20 | IGCM_debug_Exit "RESOL_ATM_Z must be set in dynamico.card UserSection" |
---|
| 21 | IGCM_debug_Verif_Exit |
---|
[4180] | 22 | fi |
---|
| 23 | |
---|
[4281] | 24 | IGCM_debug_PopStack "ICO_Initialize" |
---|
[4180] | 25 | } |
---|
| 26 | |
---|
| 27 | #----------------------------------------------------------------- |
---|
[4281] | 28 | function ICO_Update |
---|
[4180] | 29 | { |
---|
[4281] | 30 | IGCM_debug_PushStack "ICO_Update" |
---|
[4180] | 31 | |
---|
| 32 | IGCM_comp_modifyDefFile blocker run_icosa.def run_length $(( ${PeriodLengthInDays} * 86400 )) |
---|
| 33 | |
---|
[4288] | 34 | # Change run_dynamico.def according to UserChoices options set in dynmaico.card |
---|
| 35 | |
---|
| 36 | # Activate create_etat0_limit |
---|
| 37 | if [ X${dynamico_UserChoices_create_etat0_limit} = Xy ] ; then |
---|
| 38 | # create_etat0_limit is set in dynamcio.card to y |
---|
| 39 | IGCM_comp_modifyDefFile nonblocker run_dynamico.def create_etat0_limit y |
---|
| 40 | |
---|
| 41 | # Use iflag_phys=101 or higher to activate aquaplanet mode |
---|
| 42 | if [ X${dynamico_UserChoices_iflag_phys} = X ] || X${dynamico_UserChoices_iflag_phys} = X1 ]; then |
---|
| 43 | # iflag_phys is not set or iflag_phys=1 => run is not an aquaplanet |
---|
| 44 | IGCM_comp_modifyDefFile nonblocker run_dynamico.def etat0 database |
---|
| 45 | IGCM_comp_modifyDefFile nonblocker run_dynamico.def iflag_phys 1 |
---|
| 46 | else |
---|
| 47 | # This is an aquaplanet |
---|
| 48 | IGCM_comp_modifyDefFile nonblocker run_dynamico.def etat0 held_suarez |
---|
| 49 | IGCM_comp_modifyDefFile nonblocker run_dynamico.def iflag_phys ${dynamico_UserChoices_iflag_phys} |
---|
| 50 | fi |
---|
| 51 | else |
---|
| 52 | # Deactivate create_etat0_limit |
---|
| 53 | IGCM_comp_modifyDefFile nonblocker run_dynamico.def create_etat0_limit n |
---|
| 54 | IGCM_comp_modifyDefFile nonblocker run_dynamico.def etat0 start_file |
---|
| 55 | # iflag_phys is read but not used when running with DYNAMCIO and create_etat0_limit=n |
---|
| 56 | IGCM_comp_modifyDefFile nonblocker run_dynamico.def iflag_phys 1 |
---|
| 57 | fi |
---|
| 58 | |
---|
| 59 | |
---|
[4281] | 60 | # Add include of context xml files for DYNAMICO in iodef.xml |
---|
[4190] | 61 | # In iodef.xml add on the next line after "COMPONENT CONTEXT" |
---|
| 62 | echo '<context id="icosagcm" src="./context_dynamico.xml"/>' >> add.tmp |
---|
| 63 | |
---|
| 64 | # Add inclusion of file context_input_dynamico.xml if this file exists |
---|
| 65 | if [ -f context_input_dynamico.xml ] ; then |
---|
| 66 | echo '<context id="icosagcm" src="./context_input_dynamico.xml"/>' >> add.tmp |
---|
| 67 | fi |
---|
| 68 | |
---|
| 69 | # Include xml files for output configuration if running with workflow CMIP6 |
---|
| 70 | if [ X"$( echo ${config_UserChoices_ExpType} | grep CMIP6 )" != "X" ] ; then |
---|
[4281] | 71 | if [ -f ping_dynamico.xml ] ; then |
---|
| 72 | echo '<context id="icosagcm" src="./ping_dynamico.xml"/>' >> add.tmp |
---|
| 73 | echo '<context id="icosagcm" src="./dr2xml_dynamico.xml"/>' >> add.tmp |
---|
| 74 | fi |
---|
[4190] | 75 | fi |
---|
| 76 | cp iodef.xml iodef.xml.tmp |
---|
| 77 | sed -e "/COMPONENT CONTEXT/r add.tmp" iodef.xml.tmp > iodef.xml |
---|
| 78 | rm iodef.xml.tmp add.tmp |
---|
| 79 | |
---|
| 80 | # Add a Long Name as global attribute in output files if LongName is set in config.card |
---|
| 81 | if [ ! "X${config_UserChoices_LongName}" = "X" ] ; then |
---|
[4281] | 82 | listfile=$(ls file_def*dynamico.xml) |
---|
[4190] | 83 | echo "<variable id=\"LongName\" type=\"string\">${config_UserChoices_LongName}</variable>" > add.tmp |
---|
| 84 | for file in ${listfile} ; do |
---|
| 85 | cp ${file} ${file}.tmp |
---|
| 86 | sed -e "/<file id/r add.tmp" \ |
---|
| 87 | ${file}.tmp > ${file} |
---|
| 88 | rm ${file}.tmp |
---|
| 89 | done |
---|
| 90 | rm add.tmp |
---|
| 91 | fi |
---|
| 92 | |
---|
[4281] | 93 | IGCM_debug_PopStack "ICO_Update" |
---|
[4180] | 94 | } |
---|
| 95 | |
---|
| 96 | #----------------------------------- |
---|
[4281] | 97 | function ICO_Finalize |
---|
[4180] | 98 | { |
---|
[4281] | 99 | IGCM_debug_PushStack "ICO_Finalize" |
---|
[4180] | 100 | |
---|
[4281] | 101 | IGCM_debug_PopStack "ICO_Finalize" |
---|
[4180] | 102 | } |
---|
| 103 | |
---|