Repository navigation
Correct sign in FCT 3rd order advection coefficients - #656
mattdturner merged 3 commits into
Conversation
| if(k <= nAdvCellsForEdge(iEdge)) then | ||
| adv_coefs(k, iEdge) = adv_coefs(k, iEdge) + deriv_two(1,2,iEdge) | ||
| adv_coefs_3rd(k, iEdge) = adv_coefs_3rd(k, iEdge) + deriv_two(1,2,iEdge) | ||
| adv_coefs_3rd(k, iEdge) = adv_coefs_3rd(k, iEdge) - deriv_two(1,2,iEdge) |
There was a problem hiding this comment.
Compare to corresponding line for atmosphere, which has a minus sign:
adv_coefs_3rd(j_in,iEdge) = adv_coefs_3rd(j_in,iEdge) - deriv_two(1,2,iEdge)
| if(k <= nAdvCellsForEdge(iEdge)) then | ||
| adv_coefs(k, iEdge) = adv_coefs(k, iEdge) + deriv_two(iCell+1, 2, iEdge) | ||
| adv_coefs_3rd(k, iEdge) = adv_coefs_3rd(k, iEdge) + deriv_two(iCell+1, 2, iEdge) | ||
| adv_coefs_3rd(k, iEdge) = adv_coefs_3rd(k, iEdge) - deriv_two(iCell+1, 2, iEdge) |
There was a problem hiding this comment.
Compare to corresponding line for atmosphere, which has a minus sign:
adv_coefs_3rd(j_in,iEdge) = adv_coefs_3rd(j_in,iEdge) - deriv_two(iCell+1,2,iEdge)
|
@vanroekel and @ambrad, I am testing in various configurations of MPAS-Ocean and will report here. Please post reports of your testing here as well. Also note, @ambrad already conducted convergence tests here #583 (comment) that show improvements with this bug fix. |
|
@mgduda @matthewhoffman @akturner please add yourselves as reviewers if you like. This is in the operators subdirectory, but the ocean is the only core that calls this subroutine. |
|
It might be useful to future code readers to add one further comment to the helpers.F code, something along the lines of this: adv_coefs accounts for terms 1 and 2 in SG11 equation 7. Term 1 is the 2nd-order flux-function term. adv_coefs accounts for this with the "+ 0.5" lines. In the advection routines that use these coefficients, the 2nd-order flux loop is then skipped. Term 2 is the 4th-order flux-function term. adv_coefs_3rd accounts for term 3, the beta term. beta > 0 corresponds to the third-order flux function. The - sign in the deriv_two accumulation is for the i+1 part of term 3, while the + sign is for the i part. |
|
Done. Thanks for the text @ambrad. That was perfect. I even added a text version of eqn 7 for reference to help the reader. |
|
Testing was done in two ways. First, I developed a standalone code (part of other ongoing work) that implements these Eulerian flux-form methods. This code revealed some interesting patterns, described in this comment and repeated below. Second, once I knew what I was looking for, I ran the new MPAS-Ocean test of solid-body rotation of a cosine bell. This is described in this comment and again for convenience transcribed below. Observations from standalone testing:
MPAS-Ocean testing:
|
|
@mark-petersen, thanks for adding the comment. Just to be clear, the minus sign in term 3 does not correspond to the - in the deriv_two accumulation. Rather, there are layers of negatives such that it's the i+1 part of term 3 that leads to the |
|
@ambrad and @mark-petersen this looks great. here are two snapshots from a G-case without the fix first then with. These are salinity at 250m from high frequency |
|
this is 2.5 years into a G-case by the way |
|
Are these two images supposed to be identical? |
|
@stephenprice they are not. The top image shows small-scale features when the flux function has the sign bug. In the bottom, these are gone. It's possible the features themselves are due to the sign bug, or it's possible they are now dissipated by the now-correct 4th-order hyperdiffusion (SG11 eq 9) produced by the third-order flux function. @vanroekel you might try a simulation pair with the most extreme, Jigsaw-produced, RRM-like grid you have to look at beta=0.25 vs beta=1.0 with the sign fix. It's possible that beta=1.0 could be best for extremely nonuniform, nonsmooth grids. |
|
Thanks @ambrad. I see the differences now that you point them out. |
|
@vanroekel and @jamilgafur, would it be possible to rerun your advection convergence tests with these two changes? Getting the correct behavior and order of convergence on those tests would be a great confirmation of this change. I know @jamilgafur might be back in school next week. |
|
@mark-petersen sure, I can run the case in #583 and post convergence here |
|
@vanroekel, I'll collect a few notes here re: the #583 convergence test:
|
vanroekel
left a comment
There was a problem hiding this comment.
approved by advection convergence test result
|
@mgduda I would like to merge this today. I wasn't brought into the loop on this PR until recently, so I'm not sure if you've weighed in or not. Can you confirm whether or not you want to review this. @mark-petersen asked if you wanted to review in #656 (comment) |
|
@mattdturner Thanks very much for checking. I haven't thoroughly reviewed the code changes with context, but the convergence results are convincing enough for me. I won't add myself as a reviewer, but I have no objections to merging this today. |
* develop: Correct sign in FCT 3rd order advection coefficients #656
…to next (PR #3809) Update mpas-source: bugfix 3rd order advection coeff This PR brings in a new mpas-source submodule with changes only to the MPAS operators. It fixes a bug in MPAS third-order advection coefficients, where the coefficients incorrectly have a plus sign instead of a minus. See MPAS-Dev/MPAS-Model#656 [non-BFB]
…#3809) Update mpas-source: bugfix 3rd order advection coeff This PR brings in a new mpas-source submodule with changes only to the MPAS operators. It fixes a bug in MPAS third-order advection coefficients, where the coefficients incorrectly have a plus sign instead of a minus. See MPAS-Dev/MPAS-Model#656 [non-BFB]
…3rd' into develop Two third-order advection coefficients incorrectly have a plus sign, should be minus. Thanks to @ambrad for his work on this. See discussion at this issue: MPAS-Dev#583 (comment) Note that this is a framework merge, but the ocean is the only core that calls the subroutine, mpas_tracer_advection_coefficients, that initializes the FCT cell weights. The atmosphere has nearly identical lines in src/core_atmosphere/mpas_atm_core.F, subroutine atm_adv_coef_compression, which is clearly where this code was originally copied from in 2013. Also copied comments from the atmospheric core to better explain each term, and cleaned up other comments.




Two third-order advection coefficients incorrectly have a plus sign, should be minus. Thanks to @ambrad for his work on this. See discussion at this issue: #583 (comment)
Note that this is a framework merge, but the ocean is the only core that calls the subroutine,
mpas_tracer_advection_coefficients, that initializes the FCT cell weights. The atmosphere has nearly identical lines insrc/core_atmosphere/mpas_atm_core.F, subroutineatm_adv_coef_compression, which is clearly where this code was originally copied from in 2013.Also copied comments from the atmospheric core to better explain each term, and cleaned up other comments.