From edbcfd618c5a0651c858b913317867618085de50 Mon Sep 17 00:00:00 2001 From: Patrick Jaap Date: Tue, 29 Apr 2025 09:29:08 +0200 Subject: [PATCH 1/2] Remove grid arg from Example212 and Example 312 --- examples/Example212_PeriodicBoundary2D.jl | 2 +- examples/Example312_PeriodicBoundary3D.jl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/Example212_PeriodicBoundary2D.jl b/examples/Example212_PeriodicBoundary2D.jl index e853ad79..24bd7bd9 100644 --- a/examples/Example212_PeriodicBoundary2D.jl +++ b/examples/Example212_PeriodicBoundary2D.jl @@ -153,7 +153,7 @@ function main(; return nothing end - coupling_matrix = get_periodic_coupling_matrix(FES, xgrid, reg_left, reg_right, give_opposite!) + coupling_matrix = get_periodic_coupling_matrix(FES, reg_left, reg_right, give_opposite!) display(coupling_matrix) assign_operator!(PD, CombineDofs(u, u, coupling_matrix; kwargs...)) end diff --git a/examples/Example312_PeriodicBoundary3D.jl b/examples/Example312_PeriodicBoundary3D.jl index 7e982702..671bc869 100644 --- a/examples/Example312_PeriodicBoundary3D.jl +++ b/examples/Example312_PeriodicBoundary3D.jl @@ -168,7 +168,7 @@ function main(; y[1] = width - x[1] return nothing end - coupling_matrix = get_periodic_coupling_matrix(FES, xgrid, reg_left, reg_right, give_opposite!) + coupling_matrix = get_periodic_coupling_matrix(FES, reg_left, reg_right, give_opposite!) display(coupling_matrix) assign_operator!(PD, CombineDofs(u, u, coupling_matrix; kwargs...)) end From 16790a4f0859463c4db1d0c3c594cc9681349b60 Mon Sep 17 00:00:00 2001 From: Patrick Jaap Date: Tue, 29 Apr 2025 09:30:06 +0200 Subject: [PATCH 2/2] give (hopefully) helpful error message in get_periodic_coupling_matrix --- src/helper_functions.jl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/helper_functions.jl b/src/helper_functions.jl index 193cf061..e5f14186 100644 --- a/src/helper_functions.jl +++ b/src/helper_functions.jl @@ -347,6 +347,10 @@ function _get_periodic_coupling_matrix( fe_vector.entries[local_dof] = 1.0 # interpolate on the opposite boundary using x_trafo = give_opposite + if !haskey(search_areas, face_numbers_of_bfaces[i_boundary_face]) + throw("face $(face_numbers_of_bfaces[i_boundary_face]) is not on source boundary. Are the from/to regions and the give_opposite function correct?") + end + interpolate!( fe_vector_target[1], ON_FACES, eval_point,