The OASIS Coupler Forum

  HOME

WAVEWATCH3 & OASIS3-MCT

Up to Specific issues in real coupled models

Posted by Anonymous at December 21 2023

Hi,

I just download and compile OASIS3-MCT 5.0 and I also compile the tutorial model. I could also run the tutorial model and apparently it worked ok.
Now I tried to compile the WAVEWATCH3 section on the OASIS3-MCT5.0 interface, but ran into some problems halfway through:
I read the user manual of WW3 (hereinafter referred to as WAVEWATCH3 for short), which actually has OASIS3-MCT built-in, and according to it, only three switches need to be turned on when compiling WW3, and then there is a problem:
Problem 1. Compile the order and OASIS3-MCT version of the problem: Although WW3 built-in OASIS3-MCT, but the location of the coupler is located in the EXAMPLE folder (i.e., there are many examples of test algorithms within the WW3, one of the algorithms tp2.14 involves the WW3 on the coupling of the OASIS3-MCT), I do not know the built-in OASIS3-MCT version (whether it will be due to the OASIS3-MCT version), I do not know the built-in OASIS3-MCT version (whether it will be due to the OASIS3-MCT version of the WW3). MCT version (whether it will be a problem because of the version), and there is a doubt about the order of compiling the WAVEWATCH3 part of the interface to OASIS3-MCT5.0 (whether to compile OASIS3-MCT first or other parts first).
Problem 2. Link problem in compilation: Under the premise that OASIS (hereinafter referred to as OASIS3-MCT) is already included in the default WW3 source code, I tried to compile WW3 directly by turning on the switch, but I was prompted with the lack of mpif.h. I solved the problem by dragging the missing file into the corresponding folder directly, and then WW3 was successfully compiled to generate the required . O file. When I was linking OASIS (I used the library generated by OASIS3-MCT which I compiled before) with WW3, I got the following message:
/usr/bin/ld: m_ExchangeMaps.F90:(.text+0xecb): undefined reference to `mpi_recv_'
/usr/bin/ld: /home/fvcom/WW3/model/oasis3mctgnu/lib/libmct.a(m_SparseMatrixComms.o): in function `__m_sparsematrixcomms_MOD_bcast_'.
I guess it is because the Gnu compiler I used to compile WW3 is different from the openmpi compiler I used to compile OASIS, but it is not easy to change it (WW3 always has problems with other compilers, and OASIS always has problems with compilers other than openmpi) so I would like to ask you for some advice.
In addition, there are no other scholars who also compile WAVEWATCH3 part of the interface on OASIS3-MCT5.0, the current problem is difficult to solve, and I sincerely hope that we can get a simple! 
Thanks in advance. Regards Tony

Posted by Anonymous at December 21 2023

Dear Tony,

I have substantial experience with OASIS3-MCT5.0 and WAVEWATCH III, and I have built/ported two modelling systems that use them. I have done so with GCC/gfortran+MPICH as well as with the IBM compilers. Getting WAVEWATCH III to work with OASIS3-MCT is not trivial, but the flexibility of OASIS3-MCT as a coupling system makes it very worthwhile to use. And as you note, OASIS3-MCT capability is indeed built into WAVEWATCH III.   

The first principle I learned while getting started with these programs is to compile them with the same serial and parallel compilers. Even updating a netCDF library for one component program and not another can break your modelling system. But I found the Cmake approach intrinsic to WAVEWATCH III to be fairly clunky. I therefore use FCM (see install guide at: https://metomi.github.io/fcm/doc/installation/).

WAVEWATCH III then can be built in this way for GCC/gfortran+MPICH: 

Make a fcm-make.cfg file like the below (between the dashes) wherever you want to build the model (feel free to change the switches according to your needs, but OASOCM and OASIS are what you need to couple with an ocean model):
---------------------------------------------------------------------------
steps = extract preprocess build
extract.ns = test1
extract.location[test1] = (the location of the WAVEWATCH III top-level directory)
extract.path-root[test1] = model/src
preprocess.prop{fpp.flags} = -traditional -DW3_F90 -DW3_NOGRB -DW3_NC4 -DW3_TRKNC -DW3_MPI -DW3_DIST -DW3_UNO -DW3_FLX0 -DW3_LN1 -DW3_ST4 -DW3_NL1 -DW3_BT1 -DW3_DB1 -DW3_TR0 -DW3_BS0 -DW3_IC0 -DW3_IS0 -DW3_REF0 -DW3_XX0 -DW3_WNT1 -DW3_W
NX1 -DW3_RWND -DW3_CRX1 -DW3_SMC -DW3_PR2 -DW3_RTD -DW3_COU -DW3_OASIS -DW3_OASOCM -DW3_CRT0 -DW3_SCRIP -DW3_SCRIPNC
build.target{task} = link
build.prop{fc} = mpif90 (or however you call your MPI Fortran compiler)
build.prop{cc} = mpicc (or however you call your MPI C compiler)
build.prop{fc.flags} = -DNDEBUG -O3 -g -fno-second-underscore -ffree-line-length-none -pthread -O3 -c
build.prop{cc.flags} = -DNDEBUG -O3 -g -fno-second-underscore -ffree-line-length-none -pthread -O3 -c
build.prop{fc.flag-include} = -I ./include (other include directories leading with -I, including for netCDF, the build-static/lib/mct or build/lib/mct for your OASIS install, the include for your OASIS install, and the lib/psmile.MPI1 for your OASIS install) 
build.prop{cc.flag-include} = -I ./include (other include directories leading with -I, including for netCDF, the build-static/lib/mct or build/lib/mct for your OASIS install, the include for your OASIS install, and the lib/psmile.MPI1 for your OASIS install) 
build.prop{fc.libs}=netcdff netcdf psmile.MPI1 mct mpeu scrip
build.prop{no-dep.include} = mpif.h
build.prop{no-dep.f.module} = netcdf esmf nuopc nuopc_connector nuopc_driver mod_oasis
build.prop{fc.defs} = ENDIANNESS="'big_endian'" W3_F90 W3_NOGRB W3_NC4 W3_TRKNC W3_DIST W3_MPI W3_PR3 W3_UNO W3_FLX0 W3_LN1 W3_ST4 W3_NL1 W3_BT1 W3_DB1 W3_TR0 W3_BS0 W3_IC0 W3_IS0 W3_REF0 W3_XX0 W3_WNT1 W3_WNX1 W3_RWND W3_CRX1 W3_SMC W3
_PR2 W3_RTD W3_COU W3_OASIS W3_OASOCM W3_CRT0 W3_SCRIP W3_SCRIPNC __WW3_SWITCHES__="'F90 NOGRB NC4 TRKNC DIST MPI PR3 UNO FLX0 LN1 ST4 NL1 BT1 DB1 TR0 BS0 IC0 IS0 REF0 XX0 WNT1 WNX1 RWND CRX1 SMC PR2 RTD COU OASIS OASOCM CRT0 SCRIP SCRIPNC'"
build.prop{cc.defs} = ENDIANNESS="'big_endian'" W3_F90 W3_NOGRB W3_NC4 W3_TRKNC W3_DIST W3_MPI W3_PR3 W3_UNO W3_FLX0 W3_LN1 W3_ST4 W3_NL1 W3_BT1 W3_DB1 W3_TR0 W3_BS0 W3_IC0 W3_IS0 W3_REF0 W3_XX0 W3_WNT1 W3_WNX1 W3_RWND W3_CRX1 W3_SMC W3
_PR2 W3_RTD W3_COU W3_OASIS W3_OASOCM W3_CRT0 W3_SCRIP W3_SCRIPNC __WW3_SWITCHES__="'F90 NOGRB NC4 TRKNC DIST MPI PR3 UNO FLX0 LN1 ST4 NL1 BT1 DB1 TR0 BS0 IC0 IS0 REF0 XX0 WNT1 WNX1 RWND CRX1 SMC PR2 RTD COU OASIS OASOCM CRT0 SCRIP SCRIPNC'"


---------------------------------------------------------------------------
Then type 

> fcm make

Any error messages should give you clues about what you need to change for your architecture.

Having trouble building OASIS3-MCT with anything but OpenMPI is odd to me. I have noticed a quirky bug when building with one of my GCC/gfortran+MPICH setups. It's associated with an error message related to ar.

You can get around this by forcing ar cq in the static archiver settings, building to a certain point, and then unforcing ar cq in the static archiver settings to build the SCRIP library properly. Unfortunately, my notes are too vague to provide the exact commands, so I am going to have to take some better notes the next time I encounter this issue so I can help the developers.

Until you get all of your component programs built properly, it's unlikely I can give you much help beyond what I give here. But if you start getting run-time error messages from WAVEWATCH III itself that you think have to do with coupling, I may be able to help. (There are a few gotchas...) Just post it in this forum and I'll see it.

Best regards,

Nick

Posted by Anonymous at December 22 2023

Dear Nick,

Thank you very sincerely for your guidance! I clearly realize my inexperience in compilation and model coupling, I will follow your easy and slowly correct the errors, but the first thing is to unify my WW3 and OASIS compilers, in order to save time, I compile WW3 with Gnu (gcc and g++, etc.), and compile OASIS with open mpi, I have to modify this part first, thank you again! Thanks again for your guidance!

Best regards,

Tony
Reply to this