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 tet face node ordering to be consistent with rd.Fmask #172

Merged
merged 3 commits into from
Jun 28, 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
36 changes: 20 additions & 16 deletions src/connectivity_functions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -320,16 +320,16 @@ function build_periodic_boundary_maps!(xf, yf, zf,
yfaces = map(x -> x[1], findall(@. (@. abs(yc - ymax) < NODETOL * LY) | (@. abs(yc - ymin) < NODETOL * LY)))
zfaces = map(x -> x[1], findall(@. (@. abs(zc - zmax) < NODETOL * LZ) | (@. abs(zc - zmin) < NODETOL * LZ)))

D = zeros(eltype(xb), size(xb,1), size(xb,1))
ids = zeros(Int, size(xb, 1))
p = zeros(Int, size(xb, 1))
if is_periodic_x # find matches in x faces
for i in xfaces, j in xfaces
if i!=j
if abs(yc[i] - yc[j]) < NODETOL * LY && abs(zc[i] - zc[j]) < NODETOL * LZ && abs(abs(xc[i] - xc[j]) - LX) < NODETOL * LX
# create distance matrix
@. D = abs(yb[:,i] - yb[:,j]') + abs(zb[:,i] - zb[:,j]')
map!(x->x[1], ids, findall(@. D < NODETOL * LY))
@. mapPB[:,i] = mapMB[ids,j]
if i!=j
if abs(yc[i] - yc[j]) < NODETOL * LY &&
abs(zc[i] - zc[j]) < NODETOL * LZ &&
abs(abs(xc[i] - xc[j]) - LX) < NODETOL * LX

match_coordinate_vectors!(p, (yb[:,i], zb[:,i]), (yb[:,j], zb[:,j]))
@. mapPB[:,i] = mapMB[p,j]

FToF[Bfaces[i]] = Bfaces[j]
end
Expand All @@ -341,10 +341,12 @@ function build_periodic_boundary_maps!(xf, yf, zf,
if is_periodic_y
for i in yfaces, j = yfaces
if i!=j
if abs(xc[i] - xc[j]) < NODETOL * LX && abs(zc[i] - zc[j]) < NODETOL * LZ && abs(abs(yc[i] - yc[j]) - LY) < NODETOL * LY
@. D = abs(xb[:,i] - xb[:,j]') + abs(zb[:,i] - zb[:,j]')
map!(x->x[1], ids, findall(@. D < NODETOL * LX))
@. mapPB[:,i] = mapMB[ids,j]
if abs(xc[i] - xc[j]) < NODETOL * LX &&
abs(zc[i] - zc[j]) < NODETOL * LZ &&
abs(abs(yc[i] - yc[j]) - LY) < NODETOL * LY

match_coordinate_vectors!(p, (xb[:,i], zb[:,i]), (xb[:,j], zb[:,j]))
@. mapPB[:,i] = mapMB[p,j]

FToF[Bfaces[i]] = Bfaces[j]
end
Expand All @@ -356,10 +358,12 @@ function build_periodic_boundary_maps!(xf, yf, zf,
if is_periodic_z
for i in zfaces, j in zfaces
if i!=j
if abs(xc[i] - xc[j]) < NODETOL * LX && abs(yc[i] - yc[j]) < NODETOL * LY && abs(abs(zc[i] - zc[j]) - LZ) < NODETOL * LZ
@. D = abs(xb[:,i] - xb[:,j]') + abs(yb[:,i] - yb[:,j]')
map!(x->x[1], ids, findall(@. D < NODETOL * LX))
@. mapPB[:,i] = mapMB[ids,j]
if abs(xc[i] - xc[j]) < NODETOL * LX &&
abs(yc[i] - yc[j]) < NODETOL * LY &&
abs(abs(zc[i] - zc[j]) - LZ) < NODETOL * LZ

match_coordinate_vectors!(p, (xb[:,i], yb[:,i]), (xb[:,j], yb[:,j]))
@. mapPB[:,i] = mapMB[p,j]

FToF[Bfaces[i]] = Bfaces[j]
end
Expand Down
8 changes: 4 additions & 4 deletions src/ref_elem_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ end
function map_face_nodes(::Tet, face_nodes...)
r, s = face_nodes
e = ones(size(r))
rf = [r; r; -e; r]
sf = [-e; s; r; s]
tf = [s; -(e + r + s); s; -e]
rf = [r; -(e + r + s); -e; r]
sf = [-e; r; r; s]
tf = [s; s; s; -e]
return rf, sf, tf
end

function init_face_data(elem::Tri; quad_rule_face = gauss_quad(0,0,N))
function init_face_data(elem::Tri; quad_rule_face = gauss_quad(0, 0, N))
r1D, w1D = quad_rule_face
e = ones(size(r1D))
z = zeros(size(r1D))
Expand Down
Loading