#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: | v4.0 |
Severity: | minor | Keywords: | v4.0 |
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)
Changeset | Author | Time | ChangeLog |
---|---|---|---|
12026 | davestorkey | 2019-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. |
11480 | davestorkey | 2019-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:
Notes:
|
Change History (5)
comment:1 Changed 5 years ago by jchanut
comment:2 Changed 5 years ago by davestorkey
In 11480:
comment:3 Changed 5 years ago by davestorkey
In 12026:
comment:4 Changed 5 years ago by davestorkey
- Resolution set to fixed
- Status changed from new to closed
Fixed in trunk @ 12026.
comment:5 Changed 2 years ago by nemo
- Keywords v4.0 added
Removing the conditional statement at line 128 of dynnxt.F90 should work:
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.