Opened 8 months ago

Closed 8 months ago

#2343 closed Bug (fixed)

minor bug to do with Euler timestepping in TOP

Reported by: davestorkey Owned by: davestorkey
Priority: low Milestone: Unscheduled
Component: TOP Version: trunk
Severity: minor Keywords:
Cc: acc

Description

Context

In TOP/TRP/trcnxt.F90 we have the following code to do time-level swapping in the case of Euler timestepping.

      IF( (neuler == 0 .AND. kt == nittrc000) .OR. ln_top_euler ) THEN    ! Euler time-stepping (only swap)
         DO jn = 1, jptra
            DO jk = 1, jpkm1
               trn(:,:,jk,jn) = tra(:,:,jk,jn)
               trb(:,:,jk,jn) = trn(:,:,jk,jn)  
            END DO
         END DO

For the case ln_top_euler = T then this is correct because we want trb = trn always. But in the case ln_top_euler = F but neuler = 0 and kt = nittrc000 this is slightly incorrect because it is setting up to do an Euler timestep on the second timestep instead of a leapfrog timestep.

This is a very minor bug but needs to be fixed in order to obtain bit comparison with the branches/2019/Coward_Storkey_IMMERSE_first_steps branch.

Analysis


Fix

Code the ln_top_euler == T and ( neuler == 0 .and. nittrc000 == 1 ) cases separately as follows:

      IF( (neuler == 0 .AND. kt == nittrc000) ) THEN
         ! set up for leapfrog on second timestep
         DO jn = 1, jptra
            DO jk = 1, jpkm1
               trb(:,:,jk,jn) = trn(:,:,jk,jn)  
               trn(:,:,jk,jn) = tra(:,:,jk,jn)
            END DO
         END DO
      ELSE IF( ln_top_euler ) THEN
         ! always doing euler timestepping
         DO jn = 1, jptra
            DO jk = 1, jpkm1
               trn(:,:,jk,jn) = tra(:,:,jk,jn)
               trb(:,:,jk,jn) = trn(:,:,jk,jn)  
            END DO
         END DO
      ENDIF
      IF( (neuler == 0 .AND. kt == nittrc000) .OR. ln_top_euler ) THEN    ! Euler time-stepping (only swap)
         IF (l_trdtrc .AND. .NOT. ln_linssh ) THEN   ! Zero Asselin filter contribution must be explicitly written out since for vvl
            !                                        ! Asselin filter is output by tra_nxt_vvl that is not called on this time step
            ztrdt(:,:,:,:) = 0._wp            
            DO jn = 1, jptra
               CALL trd_tra( kt, 'TRC', jn, jptra_atf, ztrdt(:,:,:,jn) )
            ENDDO
         END IF
         !
      ELSE     
         IF( .NOT. l_offline ) THEN ! Leap-Frog + Asselin filter time stepping
            IF( ln_linssh ) THEN   ;   CALL tra_nxt_fix( kt, nittrc000,         'TRC', trb, trn, tra, jptra )  !     linear ssh
            ELSE                   ;   CALL tra_nxt_vvl( kt, nittrc000, rdttrc, 'TRC', trb, trn, tra,      &
              &                                                                   sbc_trc, sbc_trc_b, jptra )  ! non-linear ssh
            ENDIF
         ELSE
                                       CALL trc_nxt_off( kt )       ! offline 
         ENDIF
         !
         CALL lbc_lnk_multi( 'trcnxt', trb(:,:,:,:), 'T', 1._wp, trn(:,:,:,:), 'T', 1._wp, tra(:,:,:,:), 'T', 1._wp )
      ENDIF

Commit History (1)

ChangesetAuthorTimeChangeLog
12026davestorkey2019-12-02T15:54:57+01:00

Small bug fixes to to initial Euler timestep and OFF timestepping to ensure bit comparison the IMMERSE_first_steps branch with the trunk. Tickets #2310, #2311, #2343 apply.

Change History (2)

comment:1 Changed 8 months ago by davestorkey

In 12026:

Small bug fixes to to initial Euler timestep and OFF timestepping to ensure
bit comparison the IMMERSE_first_steps branch with the trunk.
Tickets #2310, #2311, #2343 apply.

comment:2 Changed 8 months ago by smasson

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.