Skip to content

Commit

Permalink
Fix Fmask calculation for SBP approx type on Hex elements (#180)
Browse files Browse the repository at this point in the history
* fix Fmask calculation for SBP Hexes

* fix comment and remove print statement
  • Loading branch information
jlchan authored Aug 30, 2024
1 parent 973ee90 commit feb3bc4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
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

0 comments on commit feb3bc4

Please sign in to comment.