Scheduled Downtime
On Friday 21 April 2023 @ 5pm MT, this website will be down for maintenance and expected to return online the morning of 24 April 2023 at the latest

WPS on FreeBSD

This post was from a previous version of the WRF&MPAS-A Support Forum. New replies have been disabled and if you have follow up questions related to this post, then please start a new thread from the forum home page.


New member
I have been able to compile WRFV4.3.1 and WPSV4.3.1, when I try running geogrid.exe I get:
rpasken@thunder> geogrid.exe
Parsed 49 entries in GEOGRID.TBL
Processing domain 1 of 1
Processing XLAT and XLONG

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.
Running gdb on geogrid.exe gives:

rpasken@thunder> gdb geogrid.exe
GNU gdb (GDB) 11.1 [GDB v11.1 for FreeBSD]
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-portbld-freebsd13.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
Find the GDB manual and other documentation resources online at:

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from geogrid.exe...
(gdb) run
Starting program: /seamless/WRF/WPS/geogrid.exe
Parsed 49 entries in GEOGRID.TBL
Processing domain 1 of 1
Processing XLAT and XLONG

Program received signal SIGSEGV, Segmentation fault.
Address not mapped to object.
0x0000000000493fd1 in ext_ncd_write_field_ ()
(gdb) where
#0 0x0000000000493fd1 in ext_ncd_write_field_ ()
#1 0x0000000000422d23 in __output_module_MOD_write_field ()
#2 0x0000000000427d99 in __output_module_MOD_output_init ()
#3 0x0000000000434457 in __process_tile_module_MOD_process_tile ()
#4 0x0000000000402c0f in main ()

I have tried compile with netcdf compression turned on and off with no change. I have increased the stack size, and redownloaded the WPS_GOEG files to no avail. I have had to add the -fallow-argument-mismatch -fallow-invalid-boz flags. Any ideas

View attachment geogrid.log
It may be possible to get a more informative stack trace if both the WPS and WRF (which supplies the I/O routines to the WPS) are compiled with some additional flags. Could you give the following a try?

1) Completely clean (./clean -a) the WRF code, then configure with full debugging options using "./configure -D", which should add -g -fbacktrace, -fcheck=..., and a few other options to the set of Fortran compiler flags.

2) Compile the WRF code.

3) Configure the WPS as usual with ./configure.

4) Manually edit the configure.wps file, adding "-g -fcheck=all -fbacktrace" to the definitions of FFLAGS and F77FLAGS.

5) Compile the WPS code.
I did a clean -a in the WRF directory , did a configure -D and rebuilt WRF, then did the same thing with WPS and compile geogrid. Running with gdb gives:
rpasken@thunder> geogrid.exe
Parsed 49 entries in GEOGRID.TBL
Processing domain 1 of 1
Processing XLAT and XLONG
At line 625 of file wrf_io.f
Fortran runtime error: Substring out of bounds: upper bound (11) of 'memord' exceeds string length (3)

Error termination. Backtrace:
#0 0x800c1f6db in ???
#1 0x800c204e0 in ???
#2 0x800c20b36 in ???
#3 0x49179d in __ext_ncd_support_routines_MOD_lowercase
at /seamless/WRF/WRF/external/io_netcdf/wrf_io.f:625
#4 0x492871 in __ext_ncd_support_routines_MOD_getdim
at /seamless/WRF/WRF/external/io_netcdf/wrf_io.f:443
#5 0x4cc35f in ext_ncd_write_field_
at /seamless/WRF/WRF/external/io_netcdf/wrf_io.f:7293
#6 0x42b8e3 in __output_module_MOD_write_field
at /seamless/WRF/WPS/geogrid/src/output_module.f90:1255
#7 0x439d8b in __output_module_MOD_output_init
at /seamless/WRF/WPS/geogrid/src/output_module.f90:276
#8 0x4458fd in __process_tile_module_MOD_process_tile
at /seamless/WRF/WPS/geogrid/src/process_tile_module.f90:268
#9 0x40463d in geogrid
at /seamless/WRF/WPS/geogrid/src/geogrid.f90:56
#10 0x404cb0 in main
at /seamless/WRF/WPS/geogrid/src/geogrid.f90:7

In the WRF file external/io_netcdf/wrf_io.f
subroutine LowerCase(MemoryOrder,MemOrd)
character*(*) ,intent(in) :: MemoryOrder
character*(*) ,intent(out) :: MemOrd
character*1 :: c
integer ,parameter :: upper_to_lower =IACHAR('a')-IACHAR('A')
integer :: i,N

MemOrd = ' '
N = 11
MemOrd(1:N) = MemoryOrder(1:N)
do i=1,N
c = MemoryOrder(i:i)
if('A'<=c .and. c <='Z') MemOrd(i:i)=achar(iachar(c)+upper_to_lower)
end subroutine LowerCase

It seems that rather than determining the length of the string it is forced to 11
I did a comparison of what centos-7 does when converting wrf_io.F90 to wrf_io.f and it would appear that cpp10 is messing with the conversion