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 nudged OBCs for tracers #194

Merged
merged 6 commits into from
Aug 28, 2022

Conversation

WenhaoChen89
Copy link

@WenhaoChen89 WenhaoChen89 commented Aug 12, 2022

This PR is to fix nudged OBCs on tracers when both inflow and outflow length scales of tracer reservoirs are zero.

At open boundaries, tracers are updated based on tracer reservoirs. For flow entering reservoirs (exiting interior domain), reservoirs are updated with interior tracers and reservoir tracers in the previous time step. For flow existing reservoirs (entering interior domain), reservoir is updated based on nudged data applied at open boundaries and reservoir tracers in the previous time step. However, this does not work if length scales of tracer reservoirs are zero, in which case reservoirs are not updated. (@MJHarrison-GFDL )

In this fix, it is assumed that if length scale is 0, the impact of associated data is dominant, i.e.,

  1. In case the reservoir out-length-scale is 0 and the flow enters reservoirs, reservoirs are set to be interior values.
  2. In case the reservoir in-length-scale is 0 and the flow exits reservoirs, reservoirs are set to be nudged values.

@codecov
Copy link

codecov bot commented Aug 12, 2022

Codecov Report

Merging #194 (741c171) into dev/gfdl (34247a9) will decrease coverage by 0.12%.
The diff coverage is 0.00%.

@@             Coverage Diff              @@
##           dev/gfdl     #194      +/-   ##
============================================
- Coverage     37.22%   37.09%   -0.13%     
============================================
  Files           261      261              
  Lines         72492    71836     -656     
  Branches      13554    13405     -149     
============================================
- Hits          26985    26651     -334     
+ Misses        40507    40261     -246     
+ Partials       5000     4924      -76     
Impacted Files Coverage Δ
src/core/MOM_open_boundary.F90 25.33% <0.00%> (-0.07%) ⬇️
src/core/MOM.F90 52.00% <0.00%> (+0.71%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@kshedstrom
Copy link

I approve this PR.

Note that it does change answers in a few of my tests, I assume for the better.

@WenhaoChen89 WenhaoChen89 changed the title Fix nudged OBCs for tracers +Fix nudged OBCs for tracers Aug 15, 2022

nz = GV%ke
ntr = Reg%ntr

if (associated(OBC)) then ; if (OBC%OBC_pe) then ; do n=1,OBC%number_of_segments
segment=>OBC%segment(n)
if (.not. associated(segment%tr_Reg)) cycle
b_in = 0; if (segment%Tr_InvLscale_in == 0) b_in = 1
Copy link
Member

Choose a reason for hiding this comment

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

In this case, the compilers will do the integer-to-real conversions to do the right thing, but when setting a real variable to 0 or 1, or comparing a real value to 0, the preferred syntax would be b_in = 0.0 ; , rather than b_in = 0; , and similarly for the other 5 instances in these two lines.

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.

I agree with the logic of these changes, and am convinced that they will do the right thing for tracers when tracer reservoirs are not being used. This PR should be accepted after it has passed the TC and pipeline regression testing.

There are a few minor syntax changes that I would prefer, as documented in a separate comment, but these would not change the substance of the code. In addition, there are a few places where the code is adding 3 real values without adding parentheses, but in this case these real values always take on integer values, so the order of arithmetic should not matter.

@marshallward
Copy link
Member

Gaea regression: https://gitlab.gfdl.noaa.gov/ogrp/MOM6/-/pipelines/16584 ✔️

@marshallward
Copy link
Member

squash-merging this one.

@marshallward marshallward merged commit 1c85a00 into NOAA-GFDL:dev/gfdl Aug 28, 2022
@WenhaoChen89
Copy link
Author

WenhaoChen89 commented Oct 11, 2022 via email

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.

4 participants