-
Notifications
You must be signed in to change notification settings - Fork 72
Fix for MASK_OUTSIDE_OBCS with MASKING_DEPTH #752
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes mirror the code setting the MASKING_DEPTH
elsewhere in the MOM6 code, and they make sense to me to add them here as well.
a4ec069
to
ef18f5a
Compare
I am hopefully done changing things on this branch now. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev/gfdl #752 +/- ##
============================================
+ Coverage 36.63% 36.65% +0.01%
============================================
Files 278 278
Lines 84143 84182 +39
Branches 15833 15851 +18
============================================
+ Hits 30826 30855 +29
- Misses 47504 47507 +3
- Partials 5813 5820 +7 ☔ View full report in Codecov by Sentry. |
@kshedstrom In commit 01b0dc4 you updated the way to handle the v-direction which I think makes sense. However, you didn't change the way the u-direction is handled and left it in the form of the previous commit. I don't think this explains the MacOS fails (which @marshallward suspects is a new gnu-compiler options thing) but currently I think it breaks the rotational symmetry rule. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Hallberg-NOAA earlier approved the first version, and I agree with Bob that this seems like a good fix. However, a subsequent "better" commit broke symmetry (see #752 (comment)). This seems easy to fix (apply to u- what was done to v-) but in the mean-time I'll mark this as "changes requested".
The symmetric version worked for EW boundaries, but not NS boundaries. The algorithm is sweeping across lines of i and is inherently non-symmetric. With non-zero turns, it would need fixing, I suppose. I'll have to investigate how the turns are actually done. |
I rotated the Supercritical test and Thomas's test and I stand by my current version. The failure is:
One version of Thomas's test was spinning up a circulating flow while the current version has zero flow with nothing spinning it up. The previous code didn't have eta zeroed out outside the OBCs. I wouldn't be surprised if those eta values were being used somehow. Do we need to set them to some wacky value and see what happens? |
The Thomas test when rotated runs when compiled for debugging, but not when compiled for repro. It fails with:
The line in question is:
At this point in the run, OBC%rx_normal and ry_normal have not been allocated - when the rotation is in play, it is allocated otherwise. |
In MOM_state_initialization, there is a CS%OBC which has the r[xy]_normal allocated. There is also an OBC_in which does not have them allocated (in the rotated case). |
Also, Thomas' test is sensitive to zeroing out the outside eta, but none of the rest of my tests are. It must be something about the OBC choices he picked. As for the other issue, perhaps @marshallward knows why the rotated MOM_state_initialization gets one version of the OBC structure and the nonrotated ones get the other? |
I ran dueling debuggers and the answers do match inside the domain, spinning up a gyre and all. The Thomas test has a positive eta_outside in the Flather OBC. That drives fluid from outside to the inside. It sucks water from the point just outside the boundary, causing eta to get lower just outside the boundary without the MOM_barotropic fix, eventually making it lower than the ocean bottom. I still stand by my fix, except for the rotational weirdness. |
d59cf6d
to
52605fb
Compare
I'm trying a pointer fix to the OBC data structure problem. Things seem to be running... |
Running, maybe, but these are the diffs for the not rotated vs rotated Thomas test:
Maybe I'll figure it out tomorrow. |
For the non-rotated case, OBC%segment(1)%field(1)%buffer_dst is allocated and set to the SSH outside value. |
Oh, it got allocated, set to the appropriate value, then decallocated. |
Is this where it populated the whole OBC_in structure, then gets rid of it as part of the rotation? @marshallward |
rotate_OBC_segment_data is called after the segment fields with a value use the value to fill buffer_dst. It copies over the value, but not the filled buffer_dst. |
Sorry @kshedstrom I was away last week and missed these pings. I will also try to look into this with you. |
Something is going on with the tracer reservoirs. At some point during initialization, they have the same values. Later, before step_MOM_dynamics, they don't. In fact the "vanilla" case has updated to T=7 and the rotated case has not updated and has somehow picked up that is_initialized is .false.. |
Summary of what I know about all this. Thomas Neumann asked first in the MOM6 forum, then in a MOM6 issue, about open boundaries within the domain. My tests for these were shown to be incomplete. I have managed to put in enough changes to make Dr Neumann happy, but the rotational tests for these things still have problems. For the rotational tests of OBCs, the model initializes parts of CS%OBC, but simultaneously keeps OBC_in. It is this latter structure which gets passed to MOM_state_initialization. Bits are then copied over to CS%OBC, but not quite all of them in all cases.
|
I could be done with this for now. It's working without rotations as far as I know. |
This PR includes numerous commits that have nothing to do with it. Please rebase this atop the latest version of dev/gfdl, which should hopefully eliminate some of the excess commits, most of which have already been merged into dev/gfdl. |
ee42fdb
to
ec17094
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for doing the rebase, @kshedstrom . That makes it so much easier to see what is going on with this PR!
I have added some questions and thoughts about what might be going on here and some things to try that might fix our testing failures, if you are feeling up to it.
Another option here might be to break up this PR into the first few commits that we can accept without controversy (namely those related to setting MASKING_DEPTH for the OBCs and masking out the tracer-point changes in the barotropic solver and tracer advection), and then circling back to sort out what is happening with the rotation later. (The commit changing the allocatable arrays into pointers seems to me like the primary suspect for the TC testing failures, based on the error messages we are getting with our TC testing failures. To see the errors, click on the red-x's that we are getting at #752.)
Good idea to try without the rotational fixes for now. |
@kshedstrom, I think that we have made significant progress toward addressing some of the issues that this PR was intended to address working via PR #814, but this has now created conflicts with this PR so we can not simply rebase it. Could I ask that you please rebase this PR so that we can work out how to handle the other aspects of what it is striving for? |
Please rebase this PR on top of dev/gfdl instead of doing a merge commit, @kshedstrom. With the merge commit, this PR appears to have 57 commits, whereas with a properly executed rebase it would have far fewer, and it would set us up to be able to merge this commit onto dev/gfdl in due course while maintaining a linear commit history. |
751f07f
to
5a593e9
Compare
- not that turns other than 0, 1 is supported elsewhere for OBCs. This still has issue NOAA-GFDL#5 from a comment in NOAA-GFDL#752: Some experimentation with the rotate_OBC subroutines. Dr Neumann's test uses boundary data of the value=const type. Copying the buffer_dst from OBC_in to CS%OBC gets some of these across, also the tracer reservoir values. However, the tracer reservoir values get overwritten by an interior tracer value between the first call to step_MOM_dynamics and the second.
- not that turns other than 0, 1 is supported elsewhere for OBCs. This still has issue NOAA-GFDL#5 from a comment in NOAA-GFDL#752: Some experimentation with the rotate_OBC subroutines. Dr Neumann's test uses boundary data of the value=const type. Copying the buffer_dst from OBC_in to CS%OBC gets some of these across, also the tracer reservoir values. However, the tracer reservoir values get overwritten by an interior tracer value between the first call to step_MOM_dynamics and the second.
6d93c1b
to
24e195f
Compare
I believe I have fixed your specific issue. However, at line #2886 of MOM.F90, there is a fatal error when attempting turns other than 1 with OBCs. Commenting this out causes my test for turns=2 to fail elsewhere and turns=3 to run but not look correct. I can pursue these later. |
- not that turns other than 0, 1 is supported elsewhere for OBCs. This still has issue NOAA-GFDL#5 from a comment in NOAA-GFDL#752: Some experimentation with the rotate_OBC subroutines. Dr Neumann's test uses boundary data of the value=const type. Copying the buffer_dst from OBC_in to CS%OBC gets some of these across, also the tracer reservoir values. However, the tracer reservoir values get overwritten by an interior tracer value between the first call to step_MOM_dynamics and the second.
15d78e4
to
13bdbf7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this contribution. I am now satisfied that this is an important step forward and can be accepted, even if there are still some remaining issues related to grid rotation with open boundary conditions.
- "git rebase" made a conflicted mess
- not that turns other than 0, 1 is supported elsewhere for OBCs. This still has issue NOAA-GFDL#5 from a comment in NOAA-GFDL#752: Some experimentation with the rotate_OBC subroutines. Dr Neumann's test uses boundary data of the value=const type. Copying the buffer_dst from OBC_in to CS%OBC gets some of these across, also the tracer reservoir values. However, the tracer reservoir values get overwritten by an interior tracer value between the first call to step_MOM_dynamics and the second.
- Note that this is still not supported, as specificed in MOM.F90.
2fa35c2
to
d0c6835
Compare
This PR has passed pipeline testing at https://gitlab.gfdl.noaa.gov/ogrp/mom6ci/MOM6/-/pipelines/27367. |
The MASK_OUTSIDE_OBCS flag doesn't know about the MASKING_DEPTH and this should take care of the problem.