Skip to content

Conversation

@SimonCan
Copy link
Contributor

@SimonCan SimonCan commented Oct 9, 2025

Added capability of coupling pest mesh views with hanging/non-conforming nodes.

SimonCan and others added 30 commits May 30, 2025 12:01
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
There is still one part with hard-coded resolution, which needs to be changed.
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
SimonCan and others added 22 commits October 23, 2025 08:09
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Comment on lines +113 to 129
@trixi_testset "elixir_advection_coupled.jl" begin
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_coupled.jl"),
l2=[0., 0.],
linf=[0., 0.])
# Ensure that we do not have excessive memory allocations
# (e.g., from type instabilities)
@test_allocations(Trixi.rhs!, semi, sol, 135553)

# Ensure we cover the calculation of the node coordinates
node_coordinates = typeof(parent_mesh.tree_node_coordinates)(undef, 2,
ntuple(_ -> length(parent_mesh.nodes),
2)...,
length(mesh.cell_ids))
result = Trixi.calc_node_coordinates!(node_coordinates, mesh, parent_mesh.nodes)
@test parent_mesh.tree_node_coordinates == result

length(mesh1.cell_ids))
# Load the mesh file for code coverage.
loaded_mesh = Trixi.load_mesh_serial(joinpath("out", "mesh.h5"); n_cells_max = 0,
loaded_mesh = Trixi.load_mesh_serial(joinpath("out", "mesh_1_000000000.h5"); n_cells_max = 0,
RealT = typeof(parent_mesh).parameters[3])
end
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
@trixi_testset "elixir_advection_coupled.jl" begin
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_coupled.jl"),
l2=[0., 0.],
linf=[0., 0.])
# Ensure that we do not have excessive memory allocations
# (e.g., from type instabilities)
@test_allocations(Trixi.rhs!, semi, sol, 135553)
# Ensure we cover the calculation of the node coordinates
node_coordinates = typeof(parent_mesh.tree_node_coordinates)(undef, 2,
ntuple(_ -> length(parent_mesh.nodes),
2)...,
length(mesh.cell_ids))
result = Trixi.calc_node_coordinates!(node_coordinates, mesh, parent_mesh.nodes)
@test parent_mesh.tree_node_coordinates == result
length(mesh1.cell_ids))
# Load the mesh file for code coverage.
loaded_mesh = Trixi.load_mesh_serial(joinpath("out", "mesh.h5"); n_cells_max = 0,
loaded_mesh = Trixi.load_mesh_serial(joinpath("out", "mesh_1_000000000.h5"); n_cells_max = 0,
RealT = typeof(parent_mesh).parameters[3])
end
@trixi_testset "elixir_advection_coupled.jl" begin
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_coupled.jl"),
l2=[0.0, 0.0],
linf=[0.0, 0.0])
# Ensure that we do not have excessive memory allocations
# (e.g., from type instabilities)
@test_allocations(Trixi.rhs!, semi, sol, 135553)

0.024657539839658474,
0.0,
0.0,
0.0,
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
0.0,
0.98015167453983, 0.10475978783943254,
0.15551175906375883,
0.0,

0.0,
0.0,
0.0,
0.0,
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
0.0,
2.026208477271868e-5],
linf=[10.19496728149964, 18.23726813972206,
10.04367783820621,
0.0,

Comment on lines +613 to +620
0.0098589277826056,
0.011870558900297097,
6.882386285170543e-6,
0.024648257743835045
],
linf=[0.013719847889148373,
0.01678917375613853,
2.933466212909218e-5,
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
0.0098589277826056,
0.011870558900297097,
6.882386285170543e-6,
0.024648257743835045
],
linf=[0.013719847889148373,
0.01678917375613853,
2.933466212909218e-5,
19.63022306543678, 1.3952679820406384, 1.8716515525771589,

0.01678917375613853,
2.933466212909218e-5,
0.0,
0.03429795097747568,
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
0.03429795097747568,
0.0017266639582675424],
tspan=(0.0, 0.02))
# Ensure that we do not have excessive memory allocations
# (e.g., from type instabilities)
@test_allocations(Trixi.rhs!, semi, sol, 1000)
end
@trixi_testset "elixir_mhd_rotor_cfl_ramp.jl" begin
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_mhd_rotor_cfl_ramp.jl"),
l2=[
0.45519051169507474,
0.8917985468745363,
0.8324681609772325,

0.0,
0.03429795097747568,
0.0,
0.0,
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
0.0,
0.9801426190285389,
0.10476233464125001,
0.15551270692826116,
0.0,

0.03429795097747568,
0.0,
0.0,
0.0,
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
0.0,
2.0201603821472296e-5
],
linf=[
10.196786739705292,
18.267539012179128,
10.046104290498878,
0.0,

0.0,
0.0,
0.0,
0.0,
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
0.0,
19.668302849210974,
1.395022093528294,
1.8717844606331189,
0.0,

Comment on lines +627 to +635
0.01368217970493435,
0.016790901855796785,
3.091328454846926e-5,
0.034236712653821444])
# Ensure we cover the calculation of the node coordinates
node_coordinates = typeof(parent_mesh.tree_node_coordinates)(undef, 2,
ntuple(_ -> length(parent_mesh.nodes),
2)...,
length(mesh1.cell_ids))
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
0.01368217970493435,
0.016790901855796785,
3.091328454846926e-5,
0.034236712653821444])
# Ensure we cover the calculation of the node coordinates
node_coordinates = typeof(parent_mesh.tree_node_coordinates)(undef, 2,
ntuple(_ -> length(parent_mesh.nodes),
2)...,
length(mesh1.cell_ids))
0.001651262488701531
],
tspan=(0.0, 0.02))
# Ensure that we do not have excessive memory allocations
# (e.g., from type instabilities)
@test_allocations(Trixi.rhs!, semi, sol, 1000)

Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

@trixi_testset "elixir_advection_basic.jl" begin
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_basic.jl"),
# Expected errors are exactly the same as with TreeMesh!
l2=[8.311947673061856e-6],
linf=[6.627000273229378e-5])
# Ensure that we do not have excessive memory allocations
# (e.g., from type instabilities)
@test_allocations(Trixi.rhs!, semi, sol, 1000)
semi32 = Trixi.trixi_adapt(Array, Float32, semi)
@test real(semi32.solver) == Float32
@test real(semi32.solver.basis) == Float32
@test real(semi32.solver.mortar) == Float32
# TODO: remake ignores the mesh itself as well
@test real(semi32.mesh) == Float64
end

Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

@trixi_testset "elixir_advection_restart_amr.jl" begin
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_restart_amr.jl"),
l2=[2.869137983727866e-6],
linf=[3.8353423270964804e-5])
# Ensure that we do not have excessive memory allocations
# (e.g., from type instabilities)
@test_allocations(Trixi.rhs!, semi, sol, 1000)
end

Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

@trixi_testset "elixir_mhd_alfven_wave.jl" begin
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_mhd_alfven_wave.jl"),
l2=[1.0513414461545583e-5, 1.0517900957166411e-6,
1.0517900957304043e-6, 1.511816606372376e-6,
1.0443997728645063e-6, 7.879639064990798e-7,
7.879639065049896e-7, 1.0628631669056271e-6,
4.3382328912336153e-7],
linf=[4.255466285174592e-5, 1.0029706745823264e-5,
1.0029706747467781e-5, 1.2122265939010224e-5,
5.4791097160444835e-6, 5.18922042269665e-6,
5.189220422141538e-6, 9.552667261422676e-6,
1.4237578427628152e-6])
# Ensure that we do not have excessive memory allocations
# (e.g., from type instabilities)
let
t = sol.t[end]
u_ode = sol.u[end]
du_ode = similar(u_ode)
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
end
@trixi_testset "elixir_euler_mhd_coupled.jl" begin
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_mhd_coupled.jl"),
l2=[0.009862595305604965,
0.011874205535856063,
5.0185914245237475e-6,
0.0,
0.024657539839658474,
0.0,

Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

end
@trixi_testset "elixir_mhd_alfven_wave_nonconforming.jl" begin
@test_trixi_include(joinpath(EXAMPLES_DIR,
"elixir_mhd_alfven_wave_nonconforming.jl"),
l2=[
0.0322570437144848,
0.03598284801272945,
0.03562228071357411,
0.05288641880143085,
0.040752873778199326,
0.04207276835260492,
0.04171391252403866,
0.05289242879893149,
0.0016038935411812223
],
linf=[
0.175984910510666,
0.13999726708245439,
0.13336032728399658,
0.21248359539637798,
0.133294808938885,
0.17934684696413217,
0.1831567822932948,
0.21575881133569155,
0.01967917976620703
],
tspan=(0.0, 0.25))
# Ensure that we do not have excessive memory allocations
# (e.g., from type instabilities)
@test_allocations(Trixi.rhs!, semi, sol, 1000)
end
@trixi_testset "elixir_mhd_rotor.jl" begin
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_mhd_rotor.jl"),
l2=[0.4551839744017604, 0.8917986079085971, 0.832474072904728,
0.0,
0.98015167453983, 0.10475978783943254,
0.15551175906375883,
0.0,
2.026208477271868e-5],
linf=[10.19496728149964, 18.23726813972206,
10.04367783820621,
0.0,
19.63022306543678, 1.3952679820406384, 1.8716515525771589,
0.0,
0.0017266639582675424],
tspan=(0.0, 0.02))
# Ensure that we do not have excessive memory allocations
# (e.g., from type instabilities)
@test_allocations(Trixi.rhs!, semi, sol, 1000)
end
@trixi_testset "elixir_mhd_rotor_cfl_ramp.jl" begin
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_mhd_rotor_cfl_ramp.jl"),
l2=[
0.45519051169507474,
0.8917985468745363,
0.8324681609772325,
0.0,
0.9801426190285389,
0.10476233464125001,
0.15551270692826116,
0.0,
2.0201603821472296e-5
],
linf=[
10.196786739705292,
18.267539012179128,
10.046104290498878,
0.0,
19.668302849210974,
1.395022093528294,
1.8717844606331189,
0.0,
0.001651262488701531
],
tspan=(0.0, 0.02))
# Ensure that we do not have excessive memory allocations
# (e.g., from type instabilities)
@test_allocations(Trixi.rhs!, semi, sol, 1000)
end

for i in 1:length(semis)
n_cells += size(semis[i].cache.elements.node_coordinates)[end]
end
parent_tree_node_coordinates = Array{Real, 2 + 2}(undef, 2, ntuple(_ -> 4, 2)..., n_cells)
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
parent_tree_node_coordinates = Array{Real, 2 + 2}(undef, 2, ntuple(_ -> 4, 2)..., n_cells)
parent_tree_node_coordinates = Array{Real, 2 + 2}(undef, 2, ntuple(_ -> 4, 2)...,
n_cells)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request low-priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants