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

Frequency-dependent internal wave drag #815

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

Conversation

c2xu
Copy link

@c2xu c2xu commented Jan 27, 2025

Utilizing streaming band-pass filters, the frequency-dependent wave drag can be applied to the narrowband tidal velocities, instead of the broadband barotropic velocity. This allows internal wave drag to be optimized for different frequency bands independently, without affecting the low-frequency, non-tidal motions.

Also fixed the bug that Filt_accum() does not return a valid output if it is called at the corrector step.

This is the updated version of PR #722 and is implemented based on the latest code of dev/gfdl.

Utilizing streaming band-pass filters, the frequency-dependent wave
drag can be applied to the narrowband tidal velocities, instead of
the broadband barotropic velocity. This allows internal wave drag
to be optimized for different frequency bands independently, without
affecting the low-frequency, non-tidal motions.

Also fixed the bug that Filt_accum() does not return a valid output
if it is called at the corrector step.
enddo ; enddo
else
!$OMP do schedule(static)
do J=jsv-1,jev ; do i=isv-1,iev+1
v_accel_bt(i,J) = v_accel_bt(i,J) + wt_accel(n) * (Cor_v(i,J) + PFv(i,J))
v_accel_bt(i,J) = v_accel_bt(i,J) + wt_accel(n) * (Cor_v(i,J) + PFv(i,J) - Drag_v(i,J))
Copy link
Member

Choose a reason for hiding this comment

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

Please add parentheses to specify the order of arithmetic when 3 real variables are added. I would suggest revising the previous line to read v_accel_bt(i,J) = v_accel_bt(i,J) + wt_accel(n) * ((Cor_v(i,J) + PFv(i,J)) - Drag_v(i,J)), with similar changes on lines 2177, 2253 and 2343.

else
Drag_u(:,:) = 0.0 ; Drag_v(:,:) = 0.0
endif

Copy link
Member

Choose a reason for hiding this comment

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

Drag_u and Drag_v do not vary within the barotropic time stepping loops, so it would be mathematically equivalent and more efficient if these were incorporated into u_accel_bt and v_accel_bt outside of the barotropic time stepping loops. This revision should be done now because they will change answers at roundoff if it is done later.

Copy link
Author

Choose a reason for hiding this comment

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

I'm not sure how to do this, because Drag_u and Drag_v need to be multiplied by wt_accel(n) just like other forgings. Could you be more specific?

Copy link
Author

Choose a reason for hiding this comment

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

So I removed Drag_u(:,:) = 0.0 ; Drag_v(:,:) = 0.0 here and inside the barotropic time stepping loops, Drag_u and Drag_v are added only if the frequency-dependent drag is used.

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.

In addition to the specific comments that I have attached to the relevant lines, we also need to figure out what is causing the doxygen testing to fail before we can accept this PR.

Unfortunately, the doxygen is failing with a segmentation fault and hence is not giving a good error message (see https://github.com/NOAA-GFDL/MOM6/actions/runs/12990322755/job/36293848717?pr=815) . Just based on when doxygen is failing, it appears to be something unusual in a comment in MOM_wave_drag.F90 or MOM_streaming_filter.F90, but I don't have better guidance than this.

Minor performance optimization. Also, this commit allows the filters
to be activated without the frequency-dependent drag being activated.
@c2xu c2xu force-pushed the c2xu/linear_freq_drag branch from 888e16e to d9ee30c Compare February 6, 2025 12:41
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.

2 participants