Skip to content
Closed
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
20 changes: 14 additions & 6 deletions src/general/semidiscretization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,9 @@ function update_nhs!(neighborhood_search,
end

function update_nhs!(neighborhood_search,
system::OpenBoundarySPHSystem, neighbor::FluidSystem,
system::OpenBoundarySPHSystem,
neighbor::Union{OpenBoundarySPHSystem, FluidSystem,
TotalLagrangianSPHSystem},
u_system, u_neighbor, semi)
# The current coordinates of both open boundaries and fluids change over time.

Expand All @@ -696,10 +698,16 @@ function update_nhs!(neighborhood_search,
end

function update_nhs!(neighborhood_search,
system::OpenBoundarySPHSystem, neighbor::TotalLagrangianSPHSystem,
u_system, u_neighbor)
# Don't update. This NHS is never used.
return neighborhood_search
system::OpenBoundarySPHSystem, neighbor::BoundarySPHSystem,
u_system, u_neighbor, semi)
# The current coordinates of both open boundaries and fluids change over time.

# TODO: Update only `active_coordinates` of open boundaries.
# Problem: Removing inactive particles from neighboring lists is necessary.
update!(neighborhood_search,
current_coordinates(u_system, system),
current_coordinates(u_neighbor, neighbor),
semi, points_moving=(true, neighbor.ismoving[]))
end

function update_nhs!(neighborhood_search,
Expand Down Expand Up @@ -820,7 +828,7 @@ function update_nhs!(neighborhood_search,
end

function update_nhs!(neighborhood_search,
system::Union{BoundarySPHSystem, OpenBoundarySPHSystem},
system::BoundarySPHSystem,
neighbor::Union{BoundarySPHSystem, OpenBoundarySPHSystem},
u_system, u_neighbor, semi)
# Don't update. This NHS is never used.
Expand Down
25 changes: 15 additions & 10 deletions src/schemes/boundary/open_boundary/system.jl
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,7 @@ function check_domain!(system, v, u, v_ode, u_ode, semi)
u_fluid = wrap_u(u_ode, fluid_system, semi)
v_fluid = wrap_v(v_ode, fluid_system, semi)

neighborhood_search = get_neighborhood_search(system, fluid_system, semi)

# TODO: Make this threaded
for particle in each_moving_particle(system)
particle_coords = current_coords(u, system, particle)

Expand All @@ -267,16 +266,22 @@ function check_domain!(system, v, u, v_ode, u_ode, semi)
convert_particle!(system, fluid_system, boundary_zone, particle,
v, u, v_fluid, u_fluid)
end
end

# Check the neighboring fluid particles whether they're entering the boundary zone
for neighbor in PointNeighbors.eachneighbor(particle_coords, neighborhood_search)
fluid_coords = current_coords(u_fluid, fluid_system, neighbor)
system_coords = current_coordinates(u, system)
neighbor_coords = current_coordinates(u_fluid, fluid_system)

# Check if neighboring fluid particle is in boundary zone
if is_in_boundary_zone(boundary_zone, fluid_coords)
convert_particle!(fluid_system, system, boundary_zone, neighbor,
v, u, v_fluid, u_fluid)
end
# TODO Make this threaded
foreach_point_neighbor(system, fluid_system, system_coords, neighbor_coords, semi;
points=each_moving_particle(system),
parallelization_backend=false) do particle, neighbor,
pos_diff, distance
fluid_coords = current_coords(u_fluid, fluid_system, neighbor)

# Check if neighboring fluid particle is in boundary zone
if is_in_boundary_zone(boundary_zone, fluid_coords)
convert_particle!(fluid_system, system, boundary_zone, neighbor,
v, u, v_fluid, u_fluid)
end
end

Expand Down
Loading