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

Tree Mesh centering the mesh and shifting the boundaries (rectangles to quads) #1889

Open
MarcoArtiano opened this issue Mar 25, 2024 · 3 comments
Labels
bug Something isn't working documentation Improvements or additions to documentation

Comments

@MarcoArtiano
Copy link

MarcoArtiano commented Mar 25, 2024

While studying and making some test cases about the Warm Bubble Test for compressible Euler, the mesh on the y direction seems to be shifted, rather than being from 0 to 10_000, it is from -5000 to 15000.

https://github.com/trixi-framework/Trixi.jl/blob/main/examples/tree_2d_dgsem/elixir_euler_warm_bubble.jl

coordinates_min = (0.0, 0.0)
coordinates_max = (20_000.0, 10_000.0)

# Same coordinates as in examples/structured_2d_dgsem/elixir_euler_warm_bubble.jl
# However TreeMesh will generate a 20_000 x 20_000 square domain instead
mesh = TreeMesh(coordinates_min, coordinates_max,
                initial_refinement_level = 6,
                n_cells_max = 10_000,
                periodicity = (true, false))
image image

As far as I know the mesh has to be a Quad, consequently it changes boundaries according to it.

@ranocha ranocha added the bug Something isn't working label Mar 25, 2024
@ranocha
Copy link
Member

ranocha commented Mar 25, 2024

Looks like a (documentation) bug to me. The TreeMesh supports only quads/cubes, no rectangles. But the constructor should complain in a case like this, I think. What's your opinion, @sloede?

@MarcoArtiano MarcoArtiano changed the title Tree Mesh centering the mesh and shifting the boundaries Tree Mesh centering the mesh and shifting the boundaries (rectangles to quads) Mar 25, 2024
@benegee
Copy link
Contributor

benegee commented Mar 27, 2024

I added this test case for StructuredMesh and then copied it for TreeMesh to test the different flux implementations. I was not aware of the quad restriction in the first place, realized how TreeMesh adapts to the provided parameters and therefore added this comment in the elixir.

@sloede
Copy link
Member

sloede commented Mar 28, 2024

Looks like a (documentation) bug to me. The TreeMesh supports only quads/cubes, no rectangles. But the constructor should complain in a case like this, I think. What's your opinion, @sloede?

From the TreeMesh implemention:

# Domain length is calculated as the maximum length in any axis direction
domain_center = @. (coordinates_min + coordinates_max) / 2
domain_length = maximum(coordinates_max .- coordinates_min)

I thus understand why the code in the example behaves as expected. I think that changing the referenced lines to first compute the lengths in each direction and to then trow an error if they do not match (within an epsilon) before taking the maximum would be a nice addition for usability!

@DanielDoehring DanielDoehring added the documentation Improvements or additions to documentation label May 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

5 participants