New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
#2340 (Segmentation fault in river runoffs) – NEMO

Opened 5 years ago

Closed 5 years ago

Last modified 3 years ago

#2340 closed Bug (fixed)

Segmentation fault in river runoffs

Reported by: tkarna Owned by: systeam
Priority: low Milestone:
Component: SBC Version: v4.0
Severity: critical Keywords: rivers segfault v4.0
Cc:

Description

Context

River runoffs can cause a segmentation fault.

Analysis

The river runoff routine (in file src/OCE/SBC/sbcrnf.F90) searches for the number of vertical levels over which the river runoff will be distributed. The corresponding do loop (see lines 343 and 400) has a poor ending condition: if mbkt(ji,jj)=1 the loop will never finish. This causes a segmentation fault in the gdept_0 array.

jk = 2
DO WHILE ( jk /= mbkt(ji,jj) .AND. gdept_0(ji,jj,jk) < h_rnf(ji,jj) ) ;  jk = jk + 1
END DO

Fix

The fix is to use a more generic < end condition in both loops (it's also better programming style):

jk = 2
DO WHILE ( jk < mbkt(ji,jj) .AND. gdept_0(ji,jj,jk) < h_rnf(ji,jj) ) ;  jk = jk + 1
END DO

Commit History (1)

ChangesetAuthorTimeChangeLog
12168smasson2019-12-11T10:16:47+01:00

trunk: minor bugfix in sbcrfn, see #2340

Change History (5)

comment:1 Changed 5 years ago by smasson

In 12168:

Error: Failed to load processor CommitTicketReference
No macro or processor named 'CommitTicketReference' found

comment:2 Changed 5 years ago by clem

Ok, this has been corrected in the trunk at r12168
However, if you get a seg fault it would probably mean that you try to apply runoff on land.

comment:3 Changed 5 years ago by tkarna

Great, thanks! Yes, this case corresponds to a setup where one accidentally applies runoff on land. It's good that it does not cause segmentation fault anymore. Maybe Nemo could raise an error or a warning in such a case?

comment:4 Changed 5 years ago by smasson

  • Resolution set to fixed
  • Status changed from new to closed

comment:5 Changed 3 years ago by nemo

  • Keywords v4.0 added; removed
Note: See TracTickets for help on using tickets.