Problems linking with ww3_grib with Wavewatch III

I am trying to compile a program in Wavewatch III with a modified version of the switch NCEP_glwu, in which grib files are used. In the modified version of NCEP_glwu I simply deleted the switches NOPA and LRB4, since they have been deprecated. In any case, I have tried with other switches (e.g., Ifremer1) and I always find the same problem. 

Using the modified NCEP_glwu switch, in which NOPA and LRB4 have been removed, I always get an error message during the compilation procedure when ad3, after processing ww3_grib, tries to link this file (ww3_grib). This is the error:

Processing ww3_grib

---------------------

ad3 : processing ww3_grib

Linking ww3_grib

make: *** [makefile:400: /home/tesalia/WW3/model/exe/ww3_grib] Error 1

I checked the makefile located at WW3/model/src. Line 400 in makefile states:

@$(aPb)/link ww3_grib w3parall wmmdatmd w3triamd w3gdatmd w3wdatmd w3adatmd w3idatmd w3odatmd w3sdb1md w3sbt1md w3src4md w3flx1md w3snl3md w3iogrmd w3iogomd constants w3servmd w3timemd w3arrymd w3dispmd w3gsrumd

I also checked the ad3 file, located at WW3/model/bin and I saw that Error 1 refers to Input errors. Therefore, I checked the ww3_grib file that should be located at WW3/model/exe and it does not exist. In other words, it is not created by my model. I think this may be the source of the problem, but I do not know how to handle it. Below I describe my configuration.

Error files (especially ww3_grib.err) and logs located at WW3/model/tmp are empty. The only file with some content is located at WW3/model/obj_SEQ/link.err, and states:

gfortran: error: big_endian: File or directory not found

gfortran: error: byterecl: File or directory not found

gfortran: error: unrecognized command line option ‘-convert’; did you mean ‘-fconvert=’?

gfortran: error: unrecognized command line option ‘-assume’

gfortran: error: unrecognized command line option ‘-prec-div’

gfortran: error: unrecognized command line option ‘-prec-sqrt’

gfortran: error: unrecognized command line option ‘-ip’; did you mean ‘-p’?

I do not know how to handle this information. Reading on the Internet, I found a solution that suggest changing line 111 in link.tmpl (WW3/model/bin/link.tmpl) from:

opt="$opt -convert big_endian -assume byterecl -prec-div -prec-sqrt -ip"

To:

opt="$opt -fconvert=big-endian -assume byterecl -prec-div -prec-sqrt -ip"

As a result, the first line of the aforementioned error disappeared (i.e., "gfortran error: big_endian (...)). I tried to change the remaining parts of line 111 (i.e., -assume byterecl-prec-div-prec-sqrt-ip), but I do not find the proper synthax to do so.

To Reproduce

Since I have other programs using some libraries required for WW3 (e.g., I have install a WRF model that also uses jasper, zlib and png), I am not using a hpc-stack nor something similar. I have installed almost all libraries by hand. Next, I detail the libraries that were installed in my system before installing WW3:

NetCDF

nf-config --version -> Output: netCDF-Fortran 4.5.2 nf-config --has-nc4-> Output: yes

Jasper -> Jasper 1.900.1
HDF5 -> HDF5 1.10.4
zlib -> 1.2.11
libpng -> 1.6.37
libjpeg -> 8.2.2

 

I installed these other libraries (code is described too):

CMake (Please, see https://github.com/Kitware/CMake/tree/21e60da5bb0715e09f2feba5930ea2c8bc8180af) -> Version 3.22.2021

git clone https://github.com/Kitware/CMake.git

cd CMake

./bootstrap --prefix=/home/tesalia/cmake -- -DCMAKE_USE_OPENSSL=OFF

./bootstrap && make && sudo make install

NCEPLIBS (it includes several libraries. Please, see https://github.com/NOAA-EMC/NCEPLIBS)

git clone https://github.com/NOAA-EMC/NCEPLIBS

mkdir -p build && cd build

cmake –DCMAKE_INSTALL_PREFIX=/usr/lib/x86_64-linux-gnu/nceplibs /home/tesalia/NCEPLIBS

sudo make

WAVEWATCH 3 (I am using my own fork, but the library is exactly the same, saving from some modified switches as indicated above)

sudo git clone https://github.com/Josue9740/WW3

cd WW3

sudo sh model/bin/ww3_from_ftp.sh

 

I declared these environment variables in ~/.bash_profile

export PNG_LIB=/usr/lib/x86_64-linux-gnu/libpng.a

export Z_LIB=/usr/lib/x86_64-linux-gnu/libz.a

export JASPER_LIB=/usr/lib/x86_64-linux-gnu/libjasper.a

export G2_LIB4=/usr/local/g2-3.4.1/lib/libg2_4.a

export W3NCO_LIB4=/usr/local/w3nco-2.4.1/lib/libw3nco_4.a

export BACIO_LIB4=/usr/local/bacio-2.4.1/lib/libbacio_4.a

 

Model compilation

sudo ./model/bin/w3_setup model -c gnu -s NCEP_glwu

cd model/bin sudo ./w3_make ww3_grib

As indicated above, NCEP_glwu is a modified version without the switches NOPA and LRB4. I am using gnu compiler since if I use the same code but replacing -c gnu by -c intel I get the next error:

/home/tesalia/WW3/model/bin/ad3: línea 215: ifort: command not found

*** w3adc error ***

file constants.F90 not found (2)

I do not know why the intel compiler does not work (my system has installed ifort 2021.4.0) or why linking the ww3_grib file always produces a linking error if all the required libraries and the environment variables have been set.

In order to provide further explanations on my problem, I have tried to run the next example test: 

sudo ./bin/run_test -s MPI -w ../model_examples/work_ww3_ufs1.1 -m grdset_c -f -p mpirun -n 24 -o all ../model ww3_ufs1.1

However, the next error arises:

+--------------------+
|  Grid preprocessor |
+--------------------+


                *****************************
              ***   WAVEWATCH III make      ***
                *****************************

Main directory    : /home/tesalia/WW3/model
Scratch directory : /home/tesalia/WW3/model/tmp
Save source codes : yes
Save listings     : yes
Shared Object     : No

[INFO] list of the programs selected : ww3_grid

Processing ww3_grid
---------------------
ad3 : processing w3gdatmd
ad3 : processing scrip_kindsmod [no w3adc]
mv: cannot stat 'scrip_kindsmod.o': No such file or directory
mv: cannot stat 'w3gdatmd.o': No such file or directory
ad3 : processing scrip_iounitsmod [no w3adc]
ad3 : processing scrip_timers [no w3adc]
ad3 : processing scrip_constants [no w3adc]
ad3 : processing w3odatmd
mv: cannot stat 'scrip_iounitsmod.o': No such file or directory
mv: cannot stat 'scrip_constants.o': No such file or directory
mv: cannot stat 'scrip_timers.o': No such file or directory
mv: cannot stat 'w3odatmd.o': No such file or directory
ad3 : processing w3idatmd
ad3 : processing scrip_errormod [no w3adc]
ad3 : processing w3timemd
ad3 : processing w3dispmd
mv: cannot stat 'scrip_errormod.o': No such file or directory
mv: cannot stat 'w3idatmd.o': No such file or directory
mv: cannot stat 'w3timemd.o': No such file or directory
ad3 : processing w3nmlgridmd
mv: cannot stat 'w3dispmd.o': No such file or directory
ad3 : processing scrip_netcdfmod [no w3adc]
ad3 : processing wmmdatmd
ad3 : processing w3flx1md
mv: cannot stat 'scrip_netcdfmod.o': No such file or directory
mv: cannot stat 'w3nmlgridmd.o': No such file or directory
ad3 : processing w3adatmd
ad3 : processing w3src4md
mv: cannot stat 'w3flx1md.o': No such file or directory
mv: cannot stat 'wmmdatmd.o': No such file or directory
ad3 : processing scrip_grids [no w3adc]
mv: cannot stat 'w3src4md.o': No such file or directory
mv: cannot stat 'w3adatmd.o': No such file or directory
mv: cannot stat 'scrip_grids.o': No such file or directory
ad3 : processing w3triamd
ad3 : processing w3snl1md
ad3 : processing w3parall
ad3 : processing scrip_remap_vars [no w3adc]
mv: cannot stat 'w3snl1md.o': No such file or directory
mv: cannot stat 'w3parall.o': No such file or directory
mv: cannot stat 'w3triamd.o': No such file or directory
mv: cannot stat 'scrip_remap_vars.o': No such file or directory
ad3 : processing w3iogrmd
ad3 : processing w3wdatmd
ad3 : processing scrip_remap_write [no w3adc]
ad3 : processing scrip_remap_conservative [no w3adc]
mv: cannot stat 'w3iogrmd.o': No such file or directory
mv: cannot stat 'w3wdatmd.o': No such file or directory
mv: cannot stat 'scrip_remap_conservative.o': No such file or directory
mv: cannot stat 'scrip_remap_write.o': No such file or directory
ad3 : processing scrip_remap_read [no w3adc]
mv: cannot stat 'scrip_remap_read.o': No such file or directory
ad3 : processing scrip_interface
mv: cannot stat 'scrip_interface.o': No such file or directory
ad3 : processing wmscrpmd
mv: cannot stat 'wmscrpmd.o': No such file or directory
ad3 : processing w3gridmd
mv: cannot stat 'w3gridmd.o': No such file or directory
ad3 : processing ww3_grid
mv: cannot stat 'ww3_grid.o': No such file or directory
: no valid option
make: *** [makefile:43: /home/tesalia/WW3/model/exe/ww3_grid] Error 1

ERROR: Error occured during WW3 ww3_grid build
 

There is an error message in some files contained into the path WW3/model/tmp, which states:


/home/tesalia/WW3/model/bin/comp: line 98: -c: command not found

Can anybody help me? Thank you so much.

I'd recommend two things: 

First: Try cleaning the model using: 

./model/bin/w3_clean -c  

I think your issues with the run_test likely just needs to be cleaned before being run again. 

Second: For your grib issues, likely a variable just needs to be defined.  WW3 expects the following (see https://github.com/NOAA-EMC/WW3/blob/develop/model/bin/link.tmpl#L111) to be defined based on your library locations: 

${G2_LIB4} ${W3NCO_LIB4} ${BACIO_LIB4} ${JASPER_LIB} ${PNG_LIB} ${Z_LIB}" 

I'd recommend using echo $var for each of these variables and make sure that they are defined and point to an existing library.  

 

 

 

Permalink

In reply to by Jessica.meixner

Dear Jessica,

None of this worked. I have declared the environment variables and I did check they exist, among many other checks. In fact, I have added additional environment variables I read about on different forums. I have discovered that my system is also running the WRF model, which was installed some time ago. There seems to be some kind of incompatibility between the libraries. Finally, I handle this problem by constructing the WW3 program into a Docker. It is working perfectly right now. 

Thank you so much for all your kind help and assitance.