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.
#496 (Fix output state following an error state trapped by stpctl.F90) – NEMO

Opened 15 years ago

Closed 15 years ago

#496 closed Bug (fixed)

Fix output state following an error state trapped by stpctl.F90

Reported by: acc Owned by: nemo
Priority: low Milestone:
Component: OCE Version: trunk
Severity: Keywords:
Cc:

Description (last modified by ctlod)

The recent rearrangement of step has placed the main call to dia_wri at the top to the time step loop. If error conditions (large U, negative salinity etc.) are detected in stp_ctl (called at the
bottom of the loop), then dia_wri is again called in an attempt to
flush and close the mean files. This now raises a fatal error in
histcom.f90:

FATAL ERROR FROM ROUTINE histwrite

--> This variable as already been analysed at the present
--> time step

and the code aborts before creating the expected output.abort files.

A solution is to split the dual-purpose test at the bottom of dia_wri:

! 3. Close all files
! ---------------------------------------
IF( kt == nitend .OR. kindic < 0 ) THEN

CALL histclo( nid_T )
CALL histclo( nid_U )
CALL histclo( nid_V )
CALL histclo( nid_W )

ENDIF

making this test simply:

! 3. Close all files
! ---------------------------------------
IF( kt == nitend ) THEN

CALL histclo( nid_T )
CALL histclo( nid_U )
CALL histclo( nid_V )
CALL histclo( nid_W )

ENDIF

and placing the following before the IF(kt == nit000 ) test at the
top of dia_wri:

! Close all files and return if an error has been detected
! --------------------------------------------------------
IF( kindic < 0 ) THEN

CALL histclo( nid_T )
CALL histclo( nid_U )
CALL histclo( nid_V )
CALL histclo( nid_W )
RETURN

ENDIF




Commit History (2)

ChangesetAuthorTimeChangeLog
1567ctlod2009-07-31T16:39:55+02:00

DIMG: remove kindic argument from dia_wri call subroutine, see ticket: #509 & #496

1561ctlod2009-07-30T10:50:07+02:00

Fix output state following an error state trapped by stpctl.F90, see ticket: #496

Change History (2)

comment:1 Changed 15 years ago by acc

A solution is to split the dual-purpose test at the bottom of dia_wri:


   ! 3. Close all files 
    ! --------------------------------------- 
    IF( kt == nitend .OR. kindic < 0 ) THEN
     CALL histclo( nid_T ) 
     CALL histclo( nid_U )
     CALL histclo( nid_V ) CALL histclo( nid_W )
    ENDIF

making this test simply:

    ! 3. Close all files 
    ! --------------------------------------- 
      IF( kt == nitend ) THEN
        CALL histclo( nid_T ) 
        CALL histclo( nid_U ) 
        CALL histclo( nid_V ) 
        CALL histclo( nid_W )
      ENDIF

and placing the following before the IF(kt == nit000 ) test at the top of dia_wri:

    ! Close all files and return if an error has been detected 
    ! -------------------------------------------------------- 
      IF( kindic < 0 ) THEN
        CALL histclo( nid_T ) 
        CALL histclo( nid_U ) 
        CALL histclo( nid_V )
        CALL histclo( nid_W ) 
        RETURN
      ENDIF

comment:2 Changed 15 years ago by ctlod

  • Description modified (diff)
  • Resolution set to fixed
  • Status changed from new to closed

actually we could go further with a small clean of routines.
no more call to dia_wri in stpctl.F90 is required to close NecCDF files.
instead the closing sequence (in case of an interrupted run) is move into dia_wri_state under the conditions ninist ≠ 1 and cpp key key_iomput not defined.
In dia_wri subroutine only remains the simplified test on nitend as described above to close files in case of a "normal ending run".
the kindic parameter is removed from dia_wri subroutine sequence.

Note: See TracTickets for help on using tickets.