4 echo "===================================================="
5 echo starting compile_wkc
10 setenv WKC_HOME
${WRFC_ROOT}/chem
/${WKC_DIRNAME}
14 # KPP_HOME: environment variable needed by KPP
15 # note: this is not plain KPP
16 setenv KPP_HOME
${WKC_HOME}/kpp
/kpp-2.1
17 mkdir
-p ${KPP_HOME}/bin
18 setenv WKC_KPP
${KPP_HOME}/bin
/kpp
21 #write Makefile_kpp.defs
22 rm -f ${WKC_HOME}/configure.kpp
23 ${WKC_HOME}/configure_kpp
26 rm -f ${KPP_HOME}/Makefile.defs
27 ln -s ${WKC_HOME}/configure.kpp
${KPP_HOME}/Makefile.defs
31 if (! -e chem
/Makefile_org
) then
32 cp chem
/Makefile chem
/Makefile_org
35 if ( ! -e chem
/module_wkppc_constants.F
) then
36 ln -s ${WKC_DIRNAME}/module_wkppc_constants.F chem
42 cd $KPP_HOME; make; cd $WRFC_ROOT
44 echo "-----------------------------------------"
47 ( cd $WKC_HOME/util
/wkc
; .
/linker.csh unlink
)
49 ( cd $WKC_HOME/util
/wkc
; .
/linker.csh link
)
52 echo compile the coupler
53 cd $WKC_HOME/util
/wkc
; make -i -r
56 echo compile the tuv_kpp
59 echo "-----------------------------------------"
61 # if Registry was edited touch run_wkc
62 echo check
if Registry was touched
63 cd $WKC_HOME/util
; make
65 echo "-----------------------------------------"
66 echo "Run kpp for mechanisms in chem/KPP/mechanisms"
70 # run make (-> kpp) in each subdir
73 set kpp_files
= ( mechanisms
/*/*.kpp
)
75 # Remove tuv inc files
77 if ( -e ${WRFC_ROOT}/inc
/tuv2wrf_jvals.inc
) then
78 rm -f ${WRFC_ROOT}/inc
/tuv2wrf_jvals.inc
;
80 if ( -e ${WRFC_ROOT}/inc
/tuvdef_jvals.inc
) then
81 rm -f ${WRFC_ROOT}/inc
/tuvdef_jvals.inc
;
84 foreach
file ( $kpp_files )
86 echo "========================================================="
88 set kdir
= `echo $file:h`
89 set kfile
= `echo $file:t`
92 if (! -e $kdir/Makefile
) then
94 echo ln -s ..
/..
/util
/Makefile_kpp
$kdir/Makefile
95 ln -s ..
/..
/util
/Makefile_kpp
$kdir/Makefile
99 set model
= `echo $kfile | sed 's/.kpp//g'`
105 # if necessary, create a few .inc files in chem/KPP/inc
106 # which can be used to add code in the automatically
107 # generated files module_kpp_xxx_interface.f
108 # these files will not be removed during cleanup!!!
110 util
/create_inc_files.csh
$model
116 make MODEL
=$model KPP
=$WKC_KPP WRFC_ROOT
=$WRFC_ROOT
118 # generate tuv photolysis inc files
119 if( -e $model.tuv.jmap
) then
120 if( $found == 0 ) then
121 $WKC_HOME/util
/wkc
/tuv_kpp FIRST
124 $WKC_HOME/util
/wkc
/tuv_kpp
$model
127 if ( `echo $WRFC_ROOT | awk '{print ( length ( $1 ) > 40 ) }' `) then
128 echo WARNING
: If kpp fails here the path to WRF-Chem might be too long
for yacc ...
134 # direct addressing in the decomp subroutine (similar to a code by
135 # Edwin Spee, CWI, Amsterdam)
136 ( cd ${WKC_HOME}/util
/write_decomp
; .
/write_decom.csh
${model} ..
/..
/..
)
140 # finish tuv photolysis inc files
141 if( $found == 1 ) then
142 $WKC_HOME/util
/wkc
/tuv_kpp LAST
145 echo "========================================================="
147 ###################################################
149 # link the remaining .inc files in chem/KPP/inc
150 set kincfiles
= ( inc
/*.inc
)
152 foreach kincfile
( $kincfiles )
154 if ( ! -e ${WRFC_ROOT}/${kincfile} ) then
155 echo ln -s ..
/chem
/${WKC_DIRNAME}/${kincfile} ${WRFC_ROOT}/inc
156 ln -s ..
/chem
/${WKC_DIRNAME}/${kincfile} ${WRFC_ROOT}/inc
163 ###################################################
166 if ( -e util
/run_wkc
) then
168 echo "RUN WRF-Chem KPP coupler ---------------------------"
172 chem
/KPP
/util
/wkc
/registry_kpp
-DDA_CORE=0 -DEM_CORE=1 -DBUILD_CHEM=1 Registry
/Registry.EM_CHEM
182 echo "ERROR on exit KPP coupler"
187 echo " back from KPP coupler: check generated code in chem directory"
193 echo " not running the WRF-Chem KPP coupler"
199 echo end of compile_wkc
200 echo "========================================================="