Opened 12 months ago

Closed 8 months ago

#2311 closed Bug (fixed)

minor bug in code to do Euler timestep in dyn_nxt

Reported by: davestorkey Owned by: davestorkey
Priority: low Milestone: Unscheduled
Component: DYN Version: release-4.0
Severity: minor Keywords:
Cc: acc

Description

BE CAREFUL !!! Due to dynamic behaviour of this ticket creation page, it is highly recommend to set first all other fields before writing the ticket description below.
If you have lost your draft after an unwanted reload, you can click on the link 'Restore Form' in the contextual menu upper right to recover it.
Remove these lines after reading.

Context

If we use an Euler forward timestep at the beginning of the integration then we don't need to time-filter the fields and so we just swap them in the following lines in dyn_nxt:

! Time filter and swap of dynamics arrays
! —————————————————————
IF( neuler == 0 .AND. kt == nit000 ) THEN !* Euler at first time-step: only swap

DO jk = 1, jpkm1

un(:,:,jk) = ua(:,:,jk) ! un ←- ua
vn(:,:,jk) = va(:,:,jk)

END DO

For the velocity fields we just swap "after" to "now", not "now" to "before" because the "now" and "before" fields are initialised to be the same in istate_init. But with the time-split solution for the free surface the "now" field does in fact get updated in dyn_spg_ts to be consistent with the barotropic solution:

! Correct velocities so that the barotropic velocity equals (un_adv, vn_adv) (in all cases)
DO jk = 1, jpkm1

un(:,:,jk) = ( un(:,:,jk) + un_adv(:,:)*r1_hu_n(:,:) - un_b(:,:) ) * umask(:,:,jk)
vn(:,:,jk) = ( vn(:,:,jk) + vn_adv(:,:)*r1_hv_n(:,:) - vn_b(:,:) ) * vmask(:,:,jk)

END DO

So in fact the "now" velocity is different to the "before" velocity on an Euler timestep and we should swap "now" to "before" velocities in dyn_nxt.

(This is a very minor bug but it prevents me from obtaining bit comparison with the new version of the code with a time-dimension in the prognostic fields).

Analysis


Fix


Commit History (2)

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.

11480davestorkey2019-08-29T11:23:25+02:00

2019/dev_r10721_KERNEL-02_Storkey_Coward_IMMERSE_first_steps : Merge in changes from branch of branch. Main changes:

  1. "nxt" modules renamed as "atf" and now just do Asselin time filtering. The time level swapping is achieved by swapping indices.
  2. Some additional prognostic grid variables changed to use a time dimension.

Notes:

  1. This merged branch passes SETTE tests but does not identical results to the SETTE tests with the trunk@10721 unless minor bugs to do with Euler timestepping and the OFF timestepping are fixed in the trunk (NEMO tickets #2310 and #2311).
  2. The nn_dttrc > 1 option for TOP (TOP has a different timestep to OCE) doesn't work. But it doesn't work in the trunk or NEMO 4.0 release either.

Change History (4)

comment:1 Changed 12 months ago by jchanut

Removing the conditional statement at line 128 of dynnxt.F90 should work:

 IF( .NOT.ln_bt_fw ) THEN
	            ! Remove advective velocity from "now velocities"
	            ! prior to asselin filtering

Generally speaking: I think that barotropic fluxes correction should be implemented in the code as for ztilde diffusive fluxes (un_td, vn_td): Baroclinic velocities should remain unchanged during the time stepping, fluxes should be updated only when doing tracer advection and in the continuity equation.

comment:2 Changed 11 months ago by davestorkey

In 11480:

2019/dev_r10721_KERNEL-02_Storkey_Coward_IMMERSE_first_steps : Merge in changes from branch of branch.
Main changes:

  1. "nxt" modules renamed as "atf" and now just do Asselin time filtering. The time level swapping is achieved by swapping indices.
  2. Some additional prognostic grid variables changed to use a time dimension.

Notes:

  1. This merged branch passes SETTE tests but does not identical results to the SETTE tests with the trunk@10721 unless minor bugs to do with Euler timestepping and the OFF timestepping are fixed in the trunk (NEMO tickets #2310 and #2311).
  2. The nn_dttrc > 1 option for TOP (TOP has a different timestep to OCE) doesn't work. But it doesn't work in the trunk or NEMO 4.0 release either.

comment:3 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:4 Changed 8 months ago by davestorkey

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

Fixed in trunk @ 12026.

Note: See TracTickets for help on using tickets.