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 tolerance used for floating point comparison (Fixes #851) #852

Merged
merged 2 commits into from
Aug 21, 2024

Conversation

andrewdnolan
Copy link
Contributor

Per @trhille's experimenting, there are problems setting the Dirichlet BC's for resolutions $\leq$ 1000(m). This PR fixes #851 by using an absolute tolerance in all floating point comparisons of 5% of the appropriate cell spacing quantity.

Set an absolute tolerance set to 5% of the distance of inerest,
instead of the fixed reltaive tolerance previously used.
@andrewdnolan
Copy link
Contributor Author

Testing:

Current implementation

Here's the quantities of interest from the HEAD of main:

image
As @trhille pointed out there are too many cells along the North boundary marked as Dirchlet, same problem applies to areaCell. dvEdge is a bit more complicated I'll explain that latter.

Using a 5% of cell spacing absolute tolerance

Here's the quantities of interest produced with this branch:
image

There are two improvements:

  1. The culling is now correct in that the top most cell center corresponds to exactly to 80e3 (c.f. before).
  2. The masking of dirichletVelocityMask and areaCelll now only affect the top most cell.

@andrewdnolan
Copy link
Contributor Author

Testing (Cont.)

So about the dvEdge field. Unfortunately the way I construct edge patches in mosaic is too simple to deal with these slightly complicated boundary edges. So, for now I've got to go to paraview (for now).

Here's an example of the same dvEdge field for a 1000m mesh, where the edges above the boundary (80e3) have been set to zero and the edges at the boundary have been set to half their original distance. Which is needed to match the half area of the cells along the boundary (see above).

image

@andrewdnolan andrewdnolan requested a review from trhille August 20, 2024 18:53
Copy link
Collaborator

@trhille trhille left a comment

Choose a reason for hiding this comment

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

Thanks @andrewdnolan! I tested 1000m and 500m mesh creation and it now works as expected.

@trhille trhille merged commit 8fc9812 into MPAS-Dev:main Aug 21, 2024
4 checks passed
@andrewdnolan andrewdnolan deleted the mismip+_fix_culling branch September 11, 2024 17:54
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.

Landice mismip+ mesh has incorrect boundary conditions at high resolution
2 participants