Skip to content

Commit 28f5ddc

Browse files
committed
Add TLSPH benchmark
1 parent 1cce321 commit 28f5ddc

1 file changed

Lines changed: 37 additions & 1 deletion

File tree

benchmarks/smoothed_particle_hydrodynamics.jl

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,25 @@ using BenchmarkTools
44

55
const TrivialNeighborhoodSearch = PointNeighbors.TrivialNeighborhoodSearch
66
const GridNeighborhoodSearch = PointNeighbors.GridNeighborhoodSearch
7+
const PrecomputedNeighborhoodSearch = PointNeighbors.PrecomputedNeighborhoodSearch
78

89
"""
910
benchmark_wcsph(neighborhood_search, coordinates; parallel = true)
1011
1112
A benchmark of the right-hand side of a full real-life Weakly Compressible
1213
Smoothed Particle Hydrodynamics (WCSPH) simulation with TrixiParticles.jl.
14+
This method is used to simulate an incompressible fluid.
1315
"""
1416
function benchmark_wcsph(neighborhood_search, coordinates; parallel = true)
1517
density = 1000.0
1618
fluid = InitialCondition(; coordinates, density, mass = 0.1)
1719

1820
# Compact support == smoothing length for the Wendland kernel
19-
smoothing_length = neighborhood_search.search_radius
21+
if neighborhood_search isa PrecomputedNeighborhoodSearch
22+
smoothing_length = neighborhood_search.neighborhood_search.search_radius
23+
else
24+
smoothing_length = neighborhood_search.search_radius
25+
end
2026
smoothing_kernel = WendlandC2Kernel{ndims(neighborhood_search)}()
2127

2228
sound_speed = 10.0
@@ -39,3 +45,33 @@ function benchmark_wcsph(neighborhood_search, coordinates; parallel = true)
3945
return @belapsed TrixiParticles.interact!($dv, $v, $u, $v, $u, $neighborhood_search,
4046
$fluid_system, $fluid_system)
4147
end
48+
49+
"""
50+
benchmark_tlsph(neighborhood_search, coordinates; parallel = true)
51+
52+
A benchmark of the right-hand side of a full real-life Total Lagrangian
53+
Smoothed Particle Hydrodynamics (TLSPH) simulation with TrixiParticles.jl.
54+
This method is used to simulate an elastic structure.
55+
"""
56+
function benchmark_tlsph(neighborhood_search, coordinates; parallel = true)
57+
material = (density = 1000.0, E = 1.4e6, nu = 0.4)
58+
solid = InitialCondition(; coordinates, density = material.density, mass = 0.1)
59+
60+
# Compact support == smoothing length for the Wendland kernel
61+
if neighborhood_search isa PrecomputedNeighborhoodSearch
62+
smoothing_length = neighborhood_search.neighborhood_search.search_radius
63+
else
64+
smoothing_length = neighborhood_search.search_radius
65+
end
66+
smoothing_kernel = WendlandC2Kernel{ndims(neighborhood_search)}()
67+
68+
solid_system = TotalLagrangianSPHSystem(solid, smoothing_kernel, smoothing_length,
69+
material.E, material.nu)
70+
71+
v = copy(solid.velocity)
72+
u = copy(solid.coordinates)
73+
dv = zero(v)
74+
75+
return @belapsed TrixiParticles.interact!($dv, $v, $u, $v, $u, $neighborhood_search,
76+
$solid_system, $solid_system)
77+
end

0 commit comments

Comments
 (0)