Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 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
4 changes: 3 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
ReadVTK = "dc215faf-f008-4882-a9f7-a79a826fadc3"
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
SIMD = "fdea26ae-647d-5447-a871-4b548cad5224"
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
Expand Down Expand Up @@ -58,11 +59,12 @@ JSON = "1"
KernelAbstractions = "0.9"
OrdinaryDiffEq = "6.91"
OrdinaryDiffEqCore = "2, 3"
PointNeighbors = "0.6.5"
PointNeighbors = "0.6.6"
Polyester = "0.7.10"
ReadVTK = "0.2"
RecipesBase = "1"
Reexport = "1"
SIMD = "3.7.2"
SciMLBase = "2"
StaticArrays = "1"
Statistics = "1"
Expand Down
1 change: 1 addition & 0 deletions src/TrixiParticles.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ using Random: seed!
using SciMLBase: SciMLBase, CallbackSet, DiscreteCallback, DynamicalODEProblem, u_modified!,
get_tmp_cache, set_proposed_dt!, ODESolution, ODEProblem, terminate!,
add_tstop!
using SIMD: SIMD
@reexport using StaticArrays: SVector
using StaticArrays: @SMatrix, SMatrix, setindex
using Statistics: Statistics
Expand Down
5 changes: 3 additions & 2 deletions src/general/corrections.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,16 @@ end
# `rho_mean` is the mean density of the fluid, which is used to determine correction values near the free surface.
# Return a tuple `(viscosity_correction, pressure_correction, surface_tension_correction)` representing the correction terms.
@inline function free_surface_correction(correction::AkinciFreeSurfaceCorrection,
particle_system, rho_mean)
particle_system, rho_a, rho_b)
# Equation 4 in ref
rho_mean = (rho_a + rho_b) / 2
k = correction.rho0 / rho_mean

# Viscosity, pressure, surface_tension
return k, 1, k
end

@inline function free_surface_correction(correction, particle_system, rho_mean)
@inline function free_surface_correction(correction, particle_system, rho_a, rho_b)
return 1, 1, 1
end

Expand Down
18 changes: 18 additions & 0 deletions src/general/neighborhood_search.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,24 @@ function PointNeighbors.foreach_point_neighbor(f, system, neighbor_system,
points, parallelization_backend)
end

@propagate_inbounds function foreach_neighbor(f, system_coords, neighbor_coords,
neighborhood_search, backend, particle)
Comment thread
efaulhaber marked this conversation as resolved.
PointNeighbors.foreach_neighbor(f, system_coords, neighbor_coords,
neighborhood_search, particle)
end

# We cannot dispatch by `AbstractGPUArray` because this is called from within
# a kernel, where the arrays are device arrays (like `CuDeviceArray`),
# which are not `AbstractGPUArray`s.
@inline function foreach_neighbor(f, system_coords, neighbor_coords, neighborhood_search,
backend::KernelAbstractions.GPU, particle)
# On GPUs, remove all bounds checks for maximum performance.
# Note that this is not safe if the neighborhood search was not initialized correctly.
# For example, this is unsafe when benchmarking `interact!` with the wrong NHS.
PointNeighbors.foreach_neighbor_unsafe(f, system_coords, neighbor_coords,
neighborhood_search, particle)
end

# === Compact support selection ===
# -- Generic
@inline function compact_support(system, neighbor)
Expand Down
17 changes: 7 additions & 10 deletions src/schemes/fluid/implicit_incompressible_sph/rhs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,14 @@ function interact!(dv, v_particle_system, u_particle_system,
m_a = @inbounds hydrodynamic_mass(particle_system, particle)
m_b = @inbounds hydrodynamic_mass(neighbor_system, neighbor)

p_a = @inbounds current_pressure(v_particle_system, particle_system, particle)
# The following call is equivalent to
# `p_a = particle_pressure(v_particle_system, particle_system, particle)`
# `p_b = particle_pressure(v_neighbor_system, neighbor_system, neighbor)`
# Only when the neighbor system is a `WallBoundarySystem` or a `TotalLagrangianSPHSystem`
# with the boundary model `PressureMirroring`, this will return `p_b = p_a`, which is
# the pressure of the fluid particle.
p_a,
p_b = @inbounds particle_neighbor_pressure(v_particle_system,
v_neighbor_system,
particle_system, neighbor_system,
particle, neighbor)
# `p_b = current_pressure(v_neighbor_system, neighbor_system, neighbor)`
# Only when the neighbor system is a `WallBoundarySystem`
# or a `TotalLagrangianSPHSystem` with the boundary model `PressureMirroring`,
# this will return `p_b = p_a`, which is the pressure of the fluid particle.
p_b = @inbounds neighbor_pressure(v_neighbor_system, neighbor_system,
neighbor, p_a)

dv_pressure = pressure_acceleration(particle_system, neighbor_system,
particle, neighbor,
Expand Down
Loading
Loading