Opened 5 months ago

Closed 5 months ago

Last modified 6 days ago

#2514 closed Bug (fixed)

unallocated ICE variable (a_i_last_couple) when using SAS+OASIS

Reported by: gsamson Owned by: gsamson
Priority: low Milestone:
Component: SI3 Version: release-4.0
Severity: minor Keywords: ICE, SI3, SAS, OASIS
Cc: clem, smasson Branch review: failed
MP ready?: no Task progress: Unspecified

Description (last modified by smasson)

Context

In nemo 4.0.3, a new variable "a_i_last_couple" (Ice fractional area at last coupling time) has been introduced in "ice_alloc" specifically for atm coupling.

Analysis

However, when using SAS+OASIS, this new variable is used in "sbc_cpl_init" before it has been allocated in "ice_alloc", causing the model to crash.

Fix

Move "a_i_last_couple" variable declaration and allocation from ice.F90 to sbccpl.F90

Bonus: "info" variable is not initialised at the first call of "sbc_cpl_snd" routine and should be initialised to "info = OASIS_idle" for exemple

Commit History (2)

ChangesetAuthorTimeChangeLog
14321dancopsey2021-01-20T15:31:58+01:00

Revert the code change that went into NEMO4.0.4 as changeset [13444] and ticket #2514. This crashes the Met Office coupled model as a_i_last_couple is allocated in sbc_cpl_alloc ahead of when jpl is set (jpl is set in par_init). Therefore it is allocated an array size with the wrong value of jpl. When it then copies a_i into this array (in sbc_cpl_snd) it puts data off the end of the array into random memory. During the next call to OASIS (i.e. call cpl_snd) some of this affected memory is processed and a segmentation fault occurs.

13444gsamson2020-08-31T10:58:55+02:00

move 'a_i_last_couple' variable declaration and allocation from ice.F90 to sbccpl.F90; delete cice specific declaration from sbc_ice.F90 and inialize 'info' variable to 'OASIS_idle' in sbc_cpl_snd routine (sbccpl.F90); see ticket #2514

Change History (5)

comment:1 Changed 5 months ago by smasson

  • Description modified (diff)

comment:2 Changed 5 months ago by smasson

I agree with your proposition. a_i_last_couple is used only in sbccpl, there is no real need to declare and allocate it somewhere else. Don't forget to also remove a_i_last_couple declaration in sbc_ice.

I also agree with the "bonus". I think this one should also be done in the trunk.

comment:3 Changed 5 months ago by gsamson

In 13444:

move 'a_i_last_couple' variable declaration and allocation from ice.F90 to sbccpl.F90; delete cice specific declaration from sbc_ice.F90 and inialize 'info' variable to 'OASIS_idle' in sbc_cpl_snd routine (sbccpl.F90); see ticket #2514

comment:4 Changed 5 months ago by gsamson

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

comment:5 Changed 6 days ago by dancopsey

In 14321:

Revert the code change that went into NEMO4.0.4 as changeset [13444] and ticket #2514. This crashes the Met Office coupled model as a_i_last_couple is allocated in sbc_cpl_alloc ahead of when jpl is set (jpl is set in par_init). Therefore it is allocated an array size with the wrong value of jpl. When it then copies a_i into this array (in sbc_cpl_snd) it puts data off the end of the array into random memory. During the next call to OASIS (i.e. call cpl_snd) some of this affected memory is processed and a segmentation fault occurs.

Note: See TracTickets for help on using tickets.