[2349] | 1 | #!/bin/ksh |
---|
| 2 | |
---|
| 3 | #D- Driver du script pour INCA |
---|
| 4 | #----------------------------------------------------------------- |
---|
| 5 | function INCA_sed_replace |
---|
| 6 | { |
---|
| 7 | IGCM_debug_PushStack "INCA_sed_replace" |
---|
| 8 | |
---|
| 9 | sed -e "s/${2}/${3}/" ${1} > ${1}.tmp |
---|
| 10 | RET=$? |
---|
| 11 | echo "INCA_sed : ${1} ${2} ${3}" |
---|
| 12 | \mv ${1}.tmp ${1} |
---|
| 13 | |
---|
| 14 | IGCM_debug_PopStack "INCA_sed_replace" |
---|
| 15 | return $RET |
---|
| 16 | } |
---|
| 17 | #----------------------------------------------------------------- |
---|
| 18 | function CHM_Initialize |
---|
| 19 | { |
---|
| 20 | IGCM_debug_PushStack "CHM_Initialize" |
---|
| 21 | |
---|
| 22 | RESOL_CHM=$( echo $RESOL | awk "-Fx" '{print $2}' | awk "-FD" '{print $2}') |
---|
| 23 | |
---|
| 24 | [ -f ${SUBMIT_DIR}/../.resol ] && eval $(grep RESOL_ATM_3D ${SUBMIT_DIR}/../.resol) || RESOL_ATM_3D=96x95x19 |
---|
| 25 | RESOL_CHM_Z=$( echo ${RESOL_ATM_3D} | awk "-Fx" '{print $3}' | awk "-F-" '{print $1}') |
---|
| 26 | echo 'resol chimie', $RESOL_CHM |
---|
| 27 | |
---|
| 28 | [ -f ${SUBMIT_DIR}/../.chimie ] && eval $(grep CHEM ${SUBMIT_DIR}/../.chimie) |
---|
| 29 | INCA_sed_replace ${SUBMIT_DIR}/config.card \${CHEM} ${CHEM} |
---|
| 30 | echo "INCA Tag : LMDZ-INCA" ${config_UserChoices_TagName} |
---|
| 31 | |
---|
| 32 | IGCM_debug_PopStack "CHM_Initialize" |
---|
| 33 | } |
---|
| 34 | |
---|
| 35 | #----------------------------------------------------------------- |
---|
| 36 | function CHM_Update |
---|
| 37 | { |
---|
| 38 | IGCM_debug_PushStack "CHM_Update" |
---|
| 39 | |
---|
| 40 | case ${CHEM} in |
---|
| 41 | AER) |
---|
| 42 | IGCM_comp_modifyDefFile nonblocker run.def config_inca aero |
---|
| 43 | ;; |
---|
[2442] | 44 | DUST) |
---|
| 45 | IGCM_comp_modifyDefFile nonblocker run.def config_inca aero |
---|
| 46 | ;; |
---|
[2349] | 47 | NMHC) |
---|
| 48 | IGCM_comp_modifyDefFile nonblocker run.def config_inca chem |
---|
| 49 | ;; |
---|
| 50 | NMHC_AER) |
---|
| 51 | IGCM_comp_modifyDefFile nonblocker run.def config_inca aero |
---|
| 52 | ;; |
---|
| 53 | CH4) |
---|
| 54 | IGCM_comp_modifyDefFile nonblocker run.def config_inca chem |
---|
| 55 | ;; |
---|
| 56 | CH4_AER) |
---|
| 57 | IGCM_comp_modifyDefFile nonblocker run.def config_inca aero |
---|
| 58 | ;; |
---|
| 59 | GES) |
---|
| 60 | IGCM_comp_modifyDefFile nonblocker run.def config_inca chem |
---|
| 61 | esac |
---|
| 62 | |
---|
| 63 | # inca.def : Activate reading of 10m wind in files if climatological=n in inca.card |
---|
| 64 | if [ ! X${inca_UserChoices_climatological} = X ] ; then |
---|
[2399] | 65 | IGCM_comp_modifyDefFile nonblocker inca.def climatological ${inca_UserChoices_climatological} |
---|
[2349] | 66 | else |
---|
[2399] | 67 | IGCM_comp_modifyDefFile nonblocker inca.def climatological n |
---|
[2349] | 68 | fi |
---|
| 69 | |
---|
| 70 | # inca.def : choose write frequency for inca_avgr in inca.card |
---|
| 71 | if [ ! X${inca_UserChoices_freq_write_chem} = X ] ; then |
---|
[2399] | 72 | IGCM_comp_modifyDefFile nonblocker inca.def freq_write_chem ${inca_UserChoices_freq_write_chem} |
---|
[2349] | 73 | else |
---|
[2399] | 74 | IGCM_comp_modifyDefFile nonblocker inca.def freq_write_chem 86400 |
---|
[2349] | 75 | fi |
---|
| 76 | |
---|
| 77 | #inca.def : choose aerosol effect with feedback variable |
---|
| 78 | if [ ! X${inca_UserChoices_feedb} = X ] ; then |
---|
[2399] | 79 | IGCM_comp_modifyDefFile nonblocker inca.def feedb ${inca_UserChoices_feedb} |
---|
[2349] | 80 | else |
---|
[2399] | 81 | IGCM_comp_modifyDefFile nonblocker inca.def feedb 0 |
---|
[2349] | 82 | fi |
---|
| 83 | |
---|
[2399] | 84 | #inca.def : choose output library |
---|
[2370] | 85 | if [ X${inca_UserChoices_XIOS} = Xy ] ; then |
---|
[2399] | 86 | IGCM_comp_modifyDefFile nonblocker inca.def XIOS_INCA_OK y |
---|
[2370] | 87 | else |
---|
[2399] | 88 | IGCM_comp_modifyDefFile nonblocker inca.def XIOS_INCA_OK n |
---|
[2370] | 89 | fi |
---|
| 90 | |
---|
[2399] | 91 | if [ X${inca_UserChoices_IOIPSL} = Xy ] ; then |
---|
| 92 | IGCM_comp_modifyDefFile nonblocker inca.def IOIPSL_INCA_OK y |
---|
| 93 | else |
---|
| 94 | IGCM_comp_modifyDefFile nonblocker inca.def IOIPSL_INCA_OK n |
---|
| 95 | fi |
---|
[2370] | 96 | |
---|
[2399] | 97 | |
---|
[2454] | 98 | if [ X${inca_UserChoices_wind_method} = X ] ; then |
---|
| 99 | IGCM_comp_modifyDefFile nonblocker inca.def wind_method threshold |
---|
| 100 | else |
---|
| 101 | IGCM_comp_modifyDefFile nonblocker inca.def wind_method ${inca_UserChoices_wind_method} |
---|
| 102 | fi |
---|
| 103 | |
---|
[2366] | 104 | if [ X${inca_UserChoices_XIOS} = Xy ] ; then |
---|
| 105 | # Add include of INCA context in iodef.xml |
---|
| 106 | # In iodef.xml add on next line after "COMPONENT CONTEXT" |
---|
| 107 | # <context id="inca" src="./context_inca.xml"/> |
---|
| 108 | echo '<context id="inca" src="./context_inca.xml"/>' > add.tmp |
---|
| 109 | cp iodef.xml iodef.xml.tmp |
---|
| 110 | sed -e "/COMPONENT CONTEXT/r add.tmp" \ |
---|
| 111 | iodef.xml.tmp > iodef.xml |
---|
| 112 | rm iodef.xml.tmp add.tmp |
---|
| 113 | fi |
---|
[2349] | 114 | |
---|
| 115 | IGCM_debug_PopStack "CHM_Update" |
---|
| 116 | } |
---|
| 117 | |
---|
| 118 | #----------------------------------------------------------------- |
---|
| 119 | function CHM_Finalize |
---|
| 120 | { |
---|
| 121 | IGCM_debug_PushStack "CHM_Finalize" |
---|
| 122 | |
---|
| 123 | echo FINALIZE CHM !!! |
---|
| 124 | # |
---|
| 125 | # IGCM_sys_Mkdir ${R_OUT_EXE} |
---|
| 126 | # cd ${MODIPSL} |
---|
| 127 | # tar cf src_${config_UserChoices_JobName}.tar modeles |
---|
| 128 | # IGCM_sys_Mv src_${config_UserChoices_JobName}.tar ${R_OUT_EXE}/. |
---|
| 129 | # cd - |
---|
| 130 | # |
---|
| 131 | |
---|
| 132 | IGCM_debug_PopStack "CHM_Finalize" |
---|
| 133 | } |
---|