source: CONFIG/UNIFORM/v6/LMDZORINCA_v6/GENERAL/DRIVER/inca.driver @ 2696

Last change on this file since 2696 was 2696, checked in by acosce, 8 years ago

change value of config_inca if we are working with aerosols and lmdz new physics

File size: 4.6 KB
Line 
1#!/bin/ksh
2
3#D- Driver du script pour INCA
4#-----------------------------------------------------------------
5function 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#-----------------------------------------------------------------
18function 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    ##- LMDZ physics version
33    ##  Read LMDZ_Physics option in lmdz.card, if not present take default value AP (old physics)
34    if [ ! X${lmdz_UserChoices_LMDZ_Physics} = X ] ; then
35        LMDZ_Physics=${lmdz_UserChoices_LMDZ_Physics}
36    else
37        LMDZ_Physics=AP
38    fi
39    echo LMDZ physics version : ${LMDZ_Physics}
40
41    IGCM_debug_PopStack "CHM_Initialize"
42}
43
44#-----------------------------------------------------------------
45function CHM_Update
46{
47    IGCM_debug_PushStack "CHM_Update"
48
49    case ${CHEM} in
50        AER)
51            if [ X${LMDZ_Physics} = X"AP" ] ; then
52                IGCM_comp_modifyDefFile nonblocker run.def config_inca aero
53            else
54                IGCM_comp_modifyDefFile nonblocker run.def config_inca aeNP
55            fi
56        ;;
57        DUST)
58            if [ X${LMDZ_Physics} = X"AP" ] ; then
59                IGCM_comp_modifyDefFile nonblocker run.def config_inca aero
60            else
61                IGCM_comp_modifyDefFile nonblocker run.def config_inca aeNP
62            fi
63        ;;
64        NMHC) 
65        IGCM_comp_modifyDefFile nonblocker run.def config_inca chem
66        ;;
67        NMHC_AER)
68            if [ X${LMDZ_Physics} = X"AP" ] ; then
69                IGCM_comp_modifyDefFile nonblocker run.def config_inca aero
70            else
71                IGCM_comp_modifyDefFile nonblocker run.def config_inca aeNP
72            fi
73        ;;
74        GES)
75        IGCM_comp_modifyDefFile nonblocker run.def config_inca chem
76        esac
77
78    # inca.def : Activate reading of 10m wind in files if LMDZ_10m_winds=n in inca.card
79    if [ ! X${inca_UserChoices_LMDZ_10m_winds} = X ] ; then
80        IGCM_comp_modifyDefFile nonblocker inca.def LMDZ_10m_winds  ${inca_UserChoices_LMDZ_10m_winds}
81    else
82        IGCM_comp_modifyDefFile nonblocker inca.def LMDZ_10m_winds  n
83    fi
84
85    # inca.def : choose write frequency for inca_avgr in inca.card
86    if [ ! X${inca_UserChoices_freq_write_chem} = X ] ; then
87        IGCM_comp_modifyDefFile nonblocker inca.def freq_write_chem  ${inca_UserChoices_freq_write_chem}
88    else
89        IGCM_comp_modifyDefFile nonblocker inca.def  freq_write_chem  86400
90    fi
91
92    #inca.def : choose aerosol effect with feedback variable
93    if [ ! X${inca_UserChoices_feedb} = X ] ; then
94        IGCM_comp_modifyDefFile nonblocker inca.def  feedb  ${inca_UserChoices_feedb}
95    else
96        IGCM_comp_modifyDefFile nonblocker inca.def feedb  0
97    fi
98   
99    #inca.def : choose output library
100    if [  X${inca_UserChoices_XIOS} = Xy ] ; then
101        IGCM_comp_modifyDefFile nonblocker inca.def  XIOS_INCA_OK  y
102    else
103        IGCM_comp_modifyDefFile nonblocker inca.def  XIOS_INCA_OK n
104    fi
105
106    if [  X${inca_UserChoices_IOIPSL} = Xy ] ; then
107        IGCM_comp_modifyDefFile nonblocker inca.def  IOIPSL_INCA_OK  y
108    else
109        IGCM_comp_modifyDefFile nonblocker inca.def  IOIPSL_INCA_OK n
110    fi
111
112
113    if [  X${inca_UserChoices_10m_winds_method} = X ] ; then
114    IGCM_comp_modifyDefFile nonblocker inca.def  10m_winds_method  threshold
115    else
116    IGCM_comp_modifyDefFile nonblocker inca.def  10m_winds_method ${inca_UserChoices_10m_winds_method}
117    fi
118
119
120
121    if [ X${inca_UserChoices_XIOS}  = Xy ] ; then
122    # Add include of INCA context in iodef.xml
123    # In iodef.xml add on next line after "COMPONENT CONTEXT"
124    #  <context id="inca" src="./context_inca.xml"/>
125        echo '<context id="inca" src="./context_inca.xml"/>' > add.tmp
126        cp iodef.xml iodef.xml.tmp
127        sed -e "/COMPONENT CONTEXT/r add.tmp" \
128            iodef.xml.tmp > iodef.xml
129        rm iodef.xml.tmp add.tmp
130    fi
131
132    IGCM_debug_PopStack "CHM_Update"
133}
134
135#-----------------------------------------------------------------
136function CHM_Finalize
137{
138    IGCM_debug_PushStack "CHM_Finalize"
139
140    echo FINALIZE CHM !!!
141#
142#    IGCM_sys_Mkdir ${R_OUT_EXE}
143#    cd ${MODIPSL}
144#    tar cf src_${config_UserChoices_JobName}.tar  modeles
145#    IGCM_sys_Mv src_${config_UserChoices_JobName}.tar ${R_OUT_EXE}/.
146#    cd -
147#
148
149    IGCM_debug_PopStack "CHM_Finalize"
150}
Note: See TracBrowser for help on using the repository browser.