Skip to content

Commit

Permalink
Second stage in removing WRF dependency:
Browse files Browse the repository at this point in the history
Now contains a new directory "wrf_io/" with its own makefile for building the
relevant WRF code. Now you no longer have to pre-build WRF, only run the
configure script to create a configure.wrf file.

To build this version:

 - Copy in the external/, frame/, inc/, main/, Registry/, and tools/ directories from the RAW UNBUILT WRF source code into the new wrf_io/ directory
 - Copy in a configure.wrf file created with that same WRF source code

Should be able to pare down the above list soon, many of them are only
needed for one or two files (or perhaps ultimately none)

This version was tested with the WRF V4.0 Friendly Release NOAA-EMC#3 (git hash e96ef955), but it should work for a wide range of WRF code
  • Loading branch information
Michael Kavulich, Jr committed Nov 27, 2018
1 parent 219d973 commit be62319
Show file tree
Hide file tree
Showing 5 changed files with 119 additions and 5 deletions.
2 changes: 1 addition & 1 deletion comupp/arch/Config.pl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
{
$sw_netcdf_path = substr( $ARGV[0], 8 ) ;
}
if ( substr( $ARGV[0], 1, 7 ) eq "topdir=" )
if ( substr( $ARGV[0], 1, 7 ) eq "wrfdir=" )
{
$sw_wrf_path = substr( $ARGV[0], 8 ) ;
}
Expand Down
11 changes: 11 additions & 0 deletions comupp/compile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@ else
setenv temp_netcdf 0
endif

#
# Temporary environment variables while hacking in this WRF code
setenv WRF_EM_CORE 1
setenv WRF_NMM_CORE 0
setenv WRF_COAMPS_CORE 0
setenv WRF_DA_CORE 0
setenv WRF_PLUS_CORE 0
setenv WRF_EXP_CORE 0
setenv WRF_NMM_NEST 0
setenv WRF_SRC_ROOT_DIR `pwd`/wrf_io

#
# Not expecting any arguments
if ( ${#argv} == 0 ) then
Expand Down
6 changes: 3 additions & 3 deletions comupp/configure
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ if [ ! -e ./bin ] ; then
mkdir ./bin
fi

TOPDIR=${pwd}
echo "topdir " ${TOPDIR}
WRFDIR=${pwd}/wrf_io
echo "wrfdir " ${WRFDIR}
BINDIR=${pwd}/bin
echo "bindir " ${BINDIR}

Expand Down Expand Up @@ -167,5 +167,5 @@ fi
perl arch/Config.pl -netcdf=$NETCDF -USENETCDFF=$USENETCDFF \
-os=$os -mach=$mach \
-bindir=$BINDIR -incmod=$INCMOD -libdir=$LIBDIR \
-debug=$DEBUG -topdir=$TOPDIR
-debug=$DEBUG -wrfdir=$WRFDIR

2 changes: 1 addition & 1 deletion comupp/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ SHELL=/bin/sh
# unipost relies on NCEP_modules and lib builds
# copygb relies on NCEP_modules and lib builds
# ndate relies on lib builds
SUBDIRS = src/lib src/unipost src/copygb src/ndate
SUBDIRS = wrf_io src/lib src/unipost src/copygb src/ndate

#
# TARGETs
Expand Down
103 changes: 103 additions & 0 deletions comupp/wrf_io/makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
SHELL = /bin/sh

################################################################################
#
# Makefile for external WRF code. This should be built first, as it is
# needed by other parts of the UPP build
#
# Use:
# make - build the executable
# make clean - start with a clean slate
#
#################################################################################

# Define the name of the executable


# build configuration determined before compile
include configure.wrf

COPY = cp


# directories for shared resources
LOCALINC = -I$(INCMOD) -I$(INCMOD)/crtm2
NCDFINC = -I$(NETCDFPATH)/include
WRFINC = -I$(WRF_MODS)
GRIB2INC = -I$(GRIB2SUPT_INC)

LLIBDIR = -L$(LIBDIR)
GRIB2LIBS = -lg2 -lg2tmpl -lxmlparse $(GRIB2SUPT_LIB)
UPPLIBS = -lnemsio -lsigio -lsfcio -lgfsio -lsp -lw3nco -lw3emc -lbacio -lCRTM $(SERIAL_MPI_LIB)
WRFEXTLIBS = $(WRF_LIB) $(WRF_LIB_EXTRA) $(WRF_LIB2)
NCDFLIBS = -L$(NETCDFPATH)/lib $(NETCDFLIBS)

LIBS = $(LLIBDIR) $(UPPLIBS) $(GRIB2LIBS) $(WRFEXTLIBS) $(NCDFLIBS)

MODULES = $(WRF_MODS)

ALL_MODULES = \
$(EM_MODULE_DIR) \
$(NMM_MODULES) \
$(EXP_MODULES) \
$(INCLUDE_MODULES)

WRF_COMPILE_START="`date`"

all:
$(MAKE) wrf_guts
@echo "wrf build started: $(WRF_COMPILE_START)"
@echo "wrf build completed:" `date`

wrf_guts:
@ echo '--------------------------------------'
$(COPY) Registry/Registry.EM Registry/Registry
( cd tools ; $(MAKE) standard.exe )
( $(MAKE) io_only )
( $(MAKE) MODULE_DIRS="$(ALL_MODULES)" toolsdir )
( cd frame ; $(MAKE) module_driver_constants.o pack_utils.o module_machine.o module_internal_header_util.o wrf_debug.o )
( cd frame ; $(AR) $(ARFLAGS) ../main/libwrflib.a module_driver_constants.o pack_utils.o module_machine.o \
module_internal_header_util.o module_wrf_error.o wrf_debug.o )

io_only: esmf_time wrfio_nf \
wrf_ioapi_includes wrfio_grib_share wrfio_grib1 wrfio_int fftpack

esmf_time :
( cd external/esmf_time_f90 ; \
make $(J) FC="$(SFC) $(PROMOTION) $(FCDEBUG) $(FCBASEOPTS)" RANLIB="$(RANLIB)" \
CPP="$(CPP) -Iinc -I. $(ARCHFLAGS) $(TRADFLAG)" AR="$(AR)" ARFLAGS="$(ARFLAGS)" )

wrfio_nf :
( cd external/io_netcdf ; \
make $(J) NETCDFPATH="$(NETCDFPATH)" RANLIB="$(RANLIB)" CPP="$(CPP)" \
CC="$(SCC)" CFLAGS="$(CFLAGS)" \
FC="$(SFC) $(PROMOTION) $(OMP) $(FCFLAGS)" TRADFLAG="$(TRADFLAG)" AR="$(AR)" ARFLAGS="$(ARFLAGS)" )


wrf_ioapi_includes :
( cd external/ioapi_share ; \
$(MAKE) NATIVE_RWORDSIZE="$(NATIVE_RWORDSIZE)" RWORDSIZE="$(RWORDSIZE)" AR="$(AR)" ARFLAGS="$(ARFLAGS)" )

wrfio_grib_share :
( cd external/io_grib_share ; \
make $(J) CC="$(SCC)" CFLAGS="$(CFLAGS)" RM="$(RM)" RANLIB="$(RANLIB)" CPP="$(CPP)" \
FC="$(SFC) $(PROMOTION) -I. $(FCDEBUG) $(FCBASEOPTS) $(FCSUFFIX)" TRADFLAG="$(TRADFLAG)" AR="$(AR)" ARFLAGS="$(ARFLAGS)" archive)

wrfio_grib1 :
( cd external/io_grib1 ; \
make $(J) CC="$(SCC)" CFLAGS="$(CFLAGS)" RM="$(RM)" RANLIB="$(RANLIB)" CPP="$(CPP)" \
FC="$(SFC) $(PROMOTION) -I. $(FCDEBUG) $(FCBASEOPTS) $(FCSUFFIX)" TRADFLAG="$(TRADFLAG)" AR="$(AR)" ARFLAGS="$(ARFLAGS)" archive)

wrfio_int :
( cd external/io_int ; \
make $(J) CC="$(CC)" CFLAGS_LOCAL="$(CFLAGS_LOCAL)" RM="$(RM)" RANLIB="$(RANLIB)" CPP="$(CPP)" \
FC="$(FC) $(PROMOTION) $(FCDEBUG) $(FCBASEOPTS) $(OMP)" FGREP="$(FGREP)" \
TRADFLAG="$(TRADFLAG)" AR="$(AR)" ARFLAGS="$(ARFLAGS)" ARCHFLAGS="$(ARCHFLAGS)" all )
fftpack :
( cd external/fftpack/fftpack5 ; \
make $(J) FC="$(SFC)" FFLAGS="$(PROMOTION) $(FCDEBUG) $(FCBASEOPTS)" RANLIB="$(RANLIB)" AR="$(AR)" \
ARFLAGS="$(ARFLAGS)" CPP="$(CPP)" CPPFLAGS="$(CPPFLAGS)" RM="$(RM)" )

toolsdir :
( cd tools ; $(MAKE) CC_TOOLS_CFLAGS="$(CC_TOOLS_CFLAGS)" CC_TOOLS="$(CC_TOOLS) -DIWORDSIZE=$(IWORDSIZE) -DMAX_HISTORY=$(MAX_HISTORY)" ) ; \

0 comments on commit be62319

Please sign in to comment.