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

Last change on this file since 2735 was 2735, checked in by acosce, 9 years ago

Add all parameter to allow interface between orchidee and inca

File size: 5.2 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        DUSS)
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 coupled model with orchidee 
100    if [ ! X${inca_UserChoices_CoupOrchInca} = X ]; then
101        IGCM_comp_modifyDefFile nonblocker inca.def CoupOrchInca ${inca_UserChoices_CoupOrchInca}
102    else
103        IGCM_comp_modifyDefFile nonblocker inca.def CoupOrchInca n
104    fi
105
106    #inca.def : choose sedimentation schema
107    if [ ! X${inca_UserChoices_multilayer_sedim} = X ]; then
108        IGCM_comp_modifyDefFile nonblocker inca.def multilayer_sediment ${inca_UserChoices_multilayer_sedim}
109    else
110        IGCM_comp_modifyDefFile nonblocker inca.def multilayer_sediment y
111    fi
112
113    #inca.def : choose output library
114    if [  X${inca_UserChoices_XIOS} = Xy ] ; then
115        IGCM_comp_modifyDefFile nonblocker inca.def  XIOS_INCA_OK  y
116    else
117        IGCM_comp_modifyDefFile nonblocker inca.def  XIOS_INCA_OK n
118    fi
119
120    if [  X${inca_UserChoices_IOIPSL} = Xy ] ; then
121        IGCM_comp_modifyDefFile nonblocker inca.def  IOIPSL_INCA_OK  y
122    else
123        IGCM_comp_modifyDefFile nonblocker inca.def  IOIPSL_INCA_OK n
124    fi
125
126
127    if [  X${inca_UserChoices_10m_winds_method} = X ] ; then
128    IGCM_comp_modifyDefFile nonblocker inca.def  10m_winds_method  threshold
129    else
130    IGCM_comp_modifyDefFile nonblocker inca.def  10m_winds_method ${inca_UserChoices_10m_winds_method}
131    fi
132
133
134
135    if [ X${inca_UserChoices_XIOS}  = Xy ] ; then
136    # Add include of INCA context in iodef.xml
137    # In iodef.xml add on next line after "COMPONENT CONTEXT"
138    #  <context id="inca" src="./context_inca.xml"/>
139        echo '<context id="inca" src="./context_inca.xml"/>' > add.tmp
140        cp iodef.xml iodef.xml.tmp
141        sed -e "/COMPONENT CONTEXT/r add.tmp" \
142            iodef.xml.tmp > iodef.xml
143        rm iodef.xml.tmp add.tmp
144    fi
145
146    IGCM_debug_PopStack "CHM_Update"
147}
148
149#-----------------------------------------------------------------
150function CHM_Finalize
151{
152    IGCM_debug_PushStack "CHM_Finalize"
153
154    echo FINALIZE CHM !!!
155#
156#    IGCM_sys_Mkdir ${R_OUT_EXE}
157#    cd ${MODIPSL}
158#    tar cf src_${config_UserChoices_JobName}.tar  modeles
159#    IGCM_sys_Mv src_${config_UserChoices_JobName}.tar ${R_OUT_EXE}/.
160#    cd -
161#
162
163    IGCM_debug_PopStack "CHM_Finalize"
164}
Note: See TracBrowser for help on using the repository browser.