kaipartmann / Peridynamics.jl

A Julia package for parallel peridynamics simulations
https://kaipartmann.github.io/Peridynamics.jl/
MIT License
44 stars 8 forks source link

Inconsistent Results in Dynamic Relaxation Module with Varying n_chunks" #187

Open ShiWeiHuH opened 2 days ago

ShiWeiHuH commented 2 days ago

Julia Version 1.10.3 (2024-04-30) Peridynamics Version v0.3.3

While testing the Dynamic Relaxation module, I noticed that using different n_chunks produces inconsistent results, whereas the Velocity Verlet module runs correctly. This suggests there might be data contention during parallel processing. I suspect the issue lies in the calculation of the density_matrix, which requires not only local node data but also neighboring node data. However, even when I calculate it without using multithreading, the results still vary with n_chunks. I now believe the problem might be related to the indexing in the relaxation_step calculation, and I’m currently working on modifying that.

ShiWeiHuH commented 2 days ago

Here is my code:


using Peridynamics
l = 1.0
w = 0.1
Δx = l/100
b = 1
dt = 1.0
nt = 4000
f = 2.0e10

pos, vol = uniform_box(l+3Δx, w, w, Δx; center_x=-1.5Δx, center_y=0, center_z=0)
body = Body(BBMaterial{}(), pos, vol) #EnergySurfaceCorrection
material!(body; horizon=3.015Δx, E=2.0e11, rho=7.85e3, epsilon_c=b)

point_set!(p -> (p[1] >= l/2 - Δx), body, :force_area)
point_set!(p -> (p[1] <= -l/2), body, :fixed_area)

forcedensity_bc!(t -> f, body, :force_area, :y)
velocity_bc!(t -> 0.0, body, :fixed_area, :x)
velocity_bc!(t -> 0.0, body, :fixed_area, :y)
velocity_bc!(t -> 0.0, body, :fixed_area, :z)

vv = DynamicRelaxation(steps=nt)
job = Job(body, vv; freq=10, path="results/static_ori_no_4")
A = submit(job)