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 Fmask calculation for SBP approx type on Hex elements #180

Merged
merged 2 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/RefElemData_SBP.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,20 @@ function RefElemData(elementType::Union{Quad, Hex}, approxType::SBP{TensorProduc
Polynomial(TensorProductQuadrature(gauss_lobatto_quad(0, 0, N))),
N; kwargs...)

# brute-force determine Fmask so that rd.rf = rd.r[rd.Fmask], etc.
new_Fmask = copy(rd.Fmask)
for fid in eachindex(rd.rf)
rstf = SVector(getindex.(rd.rstf, fid))
for i in eachindex(rd.r)
rst = SVector(getindex.(rd.rst, i))
if rstf ≈ rst
new_Fmask[fid] = i
break
end
end
end
rd = @set rd.Fmask = new_Fmask;

rd = @set rd.Vf = droptol!(sparse(rd.Vf), tol)
rd = @set rd.LIFT = Diagonal(rd.wq) \ (rd.Vf' * Diagonal(rd.wf)) # TODO: make this more efficient with LinearMaps?

Expand Down
3 changes: 3 additions & 0 deletions test/multidim_sbp_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@
@testset "TensorProductLobatto Hex" begin
rd = RefElemData(Hex(),SBP(),N)
@test propertynames(rd)[1] == :element_type
@test rd.rf == rd.r[rd.Fmask]
@test rd.sf == rd.s[rd.Fmask]
@test rd.tf == rd.t[rd.Fmask]
@test rd.t == rd.rst[3]
@test rd.tf == rd.rstf[3]
@test rd.tq == rd.rstq[3]
Expand Down
Loading