Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jlchan committed Jun 28, 2024
2 parents 3d6e5c5 + 44c8237 commit 5f0ff52
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 20 deletions.
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

2 comments on commit 5f0ff52

@jlchan
Copy link
Owner Author

@jlchan jlchan commented on 5f0ff52 Jun 28, 2024

Choose a reason for hiding this comment

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

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/109974

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.0.2 -m "<description of version>" 5f0ff520d35a69acc49c606feb1ac7c018c9b1f0
git push origin v1.0.2

Please sign in to comment.