Skip to content

Commit

Permalink
*Switched remap_via_sub_cells() to use "new" algorithm
Browse files Browse the repository at this point in the history
- A newly added unit test revealed that remapping was not conserving for
  truly vanished layers at the bottom of the model.
  - Discovered/reported in #472 by @ashao.
- A static logical parameter "old_algorithm=.true." was added in
  d43d8fd to keep using the old algorithm when answers changed
  unexpectedly. The new unit test explains why ansers changed
  and indicate that the new algorithm appears to be correct after all.
- Closes #472.
  • Loading branch information
adcroft committed Apr 20, 2017
1 parent 119a897 commit 4ab620f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/ALE/MOM_remapping.F90
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ module MOM_remapping
!! changing the numerical result, except where
!! a division by zero would otherwise occur.

logical, parameter :: old_algorithm = .true. !< Use the old "broken" algorithm.
logical, parameter :: old_algorithm = .false. !< Use the old "broken" algorithm.
!! This is a temporary measure to assist
!! debugging until we delete the old algorithm.

Expand Down Expand Up @@ -1724,6 +1724,13 @@ logical function remapping_unit_tests(verbose)
remapping_unit_tests = remapping_unit_tests .or. test_answer(v, 5, ppoly0_coefficients(:,2), (/0.,6.,0.,0.,0./), 'Limits PPM: P1')
remapping_unit_tests = remapping_unit_tests .or. test_answer(v, 5, ppoly0_coefficients(:,3), (/0.,-3.,3.,0.,0./), 'Limits PPM: P2')

call PLM_reconstruction(4, (/0.,1.,1.,0./), (/5.,4.,2.,1./), ppoly0_E(1:4,:), ppoly0_coefficients(1:4,:) )
remapping_unit_tests = remapping_unit_tests .or. test_answer(v, 4, ppoly0_E(1:4,1), (/5.,5.,3.,1./), 'PPM: left edges h=0110')
remapping_unit_tests = remapping_unit_tests .or. test_answer(v, 4, ppoly0_E(1:4,2), (/5.,3.,1.,1./), 'PPM: right edges h=0110')
call remap_via_sub_cells( 4, (/0.,1.,1.,0./), (/5.,4.,2.,1./), ppoly0_E(1:4,:), ppoly0_coefficients(1:4,:), &
2, (/1.,1./), INTEGRATION_PLM, .false., u2, err )
remapping_unit_tests = remapping_unit_tests .or. test_answer(v, 2, u2, (/4.,2./), 'PLM: remapped h=0110->h=11')

deallocate(ppoly0_E, ppoly0_S, ppoly0_coefficients)

if (.not. remapping_unit_tests) write(*,*) 'Pass'
Expand Down

0 comments on commit 4ab620f

Please sign in to comment.