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

Duplicate Coordinates/Elements with Mesh2D #248

Closed
jb-mackay opened this issue Oct 12, 2021 · 2 comments
Closed

Duplicate Coordinates/Elements with Mesh2D #248

jb-mackay opened this issue Oct 12, 2021 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@jb-mackay
Copy link
Contributor

Duplicate values in coordinate lists are not accounted for in Mesh2D, leading to extra copies of elements.

Minimal working example:

using ClimaCore: Domains, Meshes, Geometry
using IntervalSets

domain = Domains.RectangleDomain(
                   Geometry.XPoint(-1.)..Geometry.XPoint(1.),
                   Geometry.YPoint(-1.)..Geometry.YPoint(1.),
                   x1boundary = (:bottom, :top),
                   x2boundary = (:left, :right),
               )
m1 = Meshes.Mesh2D(domain, [-1, 0, 1], [-1, 0, 1])
m2 = Meshes.Mesh2D(domain, [-1, 0, 1, 1], [-1, 0, 1, 1])

Perhaps applying unique! to the coordinate lists is the best move, though this may require a little bit of type logic since x1c and x2c can be things like ranges. @sriharshakandala

@jb-mackay jb-mackay added the bug Something isn't working label Oct 12, 2021
@jb-mackay jb-mackay self-assigned this Oct 12, 2021
@sriharshakandala
Copy link
Member

sriharshakandala commented Oct 12, 2021

@jb-mackay : Currently, the Mesh2D constructor for rectangular domains is invoked through equispaced_rectangular_mesh function.
Similarly, we can have another function that constructs the mesh using user specified x1 and x2 coordinates. Within this function, we can add checks that ensure that x1c and x2c are unique and in ascending order. We can also check to ensure the extremes of x1c and x2c are in compliance with the domain extremes.

@jb-mackay
Copy link
Contributor Author

Thanks, @sriharshakandala, makes sense. I'm building 2D meshes with x1c and x2c to generate an overlap mesh which is not regularly spaced. The above issue is actually not a problem since I'm using a union in the constructor. I guess we can hold off on building the function you discuss until we have a use case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants