Skip to content

Conversation

danishyo
Copy link

@danishyo danishyo commented Apr 4, 2025

Original issue can be found at oceanmodeling/ufs-weather-model#145 (comment)
It cause zero values along the boundary for exchange variables (like SXX) from cap.
Also, original code will derive weird orbital velocity (looks like domain-decomposition map, like the following figure)
image

@uturuncoglu , and @janahaddad are aware of these issues.
@DeniseWorthen , could you have a look on this fix? Thx!

ix = mapsf(isea,1)
iy = mapsf(isea,2)
if (mapsta(iy,ix) == 1) then
if (mapsta(iy,ix) /= 0) then
Copy link
Contributor

Choose a reason for hiding this comment

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

Please don't change anything w/in the CESMCOUPLED ifdefs unless you're testing in CESM and know that the change is acceptable.

Copy link
Author

Choose a reason for hiding this comment

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

Got it! Thanks for the notice!

Copy link
Collaborator

Choose a reason for hiding this comment

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

@danishyo can you make sure that this requested change is reflected in this PR?

Copy link
Author

Choose a reason for hiding this comment

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

@sbanihash I didn't intend to change CESM part,
only like to change exchange fields to SCHISM, like Hs, orbital, stoke's drift.... ,
please follow @DeniseWorthen suggestion, skip change within CESMCOUPLED .

Copy link
Collaborator

Choose a reason for hiding this comment

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

@danishyo since this is your PR, what you will need to do is make these changes, commit and push them to your PR branch (which seems to be the dev/ufs-weather-model-branch in your fork) and then I will move forward with the review and testing for the PR. Thank you in advance.

Copy link
Author

Choose a reason for hiding this comment

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

@sbanihash Thanks for the explanation, I already revert the change within CESM block and push.

@DeniseWorthen
Copy link
Contributor

@danishyo The fact that you see the decomposition reflected on the boundary gives me pause. I would expect if it were a simple issue of mapsta being incorrect, you might see garbage (or zero), but you're seeing something that looks like a decomposition.

I don't know how much debugging you've done for this issue in WW3 itself, but I reminded of this issue I found when adding the unstructured mesh to the cap

ufs-community/ufs-weather-model#1556 (comment)

In that case, the exported field was corrupted on the last PE, but only on the restart frequency.

I suspect that something more fundamental may be occurring inside of WW3 it it is manifesting itself in your case.

@danishyo
Copy link
Author

@danishyo The fact that you see the decomposition reflected on the boundary gives me pause. I would expect if it were a simple issue of mapsta being incorrect, you might see garbage (or zero), but you're seeing something that looks like a decomposition.

I don't know how much debugging you've done for this issue in WW3 itself, but I reminded of this issue I found when adding the unstructured mesh to the cap

ufs-community/ufs-weather-model#1556 (comment)

In that case, the exported field was corrupted on the last PE, but only on the restart frequency.

I suspect that something more fundamental may be occurring inside of WW3 it it is manifesting itself in your case.

Hi @DeniseWorthen
I believe this is only related the code to derive orbital. I compare output for both WWM & WW3 (with update PR code), they are similar like the following figure.
圖片

Anyway, I will revert change within CESM block then push.

@DeniseWorthen
Copy link
Contributor

@danishyo For the current UFS cases using the unstructured mesh, we do not export some of the fields which you are using in the coastal app. So I never did any debugging of possible issues inside of WW3 w/ those fields.

I don't doubt that you see that your fix resolves the issue---but I'm not 100% sure that the issue you are seeing isn't from something being done incorrectly inside of WW3. How else to explain that what you see is evidence of the decomposition of WW3 in the exported fields?

@danishyo
Copy link
Author

@danishyo For the current UFS cases using the unstructured mesh, we do not export some of the fields which you are using in the coastal app. So I never did any debugging of possible issues inside of WW3 w/ those fields.

I don't doubt that you see that your fix resolves the issue---but I'm not 100% sure that the issue you are seeing isn't from something being done incorrectly inside of WW3. How else to explain that what you see is evidence of the decomposition of WW3 in the exported fields?

@DeniseWorthen I checked all exchange fields between SCHISM & WW3, orbital velocity is the only one showing this, others like Hs, Tm01... are not. So I just guessing this may not related.

if ( firstCall ) then
if(( runtype == 'initial' .and. mapsta(iy,ix) == 1 ) .or. &
( runtype == 'continue' .and. abs(mapsta(iy,ix)) == 1 )) then
if(( runtype == 'initial' .and. mapsta(iy,ix) /= 0 ) .or. &
Copy link
Contributor

Choose a reason for hiding this comment

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

@danishyo Did you intend to change this block? I don't remember that coastal app exports Z0 and this is w/in code that UFS global mode uses.

Copy link
Author

Choose a reason for hiding this comment

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

No, I didn't, I will revert this one as well.

@DeniseWorthen
Copy link
Contributor

@danishyo For the current UFS cases using the unstructured mesh, we do not export some of the fields which you are using in the coastal app. So I never did any debugging of possible issues inside of WW3 w/ those fields.
I don't doubt that you see that your fix resolves the issue---but I'm not 100% sure that the issue you are seeing isn't from something being done incorrectly inside of WW3. How else to explain that what you see is evidence of the decomposition of WW3 in the exported fields?

@DeniseWorthen I checked all exchange fields between SCHISM & WW3, orbital velocity is the only one showing this, others like Hs, Tm01... are not. So I just guessing this may not related.

I've had enough experience adding features and debugging in WW3 that when I see something like a decomposition field being expressed in the output field, it is difficult for me not be suspicious. The fact that you're seeing it in some things and not others doesn't really convince me.

However, UFS is not making use of these fields that coastal is using currently, so if you restrict your changes to only coastal-app exported fields, I'm ok with your changes. I just would not be at all surprised to find something deeper in WW3 is actually causing a decomposition to appear in an exported field.

@danishyo
Copy link
Author

Thanks for the explanation, I just revert the changes and keep changes with necessary fields.

Copy link
Collaborator

@JessicaMeixner-NOAA JessicaMeixner-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'm wondering if these should be if mapsta(iy,ix) > 0 as negative values indicate that a point is currently taken out of computation. https://github.com/NOAA-EMC/WW3/blob/develop/model/src/w3gridmd.F90#L219-L247

Also I'm not sure what prompted the changes in the calcstokes computations?

end do
kd = max ( 0.001 , wn(ik,isea) * dw(isea) )
if (kd .lt. 6.0) then
kd = max ( 1.0e-7 , wn(ik,isea) * dw(isea) ) !0.001
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are there changes to this calculation? This appears different than the mapsta issue updated elsewhere but I don't see anything about it in the PR description.

Copy link
Author

Choose a reason for hiding this comment

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

I borrow routine coefficients from https://github.com/NOAA-EMC/WW3/blob/develop/model/src/wmesmfmd.F90#L7315
For mapsta, I am OK to change ">0" if this includes ocean and boundary points.

Copy link
Contributor

Choose a reason for hiding this comment

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

The code for the ussco matches (or should) what is currently in w3iogomd.F90

Copy link
Collaborator

Choose a reason for hiding this comment

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

@danishyo - Can you let us know how your testing goes for ">0" this should be sufficient.

I would think this calculation should match what is in w3iogo. I'd have to look at the differences between that and wmesmf as to why that would have been diverged. Let me know if you need help investigating this further @danishyo or if you will take the lead on that.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@danishyo were you ever able to run those tests?

Copy link
Author

Choose a reason for hiding this comment

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

@danishyo were you ever able to run those tests?

I didn't do "mapsta>0" test, but base on info from manual, I believe this should fix the issue as well.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Let us know when you've been able to run those tests and confirm if that works or not.

We also have outstanding issues about this part of the code change and why it's diverged, etc.

This PR is waiting on those updates to move forward.

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