Skip to content
Open
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
10 changes: 6 additions & 4 deletions src/general/interpolation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -555,8 +555,9 @@ end
ref_id = system_indices(ref_system, semi)
ref_smoothing_kernel = ref_system.smoothing_kernel

# If we don't cut at the boundary, we only need to iterate over the reference system
systems = cut_off_bnd ? semi : (ref_system,)
# If we neither cut off at the boundary nor include the boundary wall velocity,
# we only need to iterate over the reference system.
systems = (cut_off_bnd || include_wall_velocity) ? semi : (ref_system,)
Comment thread
efaulhaber marked this conversation as resolved.

foreach_system(systems) do neighbor_system
system_id = system_indices(neighbor_system, semi)
Expand Down Expand Up @@ -607,8 +608,9 @@ end
end

@threaded parallelization_backend for point in axes(point_coords, 2)
if other_density[point] > computed_density[point] ||
computed_density[point] < eps()
cut_off = computed_density[point] < eps() ||
(cut_off_bnd && other_density[point] > computed_density[point])
if cut_off
# Return NaN values that can be filtered out in ParaView
computed_density[point] = NaN
neighbor_count[point] = 0
Expand Down
71 changes: 59 additions & 12 deletions test/general/interpolation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,20 @@
u_bnd; endpoint=true,
cut_off_bnd)

result_endpoint_wall_velocity = TrixiParticles.interpolate_line([
1.0,
-0.05
],
[1.0, 1.0],
5,
semi_boundary,
fluid_system,
v_bnd,
u_bnd;
endpoint=true,
cut_off_bnd,
include_wall_velocity=true)

result = TrixiParticles.interpolate_line([1.0, -0.05], [1.0, 1.0], 5,
semi_no_boundary, fluid_system,
v_no_bnd, u_no_bnd; endpoint=false,
Expand Down Expand Up @@ -512,6 +526,8 @@

compare_interpolation_result(result, expected_res)
compare_interpolation_result(result_endpoint, expected_res_end)
compare_interpolation_result(result_endpoint_wall_velocity,
expected_res_end)

else
expected_res = (density=[666.0, 666.0, 666.0], neighbor_count=[2, 2, 1],
Expand All @@ -522,29 +538,44 @@
pressure=[
0.4527147691600855,
0.9912738969258665,
1.4000000000000001
1.4
])
expected_res_end = (density=[
666.0,
666.0,
665.9999999999999,
666.0,
666.0
], neighbor_count=[1, 2, 2, 1, 1],
expected_res_end = (density=[666.0, 666.0, 666.0, 666.0, 666.0],
neighbor_count=[1, 2, 2, 1, 1],
point_coords=[1.0 1.0 1.0 1.0 1.0;
-0.05 0.2125 0.475 0.7375 1.0],
velocity=[7.7 7.699999999999999 7.699999999999999 7.7 7.7;
0.10099999999999999 0.10605429538320173 0.12465095587703465 0.14900000000000002 0.22100000000000006],
velocity=[7.7 7.7 7.7 7.7 7.7;
0.101 0.10605429538320173 0.12465095587703465 0.149 0.221],
pressure=[
0.19999999999999998,
0.2,
0.4527147691600855,
0.9912738969258663,
1.4000000000000001,
1.4,
2.2
])
expected_res_end_wall_velocity = (density=[
666.0,
666.0,
666.0,
666.0,
666.0
], neighbor_count=[2, 2, 2, 1, 1],
point_coords=[1.0 1.0 1.0 1.0 1.0;
-0.05 0.2125 0.475 0.7375 1.0],
velocity=[0.7077120921221691 7.7 7.7 7.7 7.7;
0.009282976792771307 0.10605429538320173 0.12465095587703465 0.149 0.221],
pressure=[
0.2,
0.4527147691600855,
0.9912738969258663,
1.4,
2.2
])

compare_interpolation_result(result, expected_res)
compare_interpolation_result(result_endpoint, expected_res_end)
compare_interpolation_result(result_endpoint_wall_velocity,
expected_res_end_wall_velocity)
end
end
end
Expand Down Expand Up @@ -575,11 +606,19 @@
include_wall_velocity=true,
fluid_system, v_ode, u_ode).velocity

v_wall_velocity_without_cutoff = interpolate_points(points_coords,
semi_boundary,
include_wall_velocity=true,
fluid_system,
v_ode, u_ode;
cut_off_bnd=false).velocity

v_no_wall_velocity = interpolate_points(points_coords, semi_boundary,
include_wall_velocity=false,
fluid_system, v_ode, u_ode).velocity

@test isapprox(v_wall_velocity[2, 1], 0.0; atol=eps())
@test isapprox(v_wall_velocity_without_cutoff[2, 1], 0.0; atol=eps())
@test isapprox(v_no_wall_velocity[2, 1], 0.1; atol=eps())
Comment thread
efaulhaber marked this conversation as resolved.
@test any(isapprox.(v_wall_velocity[:, 3:end], v_no_wall_velocity[:, 3:end],
atol=eps()))
Expand Down Expand Up @@ -937,11 +976,19 @@
include_wall_velocity=true,
fluid_system, v_ode, u_ode).velocity

v_wall_velocity_without_cutoff = interpolate_points(points_coords,
semi_boundary,
include_wall_velocity=true,
fluid_system,
v_ode, u_ode;
cut_off_bnd=false).velocity

v_no_wall_velocity = interpolate_points(points_coords, semi_boundary,
include_wall_velocity=false,
fluid_system, v_ode, u_ode).velocity

@test isapprox(v_wall_velocity[2, 1], 0.0; atol=eps())
@test isapprox(v_wall_velocity_without_cutoff[2, 1], 0.0; atol=eps())
@test isapprox(v_no_wall_velocity[2, 1], 0.1; atol=eps())
Comment thread
efaulhaber marked this conversation as resolved.
@test any(isapprox.(v_wall_velocity[:, 3:end], v_no_wall_velocity[:, 3:end],
atol=eps()))
Expand Down
Loading