THIS PAGE IS OBSOLETE. More recent notes are at macwrf.blogspot.com.
On this page, the results of my efforts to port the WRF model to other platforms and/or compilers are reported. This page presumes you already know how to compile and use WRF. The page is current as of released version 2.1.2 and was last revised on 22 October 2006. Comments, corrections and suggestions made to Robert Fovell are gratefully received.
You may need to right-click or option-click to download the linked files.
Some notes on running WRF on Intel Macs
-- Added 22 October 2006.
I have just tried to run WRF on an Intel Mac, having acquired a Core Duo-equipped MacBook and the Intel Fortran 9.1 compiler for Mac OS. So far, I have a successful run using OpenMP and both cores, without nesting (not tried yet). The number of changes needed to adapt the model from Intel Linux to Intel Mac appears to be rather slight. This is what I did...
Make sure NetCDF is built with the ifort and gcc compilers. Here are my notes on the compilation.
Build WRF on an HFSX (HFS+ case-sensitive) disk or mounted disk image.
I had to edit external/io_grib1/makefile to remove the -I.afterio_grib1.F, otherwise this portion of WRF would not build.
On this MacBook with 1 GB RAM, compilation takes a VERY long time -- especially module_configure.f.
At this point, the compiler flags I chose still does vectorization. With earlier Intel Fortran versions on Linux, vectorization caused incorrect results. I have not yet tested this.
I ran WRF under the tcsh environment, having invoked unlimit to increase the stacksize to the maximum value. On this Intel Mac, I could not get the stacksize upped to the maximum in bash with the ulimit command, as per usual. I don't know why.
Below this point, this page pertains to WRF version 2.1.1.
The NCAR-provided configure.defaults includes a section for Mac OS X (Darwin). It still does NOT work out-of-the-box for me. I had to implement the changes listed in the OS X section below. The stock version also still does not have an MPI version. MPI/WRF works well on Macintosh hardware (see the Version 2.0.3.1 page), and I hope to complete revisions for Version 2.1.1 soon.
Apple now supports a case sensitive version of their HFS+ filesystem. (Thanks to Warner Yuen of Apple for pointing this out.) WRF compiles and runs just fine on this new version of HFS+. Thus, UFS-formatted disks are no longer required. This is a very good thing, because I have had periodic, vexing troubles with UFS disks on the Mac, and suspect the Mac implementation of the unix file system is not without bugs. To convert an empty, initializable partition or disk to HFS+ case sensitive, use the Disk Utility in /Applications/Utilities.
WRF 2.1.1 for Mac OS X
Preamble
The following presumes you have the IBM Fortran compiler xlf.
I use gcc in place of xlc, the IBL C compiler. I have not tested xlc.
I have not tested the OpenMP version recently. Based on WRF/OpenMP's poor performance on Intel, however, this is not a priority.
Procedure
Here is what I had to do to get WRF V2.1.1 running in single CPU, single domain mode on my Mac G5. Both alterations involve the contents of external/io_grib1.
Replace io_grib1.F with this file, called io_grib1.F.V211, and rename it io_grib1.F.
Replace makefile with this file, called makefile.grib1.V211, and rename it makefile.
Notes
Remember to ulimit or unlimit, depending on shell, before running WRF.
NetCDF is required; make it with the xlf compiler.
I use the -qfloat=nomaf flag because it permits optimizations without program semantics changes. In my tests, I get identical results from -O3 and -g when I use -qfloat=nomaf, which is fantastic. (I have never been able to get identical results between optimized and non-optimized versions on any other platform or with any other compiler.)
To increase addressable memory, add something like this to LDFLAGS in configure.wrf: LDFLAGS = -Wl,-stack_size,10000000,-stack_addr,0xc0000000. This grabs 1 GB of memory.
WRF supporting programs for Mac OS X
This section has been carried forward unchanged from the V2.0.3.1 page
WRF2GrADS:
This file is a revised verison of module_wrf_to_grads_util.F (version of 6/22/05), modified so tdef will accurately report time for data sets that start at times other than the top of the hour (i.e., at 23:15Z, say).
RIP4
Here is my somewhat brain-dead procedure for getting RIP4 to work on OS X with xlf. This is a workaround for problems I was having with ripdp_wrf, probably because of the way I handled netcdf. It is not elegant, but I usually stop working on things like this once they start working, and it only has to be done once. It may not work for you. Indeed, you may only need the updated Makefile, which contains information obtained from E. Salathe and M. Han.
If src/Makefile doesn't point to the correct location for netcdf, change it.
Also add this file, Makefile_part to the top-level directory.
The Makefiles I provide increase addressable memory with LDFLAGS = -Wl,-stack_size,10000000,-stack_addr,0xc0000000. If you have less than 1 GB of RAM, you may want to remove this.
Procedure:
make darwin
make -f Makefile_part prepare
make -f Makefile_part darwin
WRF2VIS5D
This one was very simple. I use these lines in the Makefile:
FC = xlf90 FCFLAGS = -g -C
You may also be interested in my revised module_wrf_to_v5d_util.F file, which addresses a number of issues. Modifications include:
Native Mercator projection is used in place of a faked projection
based on cylindrical equidistant. Later vis5d versions include Mercator. Faked Mercator failed when domain crossed equator; this fixes that.
Fix to projection arguments for Lambert projection. When truelat1=truelat2, the cone variable did a divide by zero. Symptom: Vis5D refused to draw wind vectors, tho
contours of U, V could be drawn. Additionally, projection was distorted, tho that
may be less obvious. I'm not absolutely positive my repair is 100%
correct, but I note that my modified WRF2VIS5D produces slightly better agreement between political boundaries, terrain and skin temperature fields than does the Vis5D files created using RIP.
I added a number of useful 2D fields (U10, V10, T2, Q2, SST, PSFC, HGT) to the list of fields recognized as 2D by WRF2VIS5D.
As of 3 July 2005, a problem with 2D fields when multiple wrfout files are used as input was fixed. Bug was pointed out by hmodzelewski.
WRF 2.1.1 for FreeBSD
I also run WRF to run on a FreeBSD (x86) system, using the Intel ifort and GNU gcc compilers. The procedure for getting V2.1.1 working is somewhat more onerous than it was for V2.0.3.1, again mainly due to the new GRIB1 code. My fixes for this are not elegant. However, they work, and once I get this stuff working, I don't have time to make things elegant. All information here pertains to the MPP version, which is my sole interest here.
I had to modify the external/RSL/RSL/rsl_malloc.c file slightly. This is the revised version. This file is unchanged from V2.0.3.1.
In main/Makefile, delete this line: ../dyn_em/module_si_io_em.o \. This references an old module that appears to no longer exist, and for some reason Intel on FreeBSD does not take failing to find it gracefully.
FreeBSD needs sys/types.h to be called before any networking stuff, since this OS does not make the call on its own. In external/io_grib1/MEL_grib1, the files called grib_enc.c, gribputgds.c, gribputpds.c, and pack_spatial.c each have a line like
#include --netinet/in.h--
Prior to each of these lines, insert this:
#include --sys/types.h--
(Important: Replace "--" with less than and greater than signs, respectively. I can't make those symbols appear in HTML.)
In frame/collect_on_comm.c, there is a line inserting sys/resource.h unless the system is MACOS. FreeBSD chokes on that, too. Remove the line.