Skip to content
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

Fix for MASK_OUTSIDE_OBCS with MASKING_DEPTH #752

Open
wants to merge 5 commits into
base: dev/gfdl
Choose a base branch
from

Conversation

kshedstrom
Copy link

The MASK_OUTSIDE_OBCS flag doesn't know about the MASKING_DEPTH and this should take care of the problem.

Copy link
Member

@Hallberg-NOAA Hallberg-NOAA left a 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.

 - Otherwise, the tracer values just outside the OBC get updated
 based on fluxes at the OBC and quickly go out of bounds of the
 equation of state.
 - The previous version did the wrong thing at northern boundaries,
 at a southern corner too.
 - It hasn't yet caused a blowup that I know of, but better to
   prevent any trouble while we're thinking about it.
@kshedstrom
Copy link
Author

I am hopefully done changing things on this branch now.

Copy link

codecov bot commented Nov 8, 2024

Codecov Report

Attention: Patch coverage is 72.50000% with 11 lines in your changes missing coverage. Please review.

Project coverage is 36.65%. Comparing base (31a4d8b) to head (d59cf6d).

Files with missing lines Patch % Lines
src/core/MOM_open_boundary.F90 0.00% 4 Missing ⚠️
src/tracer/MOM_tracer_advect.F90 75.00% 0 Missing and 4 partials ⚠️
src/core/MOM_barotropic.F90 85.00% 0 Missing and 3 partials ⚠️
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.
📢 Have feedback on the report? Share it here.

@adcroft
Copy link
Member

adcroft commented Nov 11, 2024

@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.

Copy link
Member

@adcroft adcroft left a 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".

@kshedstrom
Copy link
Author

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.

@kshedstrom
Copy link
Author

I rotated the Supercritical test and Thomas's test and I stand by my current version. The failure is:

FAIL: Diagnostics tc3.regression.diag have changed.

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?

@kshedstrom
Copy link
Author

kshedstrom commented Nov 17, 2024

The Thomas test when rotated runs when compiled for debugging, but not when compiled for repro. It fails with:

[chinook04:2911387:0:2911387] Caught signal 11 (Segmentation fault: address not mapped to object at address (nil))
==== backtrace (tid:2911387) ====
 0 0x0000000000012d20 __funlockfile()  :0  
 1 0x0000000001183528 __mpp_domains_mod_MOD_mpp_update_domain2d_r8_3dv()  //import/c1/AKWATERS/kate/ESMG/ESMG-configs/src/FMS2/mpp/include/mpp_update_domains2D.fh:518
 2 0x0000000000a69d5e __mom_domain_infra_MOD_pass_vector_3d()  //import/c1/AKWATERS/kate/ESMG/ESMG-configs/src/MOM6/config_src/infra/FMS2/MOM_domain_infra.F90:709
 3 0x000000000067957e __mom_open_boundary_MOD_open_boundary_init()  //import/c1/AKWATERS/kate/ESMG/ESMG-configs/src/MOM6/src/core/MOM_open_boundary.F90:1941
 4 0x0000000000c17638 __mom_state_initialization_MOD_mom_initialize_state()  //import/c1/AKWATERS/kate/ESMG/ESMG-configs/src/MOM6/src/initialization/MOM_state_initialization.F90:606
 5 0x0000000000924c7b __mom_MOD_initialize_mom()  //import/c1/AKWATERS/kate/ESMG/ESMG-configs/src/MOM6/src/core/MOM.F90:2979
 6 0x00000000005a2e70 MAIN__()  //import/c1/AKWATERS/kate/ESMG/ESMG-configs/src/MOM6/config_src/drivers/solo_driver/MOM_driver.F90:280
 7 0x000000000040761d main()  //import/c1/AKWATERS/kate/ESMG/ESMG-configs/src/MOM6/config_src/drivers/solo_driver/MOM_driver.F90:27
 8 0x000000000003a7e5 __libc_start_main()  ???:0
 9 0x000000000040765e _start()  ???:0
=================================

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

The line in question is:

  if (OBC%radiation_BCs_exist_globally) call pass_vector(OBC%rx_normal, OBC%ry_normal, G%Domain, &
                     To_All+Scalar_Pair)

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.

@kshedstrom
Copy link
Author

kshedstrom commented Nov 17, 2024

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).

@kshedstrom
Copy link
Author

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?

@kshedstrom
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants