Fix to masking of u,v sponge code.#1412
Conversation
- Before, u,v sponges were masking using the tracer mask and generating weirdness at the tile boundaries for u and v.
Hallberg-NOAA
left a comment
There was a problem hiding this comment.
After careful visual inspection, I agree with these changes. The one point that I had to mull over was whether the masking of the input data at velocity points should be masked if either tracer column is masked, or whether it should be unmasked if either is unmasked (as in this code). Upon reflection, I agree with the code that if there is valid data, it can be used. The model will take care of any land masking of the velocity points based on the coastlines, which is a separate question than the depths over which the input data exists.
Assuming that this passes the pipeline testing, I am happy to approve this PR.
| do j=CS%jsc,CS%jec; do I=CS%iscB,CS%iecB | ||
| sp_val_u(I,j,1:nz_data) = 0.5*(sp_val(i,j,1:nz_data)+sp_val(i+1,j,1:nz_data)) | ||
| sp_val_u(I,j,1:nz_data) = 0.5*(sp_val(i,j,1:nz_data)+sp_val(i+1,j,1:nz_data)) | ||
| mask_u(I,j,1:nz_data) = max(mask_z(i,j,1:nz_data),mask_z(i+1,j,1:nz_data)) |
There was a problem hiding this comment.
Taking the average of the sp_val will potentially include a masked valued (huge value if set that way in the input file) and it will not be masked by taking the max of the mask_z. So I would suggest, if we want to keep the max of mask idea to weigh the sp_val by mask_z:
sp_val_u=(sp_val(i)*mask_z(i) + sp_val(i+1)*mask_z(i+1)) / max(mask_z(i)+mask_z(I+1),1e-10)
There was a problem hiding this comment.
My bad, that comment was for the main-GFDL-candidate ... on the same code. I added it there.
This also has Bob's updates to the user code for my OBC tests.