Subject: COAWST 3.8: SWAN crashes when NnodesWAV > 1 in WRF–SWAN–ROMS coupling
Dear ROMS/COAWST community,
I am running a three-way coupled WRF–SWAN–ROMS application using COAWST 3.8. The model compiles successfully, but it crashes at runtime when the SWAN/WAV component uses more than one MPI task.
The key point is:
```fortran
NnodesOCN = 1
NnodesWAV = 1
NnodesATM = 1
```
This configuration runs.
Also:
```fortran
NnodesOCN = 2
NnodesWAV = 1
NnodesATM = 2
```
This configuration runs as well.
However:
```fortran
NnodesOCN = 2
NnodesWAV = 2
NnodesATM = 2
```
crashes immediately during initialization.
The `couple.log` shows that the WAV component is assigned to MPI tasks `00002 - 00003`:
```text
Ocean Model MPI nodes: 00000 - 00001
Waves Model MPI nodes: 00002 - 00003
Atmos Model MPI nodes: 00004 - 00005
```
The traceback shows that task 2, which is the first WAV/SWAN task, crashes in `waves_coupler.f`:
```text
forrtl: severe (174): SIGSEGV, segmentation fault occurred
coawstM
waves_coupler_mod
waves_coupler.f, line 636
waves_control_mod
waves_control.f, line 87
MAIN__
master.f90, line 363
task 2: Exited with exit code 174
```
Therefore, the problem seems to be triggered specifically by:
```text
NnodesWAV > 1
```
It does not appear to be caused by the ROMS or WRF parallel decomposition, because ROMS and WRF can run with two MPI tasks when SWAN remains serial.
## Model/environment information
```text
COAWST version: 3.8
WRF version: 4.5
SWAN library: libswan41.45.a
Compiler: Intel ifort 19.0.4
MPI: MPICH 4.0.2
NetCDF: 4.8.0
PnetCDF: 1.12.2
Coupler: MCT
Components: WRF + SWAN + ROMS
```
## Grid information
```text
ROMS grid: 480 x 430 x 20
SWAN grid: CGRID CURVILINEAR 481 431 ...
SWAN grid points: 482 x 432 = 208224
WRF domain: 547 x 485
```
## SCRIP weight file
The SCRIP weight file contains all six mappings:
```text
ocn1_to_wav1
wav1_to_ocn1
ocn1_to_atm1
atm1_to_ocn1
wav1_to_atm1
atm1_to_wav1
```
The OCN/WAV dimensions are consistent with the SWAN grid:
```text
ocn1_to_wav1: src_grid_size = 208224, dst_grid_size = 208224
wav1_to_ocn1: src_grid_size = 208224, dst_grid_size = 208224
atm1_to_wav1: src_grid_size = 264264, dst_grid_size = 208224
wav1_to_atm1: src_grid_size = 208224, dst_grid_size = 264264
```
The number of links is not zero.
## Active CPP options
The active options include:
```text
SWAN_COUPLING
WAVES_OCEAN
WRF_COUPLING
MCT_LIB
SPECTRUM_STOKES
WEC_VF
WDISS_WAVEMOD
UV_KIRBY
ATM2OCN_FLUXES
FRC_COUPLING
```
## Additional test
I also modified the character buffer lengths in `SWAN/src/waves_coupler.ftn` from:
```fortran
# ifdef SPECTRUM_STOKES
character (len=520) :: wostring
character (len=140) :: owstring
# else
character (len=120) :: wostring
character (len=120) :: owstring
# endif
```
to:
```fortran
# ifdef SPECTRUM_STOKES
character (len=5000) :: wostring
character (len=1000) :: owstring
# else
character (len=500) :: wostring
character (len=500) :: owstring
# endif
```
Then I recompiled SWAN and relinked COAWST, but the same crash still occurs when `NnodesWAV = 2`.
## Question
Does COAWST 3.8 support MPI-parallel SWAN coupling with `NnodesWAV > 1` in a three-way WRF–SWAN–ROMS configuration, especially when `SPECTRUM_STOKES`, `WEC_VF`, and `WAVES_OCEAN` are enabled?
If yes, could anyone suggest where to debug this `waves_coupler.f line 636` crash?
I suspect it may be related to one of the following:
```text
SWAN parallel grid decomposition
MCT GlobalSegMap initialization
AttrVect initialization
local/global WAV grid indexing
SPECTRUM_STOKES or WEC-related WAV fields in parallel mode
```
At present, the only stable workaround is:
```fortran
NnodesOCN = multiple tasks
NnodesWAV = 1
NnodesATM = multiple tasks
```
Any suggestions would be greatly appreciated.
Best regards,
COAWST 3.8: SWAN crashes when NnodesWAV > 1 in WRF–SWAN–ROMS coupling
-
Rocky_Wang
- Posts: 51
- Joined: Tue Mar 01, 2016 1:38 am
- Location: the Ocean University of China