Skip to content

Commit

Permalink
Fix double pressure clipping
Browse files Browse the repository at this point in the history
  • Loading branch information
efaulhaber committed May 23, 2024
1 parent 96aa34c commit 261a182
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/schemes/boundary/dummy_particles/dummy_particles.jl
Original file line number Diff line number Diff line change
Expand Up @@ -334,22 +334,25 @@ function compute_pressure!(boundary_model, ::AdamiPressureExtrapolation,
ceil(Int, 0.5 * Threads.nthreads()) * nparticles(neighbor_system)
nhs = get_neighborhood_search(neighbor_system, system, semi)

# Loop over fluid particles and then the neighboring boundary particles to extrapolate fluid pressure to the boundaries
# Loop over fluid particles and then the neighboring boundary particles
# to extrapolate fluid pressure to the boundaries.
adami_pressure_extrapolation_neighbor!(boundary_model, system, neighbor_system,
system_coords, neighbor_coords,
v_neighbor_system, nhs)
else
nhs = get_neighborhood_search(system, neighbor_system, semi)

# Loop over boundary particles and then the neighboring fluid particles to extrapolate fluid pressure to the boundaries
# Loop over boundary particles and then the neighboring fluid particles
# to extrapolate fluid pressure to the boundaries.
adami_pressure_extrapolation!(boundary_model, system, neighbor_system,
system_coords, neighbor_coords,
v_neighbor_system, nhs)
end
for particle in eachparticle(system)

@trixi_timeit timer() "clip pressure" begin
# Limit pressure to be non-negative to avoid attractive forces between fluid and
# boundary particles at free surfaces (sticking artifacts).
pressure[particle] = max(pressure[particle], 0.0)
pressure .= max.(pressure, 0.0)
end
end

Expand Down Expand Up @@ -449,12 +452,6 @@ end
v_neighbor_system, particle, neighbor, pos_diff,
distance, viscosity, cache, pressure)
end

@trixi_timeit timer() "clip pressure" begin
# Limit pressure to be non-negative to avoid attractive forces between fluid and
# boundary particles at free surfaces (sticking artifacts).
pressure .= max.(pressure, 0.0)
end
end

@inline function adami_pressure_extrapolation!(boundary_model, system, neighbor_system,
Expand Down

0 comments on commit 261a182

Please sign in to comment.