Skip to content

Conversation

herrwang0
Copy link

In a number of cases, total resting column thickness is calucated as G%bathyT + G%z_ref, which is largely correct but for wetting, i.e. G%bathyT + G%z_ref < 0. This commit makes a correction for eight cases with this potential bug. Additionally, a correction is made in one case that G%bathyT + G%z_ref is used as depth where negative depth does not make sense.

List of modules/processes affected:

  • MOM_barotropic
    • affects only surface stress when BT_NONLIN_STRESS is False.
  • MOM_wave_speed
  • h2 calculations in
    • subroutine internal_tides_init
    • subroutine int_tide_input_int
    • subroutine tidal_mixing_init
  • MOM_tracer_z_init
  • D_[uv] in set_viscous_BBL, which is used only when CHANNEL_DRAG = True
  • MOM_lateral_mixing_coeffs
  • MOM_MEKE

There is no answer changes if no wetting points are used and G%Z_ref is zero.

@herrwang0 herrwang0 force-pushed the bugfix-zref-thickness branch from 53d92c3 to 61039e2 Compare September 25, 2025 16:22
@herrwang0 herrwang0 added the bug Something isn't working label Sep 25, 2025
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.

These fixes make sense to me. I have just one suggest about a re-calculation in the barotropic solver. I've not tested yet...

if (G%OBCmaskCu(I,j) * htot > 0.) then
! Using CS%IDatu(I,j) = G%OBCmaskCu(I,j) * 2.0 / htot would be better but it changes answer.
CS%IDatu(I,j) = G%OBCmaskCu(I,j) * 2.0 / (Z_to_H * (max(G%bathyT(i+1,j) + G%Z_ref, 0.0) &
+ max(G%bathyT(i,j) + G%Z_ref, 0.0)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The denominator could be expressed in terms of htot here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. mistaken it for a * Ihtot scenario. (even that it should be OK in this case, right? Since the numerator has 0 as its significand)

if (G%OBCmaskCv(i,J) * htot > 0.) then
! Using CS%IDatu(i,J) = G%OBCmaskCv(i,J) * 2.0 / htot would be better but it changes answer.
CS%IDatv(i,J) = G%OBCmaskCv(i,J) * 2.0 / (Z_to_H * (max(G%bathyT(i,j+1) + G%Z_ref, 0.0) &
+ max(G%bathyT(i,j) + G%Z_ref, 0.0)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

In a number of cases, total resting column thickness is calucated as
G%bathyT + G%Z_ref, which is largely correct but for wetting, i.e.
G%bathyT < 0. This commit makes a correction for eight cases with this
potential bug. Additionally, a correction is made in one case that
G%bathyT + G%Z_ref is used as depth where negative depth does not make
sense.

There is no answer changes if no wetting points are used and G%Z_ref is
zero.

List of modules/processes affected:
* MOM_barotropic
    * affects only surface stress when BT_NONLIN_STRESS is False.
* MOM_wave_speed
* h2 calculations in
    * subroutine internal_tides_init
    * subroutine int_tide_input_int
    * subroutine tidal_mixing_init
* MOM_tracer_z_init
* D_[uv] in set_viscous_BBL, which is used only when CHANNEL_DRAG = True
* MOM_lateral_mixing_coeffs
* MOM_MEKE
@herrwang0 herrwang0 force-pushed the bugfix-zref-thickness branch from 61039e2 to a67ff8e Compare October 1, 2025 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants