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

Reduce window size phase ratio calculation on the vertices #159

Merged
merged 2 commits into from
Oct 21, 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
9 changes: 6 additions & 3 deletions src/PhaseRatios/kernels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,11 @@ end
cell_index = i_cell, j_cell, k_cell

for ip in cellaxes(phases)
p = @index(pxi[1][ip, cell_index...]),
@index(pxi[2][ip, cell_index...]),
@index(pxi[3][ip, cell_index...])
p = @index(pxi[1][ip, cell_index...]), @index(pxi[2][ip, cell_index...]), @index(pxi[3][ip, cell_index...])
any(isnan, p) && continue
# check if it's within half cell
prod(x -> abs(x[1] - x[2]) ≥ x[3] / 2, zip(p, cell_vertex, di)) && continue

x = @inline bilinear_weight(cell_vertex, p, di)
ph_local = @index phases[ip, cell_index...]
# this is doing sum(w * δij(i, phase)), where δij is the Kronecker delta
Expand Down Expand Up @@ -107,6 +108,8 @@ end
for ip in cellaxes(phases)
p = @index(pxi[1][ip, cell_index...]), @index(pxi[2][ip, cell_index...])
any(isnan, p) && continue
# check if it's within half cell
prod(x -> abs(x[1] - x[2]) ≤ x[3] / 2, zip(p, cell_vertex, di)) && continue
x = @inline bilinear_weight(cell_vertex, p, di)
ph_local = @index phases[ip, cell_index...]
# this is doing sum(w * δij(i, phase)), where δij is the Kronecker delta
Expand Down
3 changes: 1 addition & 2 deletions test/test_2D.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

@static if ENV["JULIA_JUSTPIC_BACKEND"] === "AMDGPU"
using AMDGPU
AMDGPU.allowscalar(true)
Expand Down Expand Up @@ -265,7 +264,7 @@ end
end

# Initialize particles -------------------------------
nxcell, max_xcell, min_xcell = 12, 24, 5
nxcell, max_xcell, min_xcell = 30, 40, 20
particles = init_particles(
backend,
nxcell,
Expand Down