5 if ( ! -e configure.wrf
) then
11 #----------------------------------
12 if ( ! $?WRF_KPP
) setenv WRF_KPP
0
13 if ( $WRF_KPP == 1 ) then
20 #---------------------------------
22 if ( ! $?dontask
&& $?prompt
) then
23 echo "This script assumes you have configured the code already."
24 echo "You only need to configure once."
25 echo "If you wish to reconfigure, type c at the prompt below"
27 echo "Ready to compile? [ync]"
30 if ( "$resp" == "c" ) then
35 if ( "$resp" == "n" ) then
42 if ( "$a" == "-h" ) then
45 if ( "$a" != "-d" ) then
46 set arglist
= ( $arglist $a )
48 if ( "$a" == "all_wrfvar" ) then
49 grep "DA_CORE=1" configure.wrf
> /dev
/null
51 # If configuration file has DA_CORE=1 hardwired, ok to set WRF_DA_CORE to 1
52 if ( ! $?WRF_DA_CORE
) setenv WRF_DA_CORE
1
56 echo "You need to download and untar the WRF DA code"
61 if ( "$a" == "nmm_real" ) then
62 grep "NMM_CORE=1" configure.wrf
> /dev
/null
64 # If configuration file has NMM_CORE=1 hardwired, ok to set WRF_NMM_CORE to 1
65 if ( ! $?WRF_NMM_CORE
) setenv WRF_NMM_CORE
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_NMM_CORE
) setenv WRF_NMM_CORE
0
93 if ( ! $?WRF_NMM_NEST
) setenv WRF_NMM_NEST
0
94 if ( ! $?WRF_COAMPS_CORE
) setenv WRF_COAMPS_CORE
0
95 if ( ! $?WRF_EXP_CORE
) setenv WRF_EXP_CORE
0
96 if ( ! $?WRF_CHEM
) setenv WRF_CHEM
0
97 if ( ! $?WRF_CONVERT
) then
98 if ( "$arglist" == "convert_em" ) then
106 if ( ! $?DA_ARCHFLAGS
) setenv DA_ARCHFLAGS
""
108 if ( ( $WRF_DA_CORE == 1 ) && ( ! -d var
) ) then
110 echo "You need to download and untar the Var code, or"
111 echo "unset the WRF_DA_CORE env variable."
116 if ( ( $WRF_CHEM == 1 ) && ( ! -d chem
) ) then
118 echo "You need to download and untar the chem code, or"
119 echo "unset the WRF_CHEM env variable."
125 if ($WRF_NMM_CORE == 1 && $WRF_CHEM == 1 ) then
126 echo "Chemistry not yet supported in NMM core, set WRF_CHEM to 0 "
127 if ( ! -f Registry
/Registry
) then
128 echo Registry
file does not exist
131 head -2 Registry
/Registry |
tail -1 |
grep NMM_CHEM
> /dev
/null
135 set nmm_time
=`ls -1tr Registry | cat -n | grep -w 'Registry\.NMM_CHEM' | grep -v 'Registry.NMM_CHEM.' | awk '{print $1}'`
136 set rg_time
=`ls -1tr Registry | cat -n | grep -w 'Registry' | grep -v 'Registry.' | awk '{print $1}'`
137 if ( $nmm_time > $rg_time ) set overwrite
=1
140 if ( $overwrite ) then
141 echo copying Registry
/Registry.NMM_CHEM to Registry
/Registry
142 echo '## WARNING: this file is autogenerated from Registry/Registry.NMM_CHEM. Changes may be lost' > Registry
/Registry
143 /bin
/cat Registry
/Registry.NMM_CHEM
>> Registry
/Registry
149 if ($WRF_EM_CORE == 1 && $WRF_NMM_CORE == 1 ) then
150 echo "Cannot compile both EM and NMM cores in same executable yet."
153 if ($WRF_EM_CORE == 0 && $WRF_NMM_CORE == 0 && ! $WRF_CONVERT == 1 ) then
154 echo "Cannot compile because both EM and NMM cores are set to 0."
157 if ($arglist == 'nmm_real' && $WRF_NMM_CORE == 0) then
158 echo WRF_NMM_CORE must be
set to
1 in order to compile nmm_real
161 if (($WRF_EM_CORE == 1)&&($WRF_DA_CORE == 0 ) &&($WRF_CHEM == 0 )&&($WRF_CONVERT == 0)) then
162 if ( ! -f Registry
/Registry
) then
165 head -2 Registry
/Registry |
tail -1 |
grep EM
> /dev
/null
169 set em_time
=`ls -1tr Registry | cat -n | grep -w 'Registry\.EM' | grep -v 'Registry.EM.' | awk '{print $1}'`
170 set rg_time
=`ls -1tr Registry | cat -n | grep -w 'Registry' | grep -v 'Registry.' | awk '{print $1}'`
171 if ( $em_time > $rg_time ) set overwrite
=1
174 if ( $overwrite ) then
175 echo copying Registry
/Registry.EM to Registry
/Registry
176 echo '## WARNING: this file is autogenerated from Registry/Registry.EM. Changes may be lost' > Registry
/Registry
177 /bin
/cat Registry
/Registry.EM
>> Registry
/Registry
179 else if (($WRF_EM_CORE == 1)&&($WRF_CHEM == 1 )) then
180 if ( ! -f Registry
/Registry
) then
183 head -2 Registry
/Registry |
tail -1 |
grep EM_CHEM
> /dev
/null
187 set em_time
=`ls -1tr Registry | cat -n | grep -w 'Registry\.EM_CHEM' | grep -v 'Registry.EM_CHEM.' | awk '{print $1}'`
188 set rg_time
=`ls -1tr Registry | cat -n | grep -w 'Registry' | grep -v 'Registry.' | awk '{print $1}'`
189 if ( $em_time > $rg_time ) set overwrite
=1
192 if ( $overwrite ) then
193 echo copying Registry
/Registry.EM_CHEM to Registry
/Registry
194 echo '## WARNING: this file is autogenerated from Registry/Registry.EM_CHEM. Changes may be lost' > Registry
/Registry
195 /bin
/cat Registry
/Registry.EM_CHEM
>> Registry
/Registry
197 else if (($WRF_EM_CORE == 0)&&($WRF_CONVERT == 1 )) then
198 if ( ! -f Registry
/Registry
) then
201 head -2 Registry
/Registry |
tail -1 |
grep EM_CONVERT
> /dev
/null
205 set em_time
=`ls -1tr Registry | cat -n | grep -w 'Registry\.EM_CONVERT' | grep -v 'Registry.EM_CONVERT.' | awk '{print $1}'`
206 set rg_time
=`ls -1tr Registry | cat -n | grep -w 'Registry' | grep -v 'Registry.' | awk '{print $1}'`
207 if ( $em_time > $rg_time ) set overwrite
=1
210 if ( $overwrite ) then
211 echo copying Registry
/Registry.CONVERT to Registry
/Registry
212 echo '## WARNING: this file is autogenerated from Registry/Registry.CONVERT. Changes may be lost' > Registry
/Registry
213 /bin
/cat Registry
/Registry.CONVERT
>> Registry
/Registry
215 else if ( $WRF_DA_CORE == 1 ) then
216 if ( ! -f Registry
/Registry
) then
219 head -2 Registry
/Registry |
tail -1 |
grep WRFVAR
> /dev
/null
223 set nmm_time
=`ls -1tr Registry | cat -n | grep -w 'Registry\.NMM' | grep -v 'Registry.NMM.' | awk '{print $1}'`
224 set rg_time
=`ls -1tr Registry | cat -n | grep -w 'Registry' | grep -v 'Registry.' | awk '{print $1}'`
225 if ( $nmm_time > $rg_time ) set overwrite
=1
228 if ( $overwrite ) then
229 echo copying Registry
/Registry.wrfvar to Registry
/Registry
230 echo '## WARNING: this file is autogenerated from Registry/Registry.wrfvar. Changes may be lost' > Registry
/Registry
231 /bin
/cat Registry
/Registry.wrfvar
>> Registry
/Registry
232 setenv DA_ARCHFLAGS
"-DBUFR -DFFTPACK -DPROMOTE_FLOAT -DNONSTANDARD_SYSTEM -DNORESHAPE"
235 if (($WRF_NMM_CORE == 1)&&($WRF_CHEM == 0 )) then
236 if ( ! -f Registry
/Registry
) then
239 head -2 Registry
/Registry |
tail -1 |
grep NMM
> /dev
/null
243 set nmm_time
=`ls -1tr Registry | cat -n | grep -w 'Registry\.NMM' | grep -v 'Registry.NMM.' | awk '{print $1}'`
244 set rg_time
=`ls -1tr Registry | cat -n | grep -w 'Registry' | grep -v 'Registry.' | awk '{print $1}'`
245 if ( $nmm_time > $rg_time ) set overwrite
=1
248 if ( $overwrite ) then
249 if (($WRF_NMM_CORE == 1)&&($WRF_NMM_NEST == 1)) then
250 echo copying Registry
/Registry.NMM_NEST to Registry
/Registry
251 echo '## WARNING: this file is autogenerated from Registry/Registry.NMM_NEST. Changes may be lost' > Registry
/Registry
252 /bin
/cat Registry
/Registry.NMM_NEST
>> Registry
/Registry
254 echo copying Registry
/Registry.NMM to Registry
/Registry
255 echo '## WARNING: this file is autogenerated from Registry/Registry.NMM. Changes may be lost' > Registry
/Registry
256 /bin
/cat Registry
/Registry.NMM
>> Registry
/Registry
259 # integrity check for a kludge where a hard coded value in the
260 # registry must match the same value in arch/preamble_new
261 set registryvalue
=`grep 'dimspec.* q ' Registry/Registry.NMM | sed -e 's/..*constant=//' -e 's/ ..*$//'`
262 set preamblevalue
=`grep 'DNMM_MAX_DIM=.*' arch/preamble_new | sed -e 's/..*-DNMM_MAX_DIM=//' -e 's/ ..*$//'`
263 if ( $registryvalue != $preamblevalue ) then
264 echo "Harded coded value of dimspec q in Registry ($registryvalue) does not"
265 echo "equal the hard coded value of NMM_MAX_DIM in arch/preamble_new ($preamblevalue)"
266 echo "Please fix and try again."
272 echo -n "**** Compiling: "
273 if ( $WRF_DA_CORE ) echo -n "WRF_DA_CORE "
274 if ( $WRF_EM_CORE ) echo -n "WRF_EM_CORE "
275 if ( $WRF_NMM_CORE ) echo -n "WRF_NMM_CORE "
276 if ( $WRF_COAMPS_CORE ) echo -n "WRF_COAMPS_CORE "
277 if ( $WRF_EXP_CORE ) echo -n "WRF_EXP_CORE "
281 if ( ! $?WRF_SRC_ROOT_DIR
) setenv WRF_SRC_ROOT_DIR
`pwd`
282 make $arglist A2DCASE
="$A2DCASE" WRF_SRC_ROOT_DIR
="$WRF_SRC_ROOT_DIR"
293 echo ' compile wrf compile wrf in run dir (NOTE: no real.exe, ndown.exe, or ideal.exe generated)'
295 echo ' or choose a test case (see README_test_cases for details) :'
296 foreach d
( `/bin/ls test` )
297 if ( "$d" != "CVS" ) then
302 echo ' compile -h help message'