Skip to content

Commit

Permalink
Minor fix initial values to zeros for prolong mortars kernel
Browse files Browse the repository at this point in the history
  • Loading branch information
huiyuxie committed Aug 29, 2024
1 parent 78665ef commit 11edec5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
5 changes: 3 additions & 2 deletions src/solvers/dg_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -834,8 +834,9 @@ function cuda_prolong2mortars!(u, mesh::TreeMesh{2}, cache_mortars::False, dg::D
neighbor_ids = CuArray{Int64}(cache.mortars.neighbor_ids)
large_sides = CuArray{Int64}(cache.mortars.large_sides)
orientations = CuArray{Int64}(cache.mortars.orientations)
u_upper = CuArray{Float64}(cache.mortars.u_upper)
u_lower = CuArray{Float64}(cache.mortars.u_lower)
u_upper = zero(CuArray{Float64}(cache.mortars.u_upper))
u_lower = zero(CuArray{Float64}(cache.mortars.u_lower))

forward_upper = CuArray{Float64}(dg.mortar.forward_upper)
forward_lower = CuArray{Float64}(dg.mortar.forward_lower)

Expand Down
17 changes: 9 additions & 8 deletions src/solvers/dg_3d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@ function prolong_mortars_large2small_kernel!(u_upper_left, u_upper_right, u_lowe
isequal(orientation, 1) * j1j1 + isequal(orientation, 2) * 1 + isequal(orientation, 3) * j2,
isequal(orientation, 1) * j2 + isequal(orientation, 2) * j2 + isequal(orientation, 3) * 1,
large_element] * isequal(large_side, 2)

tmp_upper_right[leftright, i, j1, j2, k] += forward_upper[j1, j1j1] *
u[i,
isequal(orientation, 1) * 1 + isequal(orientation, 2) * j1j1 + isequal(orientation, 3) * j1j1,
Expand Down Expand Up @@ -763,10 +764,10 @@ function cuda_prolong2mortars!(u, mesh::TreeMesh{3}, cache_mortars::False, dg::D
neighbor_ids = CuArray{Int64}(cache.mortars.neighbor_ids)
large_sides = CuArray{Int64}(cache.mortars.large_sides)
orientations = CuArray{Int64}(cache.mortars.orientations)
u_upper_left = CuArray{Float64}(cache.mortars.u_upper_left)
u_upper_right = CuArray{Float64}(cache.mortars.u_upper_right)
u_lower_left = CuArray{Float64}(cache.mortars.u_lower_left)
u_lower_right = CuArray{Float64}(cache.mortars.u_lower_right)
u_upper_left = zero(CuArray{Float64}(cache.mortars.u_upper_left))
u_upper_right = zero(CuArray{Float64}(cache.mortars.u_upper_right))
u_lower_left = zero(CuArray{Float64}(cache.mortars.u_lower_left))
u_lower_right = zero(CuArray{Float64}(cache.mortars.u_lower_right))

forward_upper = CuArray{Float64}(dg.mortar.forward_upper)
forward_lower = CuArray{Float64}(dg.mortar.forward_lower)
Expand All @@ -786,10 +787,10 @@ function cuda_prolong2mortars!(u, mesh::TreeMesh{3}, cache_mortars::False, dg::D
neighbor_ids, large_sides, orientations;
configurator_3d(prolong_mortars_small2small_kernel,
size_arr)...)
tmp_upper_left = similar(u_upper_left)
tmp_upper_right = similar(u_upper_right)
tmp_lower_left = similar(u_lower_left)
tmp_lower_right = similar(u_lower_right)
tmp_upper_left = zero(similar(u_upper_left))
tmp_upper_right = zero(similar(u_upper_right))
tmp_lower_left = zero(similar(u_lower_left))
tmp_lower_right = zero(similar(u_lower_right))

size_arr = CuArray{Float64}(undef, size(u_upper_left, 2), size(u_upper_left, 3)^2,
size(u_upper_left, 5))
Expand Down

0 comments on commit 11edec5

Please sign in to comment.