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.
#2735 (Bug in nn_stocklist behaviour in some cases) – NEMO

Opened 7 months ago

Closed 3 weeks ago

#2735 closed Bug (fixed)

Bug in nn_stocklist behaviour in some cases

Reported by: timgraham Owned by: acc
Priority: low Milestone:
Component: IOM Version: v4.0.*
Severity: minor Keywords:
Cc:

Description

Context

When providing a list of restart timesteps to the model (via nn_stocklist) there is currently a problem if either of the following are met:

  • The first restart is requested at a timestep smaller that nit000
  • The first restart is requested at timestep nit000
  • If restarts are requested at consectutive time steps (I think this is an issue).

Analysis

In rst_opn this if statement sets the first value of nitrst based on nn_stocklist

      IF( kt == nit000 ) THEN   ! default definitions
         lrst_oce = .FALSE.
         IF( ln_rst_list ) THEN
            nrst_lst = 1
            nitrst = nn_stocklist( nrst_lst )
         ELSE
            nitrst = nitend
         ENDIF
      ENDIF

Later in the subroutine this line triggers the opening of a restart file
IF( kt == nitrst - 1 .OR. nn_stock == 1 .OR. ( kt == nitend .AND. .NOT. lrst_oce ))
but if the first requested timestep is <= nit000 then this if statement is never satisfied until kt==nitend and the final restart file will be written out with an incorrect name (based on the first value of nn_stocklist).

Fix

Still being investigated.

Commit History (2)

ChangesetAuthorTimeChangeLog
15810smasson2022-05-04T16:48:12+02:00

replace findloc by a do loop, see #2735

15596acc2021-12-13T17:28:47+01:00

Changes to restart.F90 and trcrst.F90 to address #2735 and cope with requests in nn_stocklist outside the simulation period. These changes also enable a restart file to be generated on nit000, if requested, and will force a restart at nitend even if it is not explicitly listed in nn_stocklist. This closes #2735

Change History (5)

comment:1 follow-up: Changed 7 months ago by acc

Will something like:

nitrst   = MIN( nitend, MINVAL( nn_stocklist, MASK=nn_stocklist.gt.nit000) )
nrst_lst = MAX( 1, FINDLOC( nn_stocklist, nitrst, DIM=1 ) )

be enough to catch any inappropriate input from the user?

comment:2 in reply to: ↑ 1 Changed 7 months ago by timgraham

Replying to acc:

Will something like:

nitrst   = MIN( nitend, MINVAL( nn_stocklist, MASK=nn_stocklist.gt.nit000) )
nrst_lst = MAX( 1, FINDLOC( nn_stocklist, nitrst, DIM=1 ) )

be enough to catch any inappropriate input from the user?

I think that solves the first point. I've done something similar with a DO WHILE statement but I think your syntax is probably neater. There is still an issue if the user requests a restart on the first time step. At the moment this case still gets missed by the later IF statement.

comment:3 Changed 5 months ago by acc

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

In 15596:

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

comment:4 Changed 3 weeks ago by smasson

  • Resolution fixed deleted
  • Status changed from closed to reopened

FINDLOC function is a fortran 2008 intrinsic.
This looks old enough to be used in the code but FINDLOC is supported by gcc only from version 9.0 (2018-10-28).
We decide to replace it by an old style loop to avoid any compilation issue.

comment:5 Changed 3 weeks ago by smasson

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

fixed in [15810]

Note: See TracTickets for help on using tickets.