5 if ( ! -e configure.wrf
) then
6 if ( $1 == "all_wrfvar" ) then
16 #----------------------------------
17 if ( ! $?WRF_KPP
) setenv WRF_KPP
0
18 if ( $WRF_KPP == 1 ) then
22 #---------------------------------
24 if ( ! $?dontask
&& $?prompt
) then
25 echo "This script assumes you have configured the code already."
26 echo "You only need to configure once."
27 echo "If you wish to reconfigure, type c at the prompt below"
29 echo "Ready to compile? [ync]"
32 if ( "$resp" == "c" ) then
37 if ( "$resp" == "n" ) then
44 if ( "$a" == "-h" ) then
47 if ( "$a" != "-d" ) then
48 set arglist
= ( $arglist $a )
50 if ( "$a" == "all_wrfvar" ) then
51 grep "DA_CORE=1" configure.wrf
> /dev
/null
53 # If configuration file has DA_CORE=1 hardwired, ok to set WRF_DA_CORE to 1
57 if ( "$a" == "nmm_real" ) then
58 grep "NMM_CORE=1" configure.wrf
> /dev
/null
60 # If configuration file has NMM_CORE=1 hardwired, ok to set WRF_NMM_CORE to 1
61 if ( ! $?WRF_NMM_CORE
) setenv WRF_NMM_CORE
1
64 if ( "$a" == "-j" ) then
66 setenv J
"-j $argv[1]"
71 if ( "$arglist" == "" ) then
75 setenv A2DCASE
`echo $arglist | grep 2d`
77 if ( ! ( $?WRF_EM_CORE || $?WRF_NMM_CORE \
78 || $?WRF_COAMPS_CORE || $?WRF_EXP_CORE
)) then
79 echo 'None of WRF_EM_CORE, WRF_NMM_CORE, '
80 # echo ' WRF_COAMPS_CORE, or WRF_EXP_CORE '
81 echo ' specified in shell environment.... '
84 setenv WRF_COAMPS_CORE
0
88 # these settings get passed down through the environment in the
90 if ( ! $?WRF_DA_CORE
) setenv WRF_DA_CORE
0
91 if ( ! $?WRF_EM_CORE
) setenv WRF_EM_CORE
0
92 if ( ! $?WRF_DFI_RADAR
) setenv WRF_DFI_RADAR
0
93 if ( ! $?WRF_NMM_CORE
) setenv WRF_NMM_CORE
0
94 if ( ! $?WRF_NMM_NEST
) setenv WRF_NMM_NEST
0
95 if ( ! $?WRF_COAMPS_CORE
) setenv WRF_COAMPS_CORE
0
96 if ( ! $?WRF_EXP_CORE
) setenv WRF_EXP_CORE
0
97 if ( ! $?WRF_CHEM
) setenv WRF_CHEM
0
98 if ( ! $?HWRF
) setenv HWRF
0
99 if ( ! $?WRF_CONVERT
) then
100 if ( "$arglist" == "convert_em" ) then
108 if ( ! $?DA_ARCHFLAGS
) setenv DA_ARCHFLAGS
""
110 if ( ( $WRF_DA_CORE == 1 ) && ( ! -d var
) ) then
112 echo "You need to download and untar the Var code, or"
113 echo "unset the WRF_DA_CORE env variable."
118 if ( ( $WRF_CHEM == 1 ) && ( ! -d chem
) ) then
120 echo "You need to download and untar the chem code, or"
121 echo "unset the WRF_CHEM env variable."
127 if ($WRF_NMM_CORE == 1 && $WRF_CHEM == 1 ) then
128 echo "Chemistry not yet supported in NMM core, set WRF_CHEM to 0 "
129 if ( ! -f Registry
/Registry
) then
130 echo Registry
file does not exist
133 head -2 Registry
/Registry |
tail -1 |
grep NMM_CHEM
> /dev
/null
137 set nmm_time
=`ls -1tr Registry | cat -n | grep -w 'Registry\.NMM_CHEM' | grep -v 'Registry.NMM_CHEM.' | awk '{print $1}'`
138 set rg_time
=`ls -1tr Registry | cat -n | grep -w 'Registry' | grep -v 'Registry.' | awk '{print $1}'`
139 if ( $nmm_time > $rg_time ) set overwrite
=1
142 if ( $overwrite ) then
143 echo copying Registry
/Registry.NMM_CHEM to Registry
/Registry
144 echo '## WARNING: this file is autogenerated from Registry/Registry.NMM_CHEM. Changes may be lost' > Registry
/Registry
145 /bin
/cat Registry
/Registry.NMM_CHEM
>> Registry
/Registry
151 if ($WRF_EM_CORE == 1 && $WRF_NMM_CORE == 1 ) then
152 echo "Cannot compile both EM and NMM cores in same executable yet."
155 if ($WRF_EM_CORE == 0 && $WRF_NMM_CORE == 0 && ! $WRF_CONVERT == 1 ) then
156 echo "Cannot compile because both EM and NMM cores are set to 0."
159 if ("$arglist" == 'nmm_real' && $WRF_NMM_CORE == 0) then
160 echo WRF_NMM_CORE must be
set to
1 in order to compile nmm_real
163 if (($WRF_EM_CORE == 1)&&($WRF_DA_CORE == 0 ) &&($WRF_CHEM == 0 )&&($WRF_CONVERT == 0)) then
164 if ( ! -f Registry
/Registry
) then
167 head -2 Registry
/Registry |
tail -1 |
grep EM
> /dev
/null
171 set em_time
=`ls -1tr Registry | cat -n | grep -w 'Registry\.EM' | grep -v 'Registry.EM.' | awk '{print $1}'`
172 set rg_time
=`ls -1tr Registry | cat -n | grep -w 'Registry' | grep -v 'Registry.' | awk '{print $1}'`
173 if ( $em_time > $rg_time ) set overwrite
=1
176 if ( $overwrite ) then
177 echo copying Registry
/Registry.EM to Registry
/Registry
178 echo '## WARNING: this file is autogenerated from Registry/Registry.EM. Changes may be lost' > Registry
/Registry
179 /bin
/cat Registry
/Registry.EM
>> Registry
/Registry
181 else if (($WRF_EM_CORE == 1)&&($WRF_CHEM == 1 )) then
182 if ( ! -f Registry
/Registry
) then
185 head -2 Registry
/Registry |
tail -1 |
grep EM_CHEM
> /dev
/null
189 set em_time
=`ls -1tr Registry | cat -n | grep -w 'Registry\.EM_CHEM' | grep -v 'Registry.EM_CHEM.' | awk '{print $1}'`
190 set rg_time
=`ls -1tr Registry | cat -n | grep -w 'Registry' | grep -v 'Registry.' | awk '{print $1}'`
191 if ( $em_time > $rg_time ) set overwrite
=1
194 if ( $overwrite ) then
195 echo copying Registry
/Registry.EM_CHEM to Registry
/Registry
196 echo '## WARNING: this file is autogenerated from Registry/Registry.EM_CHEM. Changes may be lost' > Registry
/Registry
197 /bin
/cat Registry
/Registry.EM_CHEM
>> Registry
/Registry
199 else if (($WRF_EM_CORE == 0)&&($WRF_CONVERT == 1 )) then
200 if ( ! -f Registry
/Registry
) then
203 head -2 Registry
/Registry |
tail -1 |
grep EM_CONVERT
> /dev
/null
207 set em_time
=`ls -1tr Registry | cat -n | grep -w 'Registry\.EM_CONVERT' | grep -v 'Registry.EM_CONVERT.' | awk '{print $1}'`
208 set rg_time
=`ls -1tr Registry | cat -n | grep -w 'Registry' | grep -v 'Registry.' | awk '{print $1}'`
209 if ( $em_time > $rg_time ) set overwrite
=1
212 if ( $overwrite ) then
213 echo copying Registry
/Registry.CONVERT to Registry
/Registry
214 echo '## WARNING: this file is autogenerated from Registry/Registry.CONVERT. Changes may be lost' > Registry
/Registry
215 /bin
/cat Registry
/Registry.CONVERT
>> Registry
/Registry
217 else if ( $WRF_DA_CORE == 1 ) then
218 if ( ! -f Registry
/Registry
) then
221 head -2 Registry
/Registry |
tail -1 |
grep WRFVAR
> /dev
/null
225 set nmm_time
=`ls -1tr Registry | cat -n | grep -w 'Registry\.NMM' | grep -v 'Registry.NMM.' | awk '{print $1}'`
226 set rg_time
=`ls -1tr Registry | cat -n | grep -w 'Registry' | grep -v 'Registry.' | awk '{print $1}'`
227 if ( $nmm_time > $rg_time ) set overwrite
=1
230 if ( $overwrite ) then
231 echo copying Registry
/Registry.wrfvar to Registry
/Registry
232 echo '## WARNING: this file is autogenerated from Registry/Registry.wrfvar. Changes may be lost' > Registry
/Registry
233 /bin
/cat Registry
/Registry.wrfvar
>> Registry
/Registry
238 echo "BUFR library will be compiled for radiance data ingest."
242 setenv CRTM_CPP
"-DCRTM"
243 setenv CRTM_LIB
"-L${CRTM} -lcrtm"
244 setenv CRTM_SRC
"-I${CRTM}/src"
253 echo "BUFR library is needed for radiance data ingest."
257 setenv RTTOV_CPP
"-DRTTOV"
258 setenv RTTOV_LIB
"-L${RTTOV} -lrttov"
259 setenv RTTOV_SRC
"-I${RTTOV}/src"
266 setenv BUFR_CPP
"-DBUFR"
267 setenv BUFR_LIB
"-L../external/bufr -lbufr"
273 setenv MADIS_CPP
"-DMADIS"
274 setenv MADIS_STATIC
${MADIS}/static
275 setenv MADIS_LIB
"-L${MADIS} -lmadis"
280 setenv DA_ARCHFLAGS
"${BUFR_CPP} ${MADIS_CPP} -DFFTPACK -DNORESHAPE"
282 if (($WRF_NMM_CORE == 1)&&($WRF_CHEM == 0 )) then
283 if ( ! -f Registry
/Registry
) then
286 head -2 Registry
/Registry |
tail -1 |
grep NMM
> /dev
/null
290 set nmm_time
=`ls -1tr Registry | cat -n | grep -w 'Registry\.NMM' | grep -v 'Registry.NMM.' | awk '{print $1}'`
291 set rg_time
=`ls -1tr Registry | cat -n | grep -w 'Registry' | grep -v 'Registry.' | awk '{print $1}'`
292 if ( $nmm_time > $rg_time ) set overwrite
=1
295 if ( $overwrite ) then
296 if (($WRF_NMM_CORE == 1)&&($WRF_NMM_NEST == 1)) then
297 echo copying Registry
/Registry.NMM_NEST to Registry
/Registry
298 echo '## WARNING: this file is autogenerated from Registry/Registry.NMM_NEST. Changes may be lost' > Registry
/Registry
299 /bin
/cat Registry
/Registry.NMM_NEST
>> Registry
/Registry
301 echo copying Registry
/Registry.NMM to Registry
/Registry
302 echo '## WARNING: this file is autogenerated from Registry/Registry.NMM. Changes may be lost' > Registry
/Registry
303 /bin
/cat Registry
/Registry.NMM
>> Registry
/Registry
306 # integrity check for a kludge where a hard coded value in the
307 # registry must match the same value in arch/preamble_new
308 set registryvalue
=`grep 'dimspec.* q ' Registry/registry.dimspec | sed -e 's/..*constant=//' -e 's/ ..*$//'`
309 set preamblevalue
=`grep 'DNMM_MAX_DIM=.*' arch/preamble_new | sed -e 's/..*-DNMM_MAX_DIM=//' -e 's/ ..*$//'`
310 if ( $registryvalue != $preamblevalue ) then
311 echo "Harded coded value of dimspec q in Registry ($registryvalue) does not"
312 echo "equal the hard coded value of NMM_MAX_DIM in arch/preamble_new ($preamblevalue)"
313 echo "Please fix and try again."
319 echo -n "Compiling: "
320 if ( $WRF_DA_CORE ) echo -n "WRF_DA_CORE "
321 if ( $WRF_EM_CORE ) echo -n "WRF_EM_CORE "
322 if ( $WRF_NMM_CORE ) echo -n "WRF_NMM_CORE "
323 if ( $WRF_COAMPS_CORE ) echo -n "WRF_COAMPS_CORE "
324 if ( $WRF_EXP_CORE ) echo -n "WRF_EXP_CORE "
328 if ( ! $?WRF_SRC_ROOT_DIR
) setenv WRF_SRC_ROOT_DIR
`pwd`
330 # new dec 2009. check to see if make supports parallel -j option
331 make -j 6 >& /dev
/null
332 if ( $status == 0 ) then
334 echo setting parallel
make -j 6
337 echo setting parallel
make $J
340 echo not setting parallel
make
343 make $arglist A2DCASE
="$A2DCASE" WRF_SRC_ROOT_DIR
="$WRF_SRC_ROOT_DIR"
354 echo ' compile [-d] [-j n] wrf compile wrf in run dir (NOTE: no real.exe, ndown.exe, or ideal.exe generated)'
356 echo ' or choose a test case (see README_test_cases for details) :'
357 foreach d
( `/bin/ls test` )
358 if ( "$d" != "CVS" ) then
363 echo ' compile -d compile without optimization and with debugging'
364 echo ' compile -j n parallel make using n tasks if supported (default 6)'
365 echo ' compile -h help message'