Skip static interpolation step if input grid isn't a unit sphere#1259
Open
gdicker1 wants to merge 4 commits intoMPAS-Dev:developfrom
Open
Skip static interpolation step if input grid isn't a unit sphere#1259gdicker1 wants to merge 4 commits intoMPAS-Dev:developfrom
gdicker1 wants to merge 4 commits intoMPAS-Dev:developfrom
Conversation
added 2 commits
January 3, 2025 14:44
This function uses the sum of cellArea for all owned cells to approximate the surface area of the sphere. This function returns true if the sum of cellArea is close to unit sphere surface area. Otherwise this function returns false. cellAreas are simple to sum, while direct checks of distance of cell centers to the origin could be more expensive.
If static_interp is repeated, the mesh is scaled to unrealistic dimensions. This can cause obvious science issues but can also cause issues for running the init_atmosphere core. With unrealistic distances, the process to assign soil categories may request too much memory and cause the init_atmosphere core to fail.
mgduda
requested changes
Jan 6, 2025
Collaborator
Author
|
@mgduda, these fixup commits should address your comments. I'll rebase them if they're accepted. |
mgduda
requested changes
Apr 2, 2026
| end do | ||
| call mpas_dmpar_sum_real(dminfo, surfArea, g_surfArea) | ||
|
|
||
| if ( (g_surfArea / 4*pii) < tol ) then |
Contributor
There was a problem hiding this comment.
It looks like parentheses are needed around 4*pii.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a function to the init_atmosphere core to quickly check if a grid is likely a unit sphere and uses the function to throw an error if the static interpolation step is about to be repeated.
Most cases for the init_atmosphere model assume the input grid is a unit sphere and involve calculations to scale up to a new radius. Unlike the other cases, the case to generate real-data initial conditions is typically run a few times in sequence with different options. It's possible users could cause unintuitive issues by doubly scaling the input grid unless they take great care when editing namelist.init_atmosphere.
This PR protects against such errors. Now, running the init_atmosphere model to generate real-data initial conditions and attempting the static interpolation step with a non-unit sphere input grid will cause the model to abort with an error message.