standard WRF version 3.0.1.1
[wrffire.git] / wrfv2_fire / arch / Config_new.pl
blob3f09e3d13a80d1117ccb6ae4fe2ddfab9a6fda44
1 #!/usr/bin/perl
3 # Configuration script for WRF prototype code
4 #
5 # Be sure to run as ./configure (to avoid getting a system configure command by mistake)
8 $sw_perl_path = perl ;
9 $sw_netcdf_path = "" ;
10 $sw_pnetcdf_path = "" ;
11 $sw_phdf5_path="";
12 $sw_jasperlib_path="";
13 $sw_jasperinc_path="";
14 $sw_esmflib_path="";
15 $sw_esmfinc_path="";
16 $sw_ldflags="";
17 $sw_compileflags="";
18 $sw_opt_level="";
19 $sw_rwordsize="\$\(NATIVE_RWORDSIZE\)";
20 $sw_rttov_flag = "" ;
21 $sw_rttov_inc = "" ;
22 $sw_crtm_flag = "" ;
23 $sw_crtm_inc = "" ;
24 $WRFCHEM = 0 ;
25 $sw_os = "ARCH" ; # ARCH will match any
26 $sw_mach = "ARCH" ; # ARCH will match any
27 $sw_wrf_core = "" ;
28 $sw_da_core = "-DDA_CORE=\$\(WRF_DA_CORE\)" ;
29 $sw_nmm_core = "-DNMM_CORE=\$\(WRF_NMM_CORE\)" ;
30 $sw_em_core = "-DEM_CORE=\$\(WRF_EM_CORE\)" ;
31 $sw_exp_core = "-DEXP_CORE=\$\(WRF_EXP_CORE\)" ;
32 $sw_coamps_core = "-DCOAMPS_CORE=\$\(WRF_COAMPS_CORE\)" ;
33 $sw_dmparallel = "" ;
34 $sw_ompparallel = "" ;
35 $sw_stubmpi = "" ;
36 $sw_usenetcdff = "" ; # for 3.6.2 and greater, the fortran bindings might be in a separate lib file
37 $sw_time = "" ; # name of a timer to time fortran compiles, e.g. timex or time
38 $sw_ifort_r8 = 0 ;
40 while ( substr( $ARGV[0], 0, 1 ) eq "-" )
42 if ( substr( $ARGV[0], 1, 5 ) eq "perl=" )
44 $sw_perl_path = substr( $ARGV[0], 6 ) ;
46 if ( substr( $ARGV[0], 1, 7 ) eq "netcdf=" )
48 $sw_netcdf_path = substr( $ARGV[0], 8 ) ;
50 if ( substr( $ARGV[0], 1, 8 ) eq "pnetcdf=" )
52 $sw_pnetcdf_path = substr( $ARGV[0], 9 ) ;
54 if ( substr( $ARGV[0], 1, 6 ) eq "phdf5=" )
56 $sw_phdf5_path = substr( $ARGV[0], 7 ) ;
58 if ( substr( $ARGV[0], 1, 3 ) eq "os=" )
60 $sw_os = substr( $ARGV[0], 4 ) ;
62 if ( substr( $ARGV[0], 1, 5 ) eq "mach=" )
64 $sw_mach = substr( $ARGV[0], 6 ) ;
66 if ( substr( $ARGV[0], 1, 10 ) eq "opt_level=" )
68 $sw_opt_level = substr( $ARGV[0], 11 ) ;
70 if ( substr( $ARGV[0], 1, 11 ) eq "USENETCDFF=" )
72 $sw_usenetcdff = substr( $ARGV[0], 12 ) ;
74 if ( substr( $ARGV[0], 1, 5 ) eq "time=" )
76 $sw_time = substr( $ARGV[0], 6 ) ;
78 if ( substr( $ARGV[0], 1, 8 ) eq "ldflags=" )
80 $sw_ldflags = substr( $ARGV[0], 9 ) ;
81 # multiple options separated by spaces are passed in from sh script
82 # separated by ! instead. Replace with spaces here.
83 $sw_ldflags =~ s/!/ /g ;
85 if ( substr( $ARGV[0], 1, 9 ) eq "wrf_core=" )
87 $sw_wrf_core = substr( $ARGV[0], 10 ) ;
88 if ( index ( $sw_wrf_core , "EM_CORE" ) > -1 )
90 $sw_em_core = "-DEM_CORE=1" ;
91 $sw_da_core = "-DDA_CORE=0" ;
92 $sw_nmm_core = "-DNMM_CORE=0" ;
93 $sw_exp_core = "-DEXP_CORE=0" ;
94 $sw_coamps_core = "-DCOAMPS_CORE=0" ;
96 if ( index ( $sw_wrf_core , "DA_CORE" ) > -1 )
98 $sw_em_core = "-DEM_CORE=1" ;
99 $sw_da_core = "-DDA_CORE=1" ;
100 $sw_nmm_core = "-DNMM_CORE=0" ;
101 $sw_exp_core = "-DEXP_CORE=0" ;
102 $sw_coamps_core = "-DCOAMPS_CORE=0" ;
104 if ( index ( $sw_wrf_core , "NMM_CORE" ) > -1 )
106 $sw_em_core = "-DEM_CORE=0" ;
107 $sw_da_core = "-DDA_CORE=0" ;
108 $sw_nmm_core = "-DNMM_CORE=1" ;
109 $sw_exp_core = "-DEXP_CORE=0" ;
110 $sw_coamps_core = "-DCOAMPS_CORE=0" ;
112 if ( index ( $sw_wrf_core , "EXP_CORE" ) > -1 )
114 $sw_em_core = "-DEM_CORE=0" ;
115 $sw_da_core = "-DDA_CORE=0" ;
116 $sw_nmm_core = "-DNMM_CORE=0" ;
117 $sw_exp_core = "-DEXP_CORE=1" ;
118 $sw_coamps_core = "-DCOAMPS_CORE=0" ;
120 if ( index ( $sw_wrf_core , "COAMPS_CORE" ) > -1 )
122 $sw_em_core = "-DEM_CORE=0" ;
123 $sw_da_core = "-DDA_CORE=0" ;
124 $sw_nmm_core = "-DNMM_CORE=0" ;
125 $sw_exp_core = "-DEXP_CORE=0" ;
126 $sw_coamps_core = "-DCOAMPS_CORE=1" ;
129 if ( substr( $ARGV[0], 1, 13 ) eq "compileflags=" )
131 $sw_compileflags = substr( $ARGV[0], 14 ) ;
132 $sw_compileflags =~ s/!/ /g ;
133 # look for each known option
134 $where_index = index ( $sw_compileflags , "-DWRF_CHEM" ) ;
135 if ( $where_index eq -1 )
137 $WRFCHEM = 0 ;
139 else
141 $WRFCHEM = 1 ;
144 if ( substr( $ARGV[0], 1, 11 ) eq "dmparallel=" )
146 $sw_dmparallel=substr( $ARGV[0], 12 ) ;
148 if ( substr( $ARGV[0], 1, 12 ) eq "ompparallel=" )
150 $sw_ompparallel=substr( $ARGV[0], 13 ) ;
152 shift @ARGV ;
155 $sw_fc = "\$(SFC)" ;
156 $sw_cc = "\$(SCC)" ;
157 $sw_comms_lib = "" ;
158 $sw_comms_include = "" ;
159 $sw_dmparallelflag = "" ;
160 $sw_nest_opt = "" ;
161 $sw_comms_external = "gen_comms_serial module_dm_serial" ;
163 if ( $sw_dmparallel eq "RSL_LITE" )
165 $sw_fc = "\$(DM_FC)" ;
166 $sw_cc = "\$(DM_CC)" ;
167 $sw_dmparallelflag = "-DDM_PARALLEL" ;
168 $sw_comms_lib = "\$(WRF_SRC_ROOT_DIR)/external/RSL_LITE/librsl_lite.a" ;
169 $sw_comms_external = "\$(WRF_SRC_ROOT_DIR)/external/RSL_LITE/librsl_lite.a gen_comms_rsllite module_dm_rsllite" ;
170 $sw_comms_include = "-I\$(WRF_SRC_ROOT_DIR)/external/RSL_LITE" ;
173 # The jasper library is required to build Grib2 I/O. User must set
174 # environment variables JASPERLIB and JASPERINC to paths to library and
175 # include files to enable this feature prior to running configure.
176 if ( $ENV{JASPERLIB} && $ENV{JASPERINC} )
178 printf "Configuring to use jasper library to build Grib2 I/O...\n" ;
179 printf(" \$JASPERLIB = %s\n",$ENV{JASPERLIB});
180 printf(" \$JASPERINC = %s\n",$ENV{JASPERINC});
181 $sw_jasperlib_path = $ENV{JASPERLIB};
182 $sw_jasperinc_path = $ENV{JASPERINC};
184 else
186 printf "\$JASPERLIB or \$JASPERINC not found in environment, configuring to build without grib2 I/O...\n" ;
189 # When compiling DA code, we need to always use 8-byte reals.
190 if ( $ENV{WRF_DA_CORE} eq "1" || $sw_da_core eq "-DDA_CORE=1" )
192 $sw_rwordsize = "8";
193 if ( $ENV{CRTM} )
195 $sw_crtm_flag = "-DCRTM";
196 $sw_crtm_inc = "-I$ENV{CRTM}/src";
198 if ( $ENV{RTTOV} )
200 $sw_rttov_flag = "-DRTTOV";
201 $sw_rttov_inc = "-I$ENV{RTTOV}/src";
205 # A separately-installed ESMF library is required to build the ESMF
206 # implementation of WRF IOAPI in external/io_esmf. This is needed
207 # to couple WRF with other ESMF components. User must set environment
208 # variables ESMFLIB and ESMFINC to paths ESMF to library and include
209 # files to enable this feature prior to running configure.
210 if ( $ENV{ESMFLIB} && $ENV{ESMFINC} )
212 printf "Configuring to use ESMF library to build WRF...\n" ;
213 printf "WARNING-WARNING-WARNING-WARNING-WARNING-WARNING-WARNING-WARNING\n" ;
214 printf "WARNING: THIS IS AN EXPERIMENTAL CONFIGURATION\n" ;
215 printf "WARNING: IT DOES NOT WORK WITH NESTING\n" ;
216 printf "WARNING-WARNING-WARNING-WARNING-WARNING-WARNING-WARNING-WARNING\n" ;
217 printf(" \$ESMFLIB = %s\n",$ENV{ESMFLIB});
218 printf(" \$ESMFINC = %s\n",$ENV{ESMFINC});
219 $sw_esmflib_path = $ENV{ESMFLIB};
220 $sw_esmfinc_path = $ENV{ESMFINC};
221 $sw_esmf_ldflag = "yes" ;
224 # parse the configure.wrf file
226 $validresponse = 0 ;
228 # Display the choices to the user and get selection
229 until ( $validresponse ) {
230 printf "------------------------------------------------------------------------\n" ;
231 printf "Please select from among the following supported platforms.\n\n" ;
233 $opt = 1 ;
234 open CONFIGURE_DEFAULTS, "< ./arch/configure_new.defaults"
235 or die "Cannot open ./arch/configure_new.defaults for reading" ;
236 while ( <CONFIGURE_DEFAULTS> )
238 for $paropt ( 'serial','smpar','dmpar','dm+sm' )
240 if ( substr( $_, 0, 5 ) eq "#ARCH"
241 && ( index( $_, $sw_os ) >= 0 ) && ( index( $_, $sw_mach ) >= 0 )
242 && ( index($_, $paropt) >= 0 ) )
244 $optstr[$opt] = substr($_,6) ;
245 $optstr[$opt] =~ s/^[ ]*// ;
246 $optstr[$opt] =~ s/#.*$//g ;
247 chomp($optstr[$opt]) ;
248 $optstr[$opt] = $optstr[$opt]." (".$paropt.")" ;
249 if ( substr( $optstr[$opt], 0,4 ) ne "NULL" )
251 printf " %2d. %s\n",$opt,$optstr[$opt] ;
252 $opt++ ;
257 close CONFIGURE_DEFAULTS ;
259 $opt -- ;
261 printf "\nEnter selection [%d-%d] : ",1,$opt ;
262 $response = <STDIN> ;
264 if ( $response == -1 ) { exit ; }
266 if ( $response >= 1 && $response <= $opt )
267 { $validresponse = 1 ; }
268 else
269 { printf("\nInvalid response (%d)\n",$response);}
271 printf "------------------------------------------------------------------------\n" ;
273 $optchoice = $response ;
275 open CONFIGURE_DEFAULTS, "cat ./arch/configure_new.defaults |" ;
276 $latchon = 0 ;
277 while ( <CONFIGURE_DEFAULTS> )
279 if ( substr( $_, 0, 5 ) eq "#ARCH" && $latchon == 1 )
281 close CONFIGURE_DEFAULTS ;
282 if ( $sw_opt_level eq "-f" ) {
283 open CONFIGURE_DEFAULTS, "cat ./arch/postamble_new ./arch/noopt_exceptions_f |" or die "horribly" ;
284 } else {
285 open CONFIGURE_DEFAULTS, "cat ./arch/postamble_new ./arch/noopt_exceptions |" or die "horribly" ;
288 if ( $latchon == 1 )
290 $_ =~ s/CONFIGURE_PERL_PATH/$sw_perl_path/g ;
291 $_ =~ s/CONFIGURE_NETCDF_PATH/$sw_netcdf_path/g ;
292 $_ =~ s/CONFIGURE_PNETCDF_PATH/$sw_pnetcdf_path/g ;
293 $_ =~ s/CONFIGURE_PHDF5_PATH/$sw_phdf5_path/g ;
294 $_ =~ s/CONFIGURE_LDFLAGS/$sw_ldflags/g ;
295 $_ =~ s/CONFIGURE_COMPILEFLAGS/$sw_compileflags/g ;
296 $_ =~ s/CONFIGURE_RWORDSIZE/$sw_rwordsize/g ;
297 $_ =~ s/CONFIGURE_FC/$sw_time $sw_fc/g ;
298 $_ =~ s/CONFIGURE_CC/$sw_cc/g ;
299 $_ =~ s/CONFIGURE_COMMS_LIB/$sw_comms_lib/g ;
300 $_ =~ s/CONFIGURE_COMMS_INCLUDE/$sw_comms_include/g ;
301 $_ =~ s/CONFIGURE_COMMS_EXTERNAL/$sw_comms_external/g ;
302 $_ =~ s/CONFIGURE_DMPARALLEL/$sw_dmparallelflag/g ;
303 $_ =~ s/CONFIGURE_STUBMPI/$sw_stubmpi/g ;
304 $_ =~ s/CONFIGURE_NESTOPT/$sw_nest_opt/g ;
305 $_ =~ s/CONFIGURE_CRTM_FLAG/$sw_crtm_flag/g ;
306 $_ =~ s/CONFIGURE_CRTM_INC/$sw_crtm_inc/g ;
307 $_ =~ s/CONFIGURE_RTTOV_FLAG/$sw_rttov_flag/g ;
308 $_ =~ s/CONFIGURE_RTTOV_INC/$sw_rttov_inc/g ;
309 if ( $sw_ifort_r8 ) {
310 $_ =~ s/^PROMOTION.*=/PROMOTION = -r8 /g ;
312 if ( $sw_dmparallel ne "" && ($_ =~ /^DMPARALLEL[=\t ]/) ) {
313 $_ =~ s/#// ;
315 if ( $sw_ompparallel ne "" && ( $_ =~ /^OMPCPP[=\t ]/ || $_ =~ /^OMP[=\t ]/ ) ) {
316 $_ =~ s/#// ;
317 $_ =~ s/#// ;
319 if ( $sw_netcdf_path )
320 { $_ =~ s/CONFIGURE_WRFIO_NF/wrfio_nf/g ;
321 $_ =~ s:CONFIGURE_NETCDF_FLAG:-DNETCDF: ;
322 if ( $sw_os == Interix ) {
323 $_ =~ s:CONFIGURE_NETCDF_LIB_PATH:\$\(WRF_SRC_ROOT_DIR\)/external/io_netcdf/libwrfio_nf.a -L$sw_netcdf_path/lib -lnetcdf $sw_usenetcdff : ;
324 } else {
325 $_ =~ s:CONFIGURE_NETCDF_LIB_PATH:-L\$\(WRF_SRC_ROOT_DIR\)/external/io_netcdf -lwrfio_nf -L$sw_netcdf_path/lib -lnetcdf $sw_usenetcdff : ;
328 else
329 { $_ =~ s/CONFIGURE_WRFIO_NF//g ;
330 $_ =~ s:CONFIGURE_NETCDF_FLAG::g ;
331 $_ =~ s:CONFIGURE_NETCDF_LIB_PATH::g ;
334 if ( $sw_pnetcdf_path )
335 { $_ =~ s/CONFIGURE_WRFIO_PNF/wrfio_pnf/g ;
336 $_ =~ s:CONFIGURE_PNETCDF_FLAG:-DPNETCDF: ;
337 if ( $sw_os == Interix ) {
338 $_ =~ s:CONFIGURE_PNETCDF_LIB_PATH:\$\(WRF_SRC_ROOT_DIR\)/external/io_pnetcdf/libwrfio_pnf.a -L$sw_pnetcdf_path/lib -lpnetcdf: ;
339 } else {
340 $_ =~ s:CONFIGURE_PNETCDF_LIB_PATH:-L\$\(WRF_SRC_ROOT_DIR\)/external/io_pnetcdf -lwrfio_pnf -L$sw_pnetcdf_path/lib -lpnetcdf: ;
343 else
344 { $_ =~ s/CONFIGURE_WRFIO_PNF//g ;
345 $_ =~ s:CONFIGURE_PNETCDF_FLAG::g ;
346 $_ =~ s:CONFIGURE_PNETCDF_LIB_PATH::g ;
349 if ( $sw_phdf5_path )
351 { $_ =~ s/CONFIGURE_WRFIO_PHDF5/wrfio_phdf5/g ;
352 $_ =~ s:CONFIGURE_PHDF5_FLAG:-DPHDF5: ;
353 $_ =~ s:CONFIGURE_PHDF5_LIB_PATH:-L\$\(WRF_SRC_ROOT_DIR\)/external/io_phdf5 -lwrfio_phdf5 -L$sw_phdf5_path/lib -lhdf5_fortran -lhdf5 -lm -lz -L$sw_phdf5_path/lib -lsz: ;
355 else
356 { $_ =~ s/CONFIGURE_WRFIO_PHDF5//g ;
357 $_ =~ s:CONFIGURE_PHDF5_FLAG::g ;
358 $_ =~ s:CONFIGURE_PHDF5_LIB_PATH::g ;
361 if ( $sw_jasperlib_path && $sw_jasperinc_path )
362 { $_ =~ s/CONFIGURE_WRFIO_GRIB2/wrfio_grib2/g ;
363 $_ =~ s:CONFIGURE_GRIB2_FLAG:-DGRIB2:g ;
364 $_ =~ s:CONFIGURE_GRIB2_INC:-I$sw_jasperinc_path:g ;
365 $_ =~ s:CONFIGURE_GRIB2_LIB:-L\$\(WRF_SRC_ROOT_DIR\)/external/io_grib2 -lio_grib2 -L$sw_jasperlib_path -ljasper:g ;
367 else
368 { $_ =~ s/CONFIGURE_WRFIO_GRIB2//g ;
369 $_ =~ s:CONFIGURE_GRIB2_FLAG::g ;
370 $_ =~ s:CONFIGURE_GRIB2_INC::g ;
371 $_ =~ s:CONFIGURE_GRIB2_LIB::g ;
375 # ESMF substitutions in configure.defaults
376 if ( $sw_esmflib_path && $sw_esmfinc_path )
378 $_ =~ s:CONFIGURE_ESMF_FLAG:-DESMFIO:g ;
379 $_ =~ s:ESMFIOLIB:-L$sw_esmflib_path -lesmf -L\$\(WRF_SRC_ROOT_DIR\)/external/io_esmf -lwrfio_esmf \$\(ESMF_LIB_FLAGS\):g ;
380 $_ =~ s:ESMFIOEXTLIB:-L$sw_esmflib_path -lesmf -L\$\(WRF_SRC_ROOT_DIR\)/external/io_esmf -lwrfio_esmf \$\(ESMF_LIB_FLAGS\):g ;
381 $_ =~ s:ESMFLIBFLAG:\$\(ESMF_LDFLAG\):g ;
383 else
385 $_ =~ s:CONFIGURE_ESMF_FLAG::g ;
386 $_ =~ s:ESMFLIBFLAG::g ;
387 if ( $sw_os == Interix ) {
388 $_ =~ s:ESMFIOLIB:\$\(WRF_SRC_ROOT_DIR\)/external/esmf_time_f90/libesmf_time.a:g ;
389 $_ =~ s:ESMFIOEXTLIB:-L\$\(WRF_SRC_ROOT_DIR\)/external/esmf_time_f90/libesmf_time.a:g ;
390 } else {
391 $_ =~ s:ESMFIOLIB:-L\$\(WRF_SRC_ROOT_DIR\)/external/esmf_time_f90 -lesmf_time:g ;
392 $_ =~ s:ESMFIOEXTLIB:-L\$\(WRF_SRC_ROOT_DIR\)/external/esmf_time_f90 -lesmf_time:g ;
396 if ( ! (substr( $_, 0, 5 ) eq "#ARCH") ) { @machopts = ( @machopts, $_ ) ; }
397 if ( substr( $_, 0, 10 ) eq "ENVCOMPDEF" )
399 @machopts = ( @machopts, "WRF_CHEM\t=\t$WRFCHEM \n" ) ;
403 # nesting support
404 # 0 = no nesting (only selectable for serial and smpar)
405 # 1 = basic nesting (serial and smpar compile with RSL_LITE and STUBMPI; dmpar and dm+sm use RSL_LITE and MPI)
406 # 2 = nesting with prescribed moves (add -DMOVE_NESTS to ARCHFLAGS)
407 # 3 = nesting with prescribed moves (add -DMOVE_NESTS and -DVORTEX_CENTER to ARCHFLAGS)
409 for $paropt ( 'serial','smpar','dmpar','dm+sm' )
411 if ( substr( $_, 0, 5 ) eq "#ARCH" && $latchon == 0
412 && ( index( $_, $sw_os ) >= 0 ) && ( index( $_, $sw_mach ) >= 0 )
413 && ( index($_, $paropt) >= 0 ) )
415 $x=substr($_,6) ;
416 $x=~s/^[ ]*// ;
417 $x =~ s/#.*$//g ;
418 chomp($x) ;
419 $x = $x." (".$paropt.")" ;
420 if ( $x eq $optstr[$optchoice] )
422 $latchon = 1 ;
423 $sw_ompparallel = "" ;
424 $sw_dmparallel = "" ;
425 $validresponse = 0 ;
426 #only allow parallel netcdf if the user has chosen parallel option
427 if ( $paropt ne 'dmpar' && $paropt ne 'dm+sm' ) { $sw_pnetcdf_path = "" ; }
429 until ( $validresponse ) {
430 if ( $paropt eq 'serial' || $paropt eq 'smpar' ) {
431 printf "Compile for nesting? (0=no nesting, 1=basic, 2=preset moves, 3=vortex following) [default 0]: " ;
432 } else {
433 printf "Compile for nesting? (1=basic, 2=preset moves, 3=vortex following) [default 1]: " ;
435 $response = <STDIN> ;
436 printf "\n" ;
437 lc $response ;
438 chop $response ;
439 if ( $response == "" || ($response >= 0 && $response <= 3) )
440 { $validresponse = 1 ; }
441 else
442 { printf("\nInvalid response (%d)\n",$response);}
444 if ( $response == "" ) {
445 if ( ( $paropt eq 'serial' || $paropt eq 'smpar' ) ) { $response = 0 ; }
446 else { $response = 1 ; }
448 if ( $response == 0 ) {
449 if ( ! ( $paropt eq 'serial' || $paropt eq 'smpar' ) ) { $response = 1 ; }
451 if ( ( $response == 1 ) || ( $response == 2 ) || ( $response == 3 ) ) {
452 if ( ( $paropt eq 'serial' || $paropt eq 'smpar' ) ) { # nesting without MPI
453 $sw_stubmpi = "-DSTUBMPI" ;
454 $sw_comms_lib = "\$(WRF_SRC_ROOT_DIR)/external/RSL_LITE/librsl_lite.a" ;
455 $sw_comms_external = "\$(WRF_SRC_ROOT_DIR)/external/RSL_LITE/librsl_lite.a gen_comms_rsllite module_dm_rsllite" ;
456 $sw_dmparallel = "RSL_LITE" ;
457 $sw_dmparallelflag = "-DDM_PARALLEL" ;
460 if ( $response == 2 ) {
461 $sw_nest_opt = "-DMOVE_NESTS" ;
462 } elsif ( $response == 3 ) {
463 $sw_nest_opt = "-DMOVE_NESTS -DVORTEX_CENTER" ;
465 if ( $paropt eq 'smpar' || $paropt eq 'dm+sm' ) { $sw_ompparallel = "OMP" ; }
466 if ( $paropt eq 'dmpar' || $paropt eq 'dm+sm' ) {
467 $sw_comms_lib = "\$(WRF_SRC_ROOT_DIR)/external/RSL_LITE/librsl_lite.a" ;
468 $sw_comms_external = "\$(WRF_SRC_ROOT_DIR)/external/RSL_LITE/librsl_lite.a gen_comms_rsllite module_dm_rsllite" ;
469 $sw_dmparallel = "RSL_LITE" ;
470 $sw_dmparallelflag = "-DDM_PARALLEL" ;
471 $sw_fc = "\$(DM_FC)" ;
472 $sw_cc = "\$(DM_CC)" ;
473 } # only one option in v3.0
475 $sw_ifort_r8 = 0 ;
476 if ( index ( $x, "ifort" ) > -1 || index ( $x, "intel compiler" ) > -1 ) {
477 if ( $sw_rwordsize == 8 ) {
478 $sw_ifort_r8 = 1 ;
485 close CONFIGURE_DEFAULTS ;
486 close POSTAMBLE ;
487 close ARCH_NOOPT_EXCEPTIONS ;
489 open CONFIGURE_WRF, "> configure.wrf" or die "cannot append configure.wrf" ;
490 open ARCH_PREAMBLE, "< arch/preamble_new" or die "cannot open arch/preamble_new" ;
491 my @preamble;
492 # apply substitutions to the preamble...
493 while ( <ARCH_PREAMBLE> )
495 # ESMF substitutions in preamble
496 if ( $sw_esmflib_path && $sw_esmfinc_path )
498 $_ =~ s/ESMFCOUPLING/1/g ;
499 $_ =~ s:ESMFMODDEPENDENCE:\$\(WRF_SRC_ROOT_DIR\)/external/io_esmf/module_utility.o:g ;
500 $_ =~ s:ESMFMODINC:-I$sw_esmfinc_path -I\$\(WRF_SRC_ROOT_DIR\)/main:g ;
501 $_ =~ s:ESMFIOINC:-I\$\(WRF_SRC_ROOT_DIR\)/external/io_esmf:g ;
502 $_ =~ s:ESMFIODEFS:-DESMFIO:g ;
503 $_ =~ s:ESMFTARGET:wrfio_esmf:g ;
505 else
507 $_ =~ s/ESMFCOUPLING/0/g ;
508 $_ =~ s:ESMFMODDEPENDENCE:\$\(WRF_SRC_ROOT_DIR\)/external/esmf_time_f90/module_utility.o:g ;
509 $_ =~ s:ESMFMODINC::g ;
510 $_ =~ s:ESMFIOINC:-I\$\(WRF_SRC_ROOT_DIR\)/external/esmf_time_f90:g ;
511 $_ =~ s:ESMFIODEFS::g ;
512 $_ =~ s:ESMFTARGET:esmf_time:g ;
514 $_ =~ s:CONFIGURE_EM_CORE:$sw_em_core:g ;
515 $_ =~ s:CONFIGURE_DA_CORE:$sw_da_core:g ;
516 $_ =~ s:CONFIGURE_NMM_CORE:$sw_nmm_core:g ;
517 $_ =~ s:CONFIGURE_COAMPS_CORE:$sw_coamps_core:g ;
518 $_ =~ s:CONFIGURE_EXP_CORE:$sw_exp_core:g ;
520 @preamble = ( @preamble, $_ ) ;
522 close ARCH_PREAMBLE ;
523 print CONFIGURE_WRF @preamble ;
524 close ARCH_PREAMBLE ;
525 printf CONFIGURE_WRF "# Settings for %s\n", $optstr[$optchoice] ;
526 print CONFIGURE_WRF @machopts ;
527 print "$ENV{WRF_MARS}" ;
528 if ( $ENV{WRF_MARS} || $ENV{WRF_TITAN} || $ENV{WRF_VENUS} )
530 open ARCH_PLANETAMBLE, "< arch/planetamble" or die "cannot open arch/planetamble" ;
531 while ( <ARCH_PLANETAMBLE> ) { print CONFIGURE_WRF } ;
532 close ARCH_PLANETAMBLE ;
535 close CONFIGURE_WRF ;
537 printf "Configuration successful. To build the model type compile . \n" ;
538 printf "------------------------------------------------------------------------\n" ;