From bdd1bca1a1a2761f1fd3aff7fb84e90046840173 Mon Sep 17 00:00:00 2001 From: Michael Duda Date: Mon, 1 Nov 2021 18:20:02 -0600 Subject: [PATCH 1/7] Update version number to 4.3.1 The version number is set in the top-level README, the compile script, and the geogrid and metgrid global attributes. --- README | 2 +- compile | 2 +- geogrid/src/process_tile_module.F | 2 +- metgrid/src/input_module.F | 4 +++- metgrid/src/process_domain_module.F | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README b/README index 6f1e08b9c..4ab51daec 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -WRF Pre-Processing System Version 4.3 +WRF Pre-Processing System Version 4.3.1 http://www2.mmm.ucar.edu/wrf/users/ diff --git a/compile b/compile index b48942520..12fb48ee8 100755 --- a/compile +++ b/compile @@ -112,7 +112,7 @@ endif # Print out WPS version, system info, and compiler/version echo "============================================================================================== " echo " " - echo Version 4.2 + echo Version 4.3.1 echo " " uname -a echo " " diff --git a/geogrid/src/process_tile_module.F b/geogrid/src/process_tile_module.F index 3d3a164f2..bd7ffac2e 100644 --- a/geogrid/src/process_tile_module.F +++ b/geogrid/src/process_tile_module.F @@ -300,7 +300,7 @@ subroutine process_tile(which_domain, grid_type, dynopt, & end if ! Initialize the output module now that we have the corner point lats/lons - call output_init(which_domain, 'OUTPUT FROM GEOGRID V4.3', '0000-00-00_00:00:00', grid_type, dynopt, & + call output_init(which_domain, 'OUTPUT FROM GEOGRID V4.3.1', '0000-00-00_00:00:00', grid_type, dynopt, & corner_lats, corner_lons, & start_dom_i, end_dom_i, start_dom_j, end_dom_j, & start_patch_i, end_patch_i, start_patch_j, end_patch_j, & diff --git a/metgrid/src/input_module.F b/metgrid/src/input_module.F index e691f4469..f11f40aff 100644 --- a/metgrid/src/input_module.F +++ b/metgrid/src/input_module.F @@ -427,7 +427,9 @@ subroutine read_global_attrs(title, start_date, grid_type, dyn_opt, #endif call ext_get_dom_ti_char('TITLE', title) - if (index(title,'GEOGRID V4.3') /= 0) then + if (index(title,'GEOGRID V4.3.1') /= 0) then + wps_version = 4.31 + else if (index(title,'GEOGRID V4.3') /= 0) then wps_version = 4.3 else if (index(title,'GEOGRID V4.2') /= 0) then wps_version = 4.2 diff --git a/metgrid/src/process_domain_module.F b/metgrid/src/process_domain_module.F index 730087749..f4ec19fb6 100644 --- a/metgrid/src/process_domain_module.F +++ b/metgrid/src/process_domain_module.F @@ -876,7 +876,7 @@ subroutine process_single_met_time(do_const_processing, & ! now we simply output every field from the storage module. ! - title = 'OUTPUT FROM METGRID V4.3' + title = 'OUTPUT FROM METGRID V4.3.1' ! Initialize the output module for this domain and time call mprintf(.true.,LOGFILE,'Initializing output module.') From 166c9886fb201865d2b3fd71c6cba22fbe1cde0d Mon Sep 17 00:00:00 2001 From: Michael Duda Date: Sat, 30 Oct 2021 00:16:33 +0000 Subject: [PATCH 2/7] Fix incorrect argument rank in calls to ext_*_put_dom_ti_* in output_module.F In calls to ext_{int,ncd,gr1}_put_dom_ti_{integer,real} in output_module.F, the 'Data' dummy argument is an array, but a scalar actual argument was provided. This error was picked up by the GNU Fortran 11.1.0 compiler: output_module.f90:1733:41: 1733 | var_value, & | 1 ...... 1761 | var_value, & | 2 Error: Rank mismatch between actual argument at (1) and actual argument at (2) (rank-1 and scalar) output_module.f90:1678:41: 1678 | var_value, & | 1 ...... 1706 | var_value, & | 2 Error: Rank mismatch between actual argument at (1) and actual argument at (2) (rank-1 and scalar) The fix adopted by this commit is to simply make the scalar var_value into a temporary size-1 array with (/var_value/). --- geogrid/src/output_module.F | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/geogrid/src/output_module.F b/geogrid/src/output_module.F index 5eb0584f6..924c70328 100644 --- a/geogrid/src/output_module.F +++ b/geogrid/src/output_module.F @@ -1429,21 +1429,21 @@ subroutine ext_put_dom_ti_integer_scalar(var_name, var_value) #ifdef IO_BINARY if (io_form_output == BINARY) then call ext_int_put_dom_ti_integer(handle, trim(var_name), & - var_value, & + (/ var_value /), & 1, istatus) end if #endif #ifdef IO_NETCDF if (io_form_output == NETCDF) then call ext_ncd_put_dom_ti_integer(handle, trim(var_name), & - var_value, & + (/ var_value /), & 1, istatus) end if #endif #ifdef IO_GRIB1 if (io_form_output == GRIB1) then call ext_gr1_put_dom_ti_integer(handle, trim(var_name), & - var_value, & + (/ var_value /), & 1, istatus) end if #endif @@ -1516,21 +1516,21 @@ subroutine ext_put_dom_ti_real_scalar(var_name, var_value) #ifdef IO_BINARY if (io_form_output == BINARY) then call ext_int_put_dom_ti_real(handle, trim(var_name), & - var_value, & + (/ var_value /), & 1, istatus) end if #endif #ifdef IO_NETCDF if (io_form_output == NETCDF) then call ext_ncd_put_dom_ti_real(handle, trim(var_name), & - var_value, & + (/ var_value /), & 1, istatus) end if #endif #ifdef IO_GRIB1 if (io_form_output == GRIB1) then call ext_gr1_put_dom_ti_real(handle, trim(var_name), & - var_value, & + (/ var_value /), & 1, istatus) end if #endif From 03e35b60abbec9e06a2617313bcbdc52b14bb353 Mon Sep 17 00:00:00 2001 From: Michael Duda Date: Sat, 30 Oct 2021 00:17:35 +0000 Subject: [PATCH 3/7] Fix incorrect argument rank in calls to ext_*_get_dom_ti_* in input_module.F In calls to ext_{int,ncd,gr1}_get_dom_ti_{integer,real} in input_module.F, the 'Data' dummy argument is an array, but a scalar actual argument was provided. This error was picked up by the GNU Fortran 11.1.0 compiler: input_module.f90:881:41: 881 | var_value, & | 1 ...... 909 | var_value, & | 2 Error: Rank mismatch between actual argument at (1) and actual argument at (2) (rank-1 and scalar) input_module.f90:822:41: 822 | var_value, & | 1 ...... 854 | var_value, & | 2 Error: Rank mismatch between actual argument at (1) and actual argument at (2) (rank-1 and scalar) The fix adopted by this commit is to declare a local array for use as the actual argument, and to copy the first element of this array to var_value after a successful call to ext_{int,ncd,gr1}_get_dom_ti_{integer,real}. --- metgrid/src/input_module.F | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/metgrid/src/input_module.F b/metgrid/src/input_module.F index e691f4469..02c5fa6f6 100644 --- a/metgrid/src/input_module.F +++ b/metgrid/src/input_module.F @@ -633,25 +633,26 @@ subroutine ext_get_dom_ti_integer_scalar(var_name, var_value, suppress_errors) ! Local variables integer :: istatus, outcount + integer, dimension(1) :: var_value_arr #ifdef IO_BINARY if (io_form_input == BINARY) then call ext_int_get_dom_ti_integer(handle, trim(var_name), & - var_value, & + var_value_arr, & 1, outcount, istatus) end if #endif #ifdef IO_NETCDF if (io_form_input == NETCDF) then call ext_ncd_get_dom_ti_integer(handle, trim(var_name), & - var_value, & + var_value_arr, & 1, outcount, istatus) end if #endif #ifdef IO_GRIB1 if (io_form_input == GRIB1) then call ext_gr1_get_dom_ti_integer(handle, trim(var_name), & - var_value, & + var_value_arr, & 1, outcount, istatus) end if #endif @@ -662,6 +663,8 @@ subroutine ext_get_dom_ti_integer_scalar(var_name, var_value, suppress_errors) call mprintf((istatus /= 0),ERROR,'Error while reading domain time-independent attribute.') end if + var_value = var_value_arr(1) + end subroutine ext_get_dom_ti_integer_scalar @@ -724,31 +727,34 @@ subroutine ext_get_dom_ti_real_scalar(var_name, var_value) ! Local variables integer :: istatus, outcount + real, dimension(1) :: var_value_arr #ifdef IO_BINARY if (io_form_input == BINARY) then call ext_int_get_dom_ti_real(handle, trim(var_name), & - var_value, & + var_value_arr, & 1, outcount, istatus) end if #endif #ifdef IO_NETCDF if (io_form_input == NETCDF) then call ext_ncd_get_dom_ti_real(handle, trim(var_name), & - var_value, & + var_value_arr, & 1, outcount, istatus) end if #endif #ifdef IO_GRIB1 if (io_form_input == GRIB1) then call ext_gr1_get_dom_ti_real(handle, trim(var_name), & - var_value, & + var_value_arr, & 1, outcount, istatus) end if #endif call mprintf((istatus /= 0),ERROR,'Error while reading domain time-independent attribute.') + var_value = var_value_arr(1) + end subroutine ext_get_dom_ti_real_scalar From 8d99f4cdb2528bb132388957555a3315f0faba1c Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Mon, 1 Nov 2021 20:54:44 -0600 Subject: [PATCH 4/7] Add newer variables to HRRR var list --- ungrib/src/ngl/g2/params.f | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/ungrib/src/ngl/g2/params.f b/ungrib/src/ngl/g2/params.f index 6d0eb4e3b..057c2b4a5 100644 --- a/ungrib/src/ngl/g2/params.f +++ b/ungrib/src/ngl/g2/params.f @@ -40,7 +40,7 @@ module params ! !$$$ - integer,parameter :: MAXPARAM=801 + integer,parameter :: MAXPARAM=816 type gribparam integer :: g1tblver @@ -431,7 +431,7 @@ module params data paramlist(370) /gribparam(2,160,0,4,198,'CSUSF')/ data paramlist(371) /gribparam(2,162,0,5,195,'CSULF')/ data paramlist(372) /gribparam(2,163,0,5,196,'CSDLF')/ - data paramlist(373) /gribparam(2,164,0,4,199,'CFNSF')/ + data paramlist(373) /gribparam(2,164,0,4,199,'CFNSF')/ ! used as Fire Radiative Power in HRRR data paramlist(374) /gribparam(2,165,0,5,197,'CFNLF')/ data paramlist(375) /gribparam(2,166,0,4,200,'VBDSF')/ data paramlist(376) /gribparam(2,167,0,4,201,'VDDSF')/ @@ -857,7 +857,7 @@ module params data paramlist(790) /gribparam(2,238,0,1,42,'SNOWC')/ data paramlist(791) /gribparam(2,204,0,4,7,'DSWRF')/ ! Added 04/6/19 for HRRR fields. -! table version, grib1 value, grib2 desc, grib2 category, grib2num, abbreviation +! table version, grib1 value, grib2 disc, grib2 category, grib2num, abbreviation data paramlist(792) /gribparam(2,255,0,1,31,'HAIL')/ data paramlist(793) /gribparam(2,255,0,1,82,'CIMIXR')/ data paramlist(794) /gribparam(2,253,0,2,30,'FRICV')/ @@ -868,6 +868,22 @@ module params data paramlist(799) /gribparam(2,155,2,0,10,'GFLUX')/ data paramlist(800) /gribparam(2,235,1,0,6,'SSRUN')/ data paramlist(801) /gribparam(2,234,1,0,5,'BGRUN')/ +! Added 08/16/21 for more HRRR fields. + data paramlist(802) /gribparam(2,255,0,1,100,'SPNCR')/ + data paramlist(803) /gribparam(2,255,0,6,28,'NCONCD')/ + data paramlist(804) /gribparam(2,255,0,6,29,'NCCICE')/ + data paramlist(805) /gribparam(2,255,0,6,32,'FRACCC')/ + data paramlist(806) /gribparam(2,255,0,7,204,'EFHL')/ + data paramlist(807) /gribparam(2,255,0,7,205,'ESP')/ + data paramlist(808) /gribparam(2,255,0,7,206,'CANGLE')/ + data paramlist(809) /gribparam(2,255,0,20,0,'MASSDEN')/ ! smoke + data paramlist(810) /gribparam(2,255,0,20,1,'COLMD')/ ! smoke + data paramlist(811) /gribparam(2,255,0,17,1,'LTPINX')/ + data paramlist(812) /gribparam(2,255,2,0,231,'VEGMIN')/ + data paramlist(813) /gribparam(2,255,2,0,232,'VEGMAX')/ + data paramlist(814) /gribparam(2,255,0,6,18,'TCOLWO')/ + data paramlist(815) /gribparam(2,255,0,6,19,'TCOLIO')/ + data paramlist(816) /gribparam(2,255,0,16,201,'RADARVIL')/ contains From 55e624334870e06581b5bcd27a9157212884255a Mon Sep 17 00:00:00 2001 From: Michael Duda Date: Wed, 3 Nov 2021 11:32:31 -0600 Subject: [PATCH 5/7] Allow configure script to define new FCCOMPAT flags for newer GNU compilers Newer GNU compilers (in particular, major versions later than 9) appear to require the -fallow-argument-mismatch option in order to successfully compile certain modules that make calls to Fortran 77 routines that operate on various datatypes: for example, the MPI_Bcast call can broadcast various data types, and without the Fortran 90+ module interface, there are no overloaded explicit interfaces for supported argument types, leading newer GNU Fortran compiler releases to generate errors about inconsistent/mismatched argument types. The configure script now builds a test program that determines whether the Fortran compiler being used is GNU Fortran with a major version later than 9, and sets the FCCOMPAT variable to -fallow-argument-mismatch in the configure.wps file if so (and sets FCCOMPAT to an empty string otherwise). Since Make treats undefined variables as empty strings, the FCCOMPAT variable only needs to be defined for configuration options where it will be needed, i.e., configuration options that use the GNU Fortran compiler. Other compiler could follow what has been done in this commit to define FCCOMPAT as needed through the use of additional test programs (and through the addition of FCCOMPAT to other configuration stanzas). --- arch/configure.defaults | 4 ++++ configure | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/arch/configure.defaults b/arch/configure.defaults index 2c66a47e0..25382bab0 100644 --- a/arch/configure.defaults +++ b/arch/configure.defaults @@ -159,6 +159,7 @@ CC = CONFIGURE_CC LD = $(FC) FFLAGS = -ffree-form -O -fconvert=big-endian -frecord-marker=4 F77FLAGS = -ffixed-form -O -fconvert=big-endian -frecord-marker=4 +FCCOMPAT = CONFIGURE_COMPAT_FLAGS FCSUFFIX = FNGFLAGS = $(FFLAGS) LDFLAGS = @@ -182,6 +183,7 @@ CC = CONFIGURE_CC LD = $(FC) FFLAGS = -ffree-form -O -fconvert=big-endian -frecord-marker=4 F77FLAGS = -ffixed-form -O -fconvert=big-endian -frecord-marker=4 +FCCOMPAT = CONFIGURE_COMPAT_FLAGS FCSUFFIX = FNGFLAGS = $(FFLAGS) LDFLAGS = @@ -452,6 +454,7 @@ CC = CONFIGURE_CC LD = $(FC) FFLAGS = -ffree-form -O -fconvert=big-endian -frecord-marker=4 F77FLAGS = -ffixed-form -O -fconvert=big-endian -frecord-marker=4 +FCCOMPAT = CONFIGURE_COMPAT_FLAGS FCSUFFIX = FNGFLAGS = $(FFLAGS) LDFLAGS = @@ -477,6 +480,7 @@ CC = CONFIGURE_CC LD = $(FC) FFLAGS = -ffree-form -O -fconvert=big-endian -frecord-marker=4 F77FLAGS = -ffixed-form -O -fconvert=big-endian -frecord-marker=4 +FCCOMPAT = CONFIGURE_COMPAT_FLAGS FCSUFFIX = FNGFLAGS = $(FFLAGS) # For a WRF OpenMP build, add the gomp library for WPS diff --git a/configure b/configure index 1e48bc669..6b9f87364 100755 --- a/configure +++ b/configure @@ -458,3 +458,40 @@ EOF fi fi + + +# +# Check for newer GNU Fortran compilers that require the use of the following: +# -fallow-argument-mismatch +# +cat > gnu_flag_test.F90 << EOF +program gnu_flag_test +#ifdef __GNUC__ +#if __GNUC__ > 9 +call exit(1) ! A GNU extension, but at this point we know this is a GNU compiler +#endif +#endif +end program gnu_flag_test +EOF + +# The above test program gives exit status 1 iff we are using the GNU Fortran +# compiler with a major version greater than 9 + +FC=`grep ^SFC configure.wps | cut -d"=" -f2-` +FFLAGS=`grep ^FFLAGS configure.wps | cut -d"=" -f2-` +$FC ${FFLAGS} gnu_flag_test.F90 -o gnu_flag_test > /dev/null 2>&1 +if [ -f ./gnu_flag_test ]; then + ./gnu_flag_test > /dev/null 2>&1 + if [ $? -eq 1 ]; then + compat="-fallow-argument-mismatch" + fi + rm gnu_flag_test +else + printf "*** Failed to compile the gnu_flag_test program!\n" + printf " This may be because the selected build option does not work correctly.\n" +fi +rm gnu_flag_test.F90 + +sed "s/CONFIGURE_COMPAT_FLAGS/${compat}/" configure.wps > configure.wps.tmp +mv configure.wps.tmp configure.wps + From 67f43362ab7d98beb7687c540c90edaf359b8b3b Mon Sep 17 00:00:00 2001 From: Michael Duda Date: Wed, 3 Nov 2021 11:35:36 -0600 Subject: [PATCH 6/7] Add FCCOMPAT flags to postamble and throughout Makefiles when compiling Fortran --- arch/postamble | 4 ++-- ungrib/src/Makefile | 6 +++--- ungrib/src/ngl/g2/Makefile | 4 ++-- ungrib/src/ngl/w3/Makefile | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/arch/postamble b/arch/postamble index c5dae242d..130594140 100644 --- a/arch/postamble +++ b/arch/postamble @@ -18,10 +18,10 @@ AR = ar ru .f.o: $(RM) $@ $*.mod - $(FC) $(F77FLAGS) -c $< $(WRF_INCLUDE) + $(FC) $(F77FLAGS) $(FCCOMPAT) -c $< $(WRF_INCLUDE) .F.o: $(RM) $@ $*.mod $(CPP) $(CPPFLAGS) $(FDEFS) $(WRF_INCLUDE) $< > $*.f90 - $(FC) $(FFLAGS) -c $*.f90 $(WRF_INCLUDE) + $(FC) $(FFLAGS) $(FCCOMPAT) -c $*.f90 $(WRF_INCLUDE) # $(RM) $*.f90 diff --git a/ungrib/src/Makefile b/ungrib/src/Makefile index 874ba6567..1ee957c71 100644 --- a/ungrib/src/Makefile +++ b/ungrib/src/Makefile @@ -55,13 +55,13 @@ g2print.exe: filelist.o gridinfo.o g2print.o g2print.o: table.o gridinfo.o filelist.o module_datarray.o \ ngl/g2/gribmod.o ngl/g2/params.o g2print.F $(CPP) $(CPPFLAGS) $*.F > $*.f90 - $(FC) -c $(FFLAGS) $(FCSUFFIX) $*.f90 -I. -I./ngl/g2 + $(FC) -c $(FFLAGS) $(FCSUFFIX) $(FCCOMPAT) $*.f90 -I. -I./ngl/g2 # $(RM) $*.f90 rd_grib2.o: ngl/g2/gribmod.o module_debug.o table.o gridinfo.o ngl/g2/params.o new_storage.o \ rd_grib2.F $(CPP) $(CPPFLAGS) $*.F > $*.f90 - $(FC) -c $(F77FLAGS) $(FCSUFFIX) $*.f90 -I. -I./ngl/g2 + $(FC) -c $(F77FLAGS) $(FCSUFFIX) $(FCCOMPAT) $*.f90 -I. -I./ngl/g2 # $(RM) $*.f90 datint.o: misc_definitions_module.o module_debug.o gridinfo.o new_storage.o datint.F @@ -88,7 +88,7 @@ read_namelist.o: misc_definitions_module.o module_debug.o read_namelist.F .F.o: $(CPP) $(CPPFLAGS) $(FDEFS) $< > $*.f90 - $(FC) -c $(FFLAGS) $*.f90 + $(FC) -c $(FFLAGS) $(FCCOMPAT) $*.f90 # $(RM) $*.f90 .c.o: diff --git a/ungrib/src/ngl/g2/Makefile b/ungrib/src/ngl/g2/Makefile index 141c33a28..36ae13868 100755 --- a/ungrib/src/ngl/g2/Makefile +++ b/ungrib/src/ngl/g2/Makefile @@ -65,11 +65,11 @@ superclean: clean .F.o: $(CPP) $(FDEFS) $*.F > $*.f90 - $(FC) -c $(F77FLAGS) $*.f90 + $(FC) -c $(F77FLAGS) $(FCCOMPAT) $*.f90 /bin/rm -f $*.f90 .f.o: - $(FC) -c $(F77FLAGS) $*.f + $(FC) -c $(F77FLAGS) $(FCCOMPAT) $*.f .c.o: $(CC) -c $(CFLAGS) $(CFLAGS2) $< diff --git a/ungrib/src/ngl/w3/Makefile b/ungrib/src/ngl/w3/Makefile index a0455f896..73609d108 100644 --- a/ungrib/src/ngl/w3/Makefile +++ b/ungrib/src/ngl/w3/Makefile @@ -42,7 +42,7 @@ clean: .f.o: $(RM) $*.o - $(FC) $(F77FLAGS) -c $< + $(FC) $(F77FLAGS) $(FCCOMPAT) -c $< .c.o: $(RM) $*.o From 7efeebbe8be95eefe975a1b581ad93632b0ee613 Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Mon, 1 Nov 2021 20:53:02 -0600 Subject: [PATCH 7/7] Fix print format in g2print.F by using an explicit format statement rather than list-directed output --- ungrib/src/g2print.F | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ungrib/src/g2print.F b/ungrib/src/g2print.F index 1d33a3567..1e233ea1c 100644 --- a/ungrib/src/g2print.F +++ b/ungrib/src/g2print.F @@ -488,10 +488,10 @@ SUBROUTINE r_grib2(junit, gribflnm, hdate, & write (6,*) ' ',map%source if (debug_level .le. 50) then - write(6,*) '---------------------------------------------------------------------------------------' - write(6,*) ' rec Prod Cat Param Lvl Lvl Lvl Prod Name Time Fcst' - write(6,*) ' num Disc num code one two Templ hour' - write(6,*) '---------------------------------------------------------------------------------------' + write(6,'(a)') '---------------------------------------------------------------------------------------' + write(6,'(a)') ' rec Prod Cat Param Lvl Lvl Lvl Prod Name Time Fcst' + write(6,'(a)') ' num Disc num code one two Templ hour' + write(6,'(a)') '---------------------------------------------------------------------------------------' endif