Closed kaipartmann closed 1 week ago
Attention: Patch coverage is 91.48418%
with 35 lines
in your changes missing coverage. Please review.
Project coverage is 89.49%. Comparing base (
c942dd0
) to head (7ee026a
).
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Contact is now working:
using Peridynamics
function sphere_impact(path)
Ø = 0.15
ΔX0_sphere = Ø / 8
pos_sphere, vol_sphere = uniform_sphere(Ø, ΔX0_sphere; center_z=Ø / 2 + ΔX0_sphere)
sphere = Body(BBMaterial(), pos_sphere, vol_sphere)
failure_permit!(sphere, false)
material!(sphere; horizon=3.1ΔX0_sphere, E=210e9, rho=8000, Gc=2000)
velocity_ic!(sphere, :all_points, :z, -20)
lxy, lz = 2.0, 0.1
ΔX0_plate = lz / 4
pos_plate, vol_plate = uniform_box(lxy, lxy, lz, ΔX0_plate; center_z=-lz / 2)
plate = Body(BBMaterial(), pos_plate, vol_plate)
material!(plate; horizon=3.1ΔX0_plate, E=27e9, rho=2700, Gc=10)
ms = MultibodySetup(:sphere => sphere, :plate => plate)
contact!(ms, :sphere, :plate; radius=min(ΔX0_sphere, ΔX0_plate))
vv = VelocityVerlet(steps=2000)
job = Job(ms, vv; path=path)
submit(job)
return nothing
end
However, a strange performance difference can be seen when playing around with threaded_nhs_update
:
https://github.com/kaipartmann/Peridynamics.jl/blob/7ee026a020181d2fe5542e848a0ccbfcdeb8563b/src/physics/short_range_force_contact.jl#L70-L71
# `threaded_nhs_update=true`
# 49.821336 seconds (2.93 M allocations: 3.263 GiB, 0.13% gc time)
# `threaded_nhs_update=false`
# 12.587003 seconds (2.92 M allocations: 3.262 GiB, 0.71% gc time)
The differences in performance (see https://github.com/kaipartmann/Peridynamics.jl/pull/107#issuecomment-2182414620) seem to be related to combining Polyester.@batch
and Base.Threads
. PointNeighbors.jl
uses Polyester.@batch
within the @threaded
macro.
With threaded_nhs_update=true
and changing all Threads.@threads
calls in Peridynamics.jl
, the following differences occur:
# `@threads :static`
# 49.821336 seconds (2.93 M allocations: 3.263 GiB, 0.13% gc time)
# `@threads`
# 27.514394 seconds (2.92 M allocations: 3.262 GiB, 0.39% gc time)
# `Polyester.@batch`
# 11.450976 seconds (2.34 M allocations: 3.199 GiB, 0.49% gc time)
Add the short range forces contact algorithm as it was used in
v0.2
.