Skip to content

Commit 717c6ed

Browse files
authored
Merge branch 'main' into dev-documentaion
2 parents e903e1b + 7c3a080 commit 717c6ed

File tree

10 files changed

+181
-13
lines changed

10 files changed

+181
-13
lines changed

.github/workflows/CI.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ jobs:
5757
version: '1'
5858
- uses: julia-actions/cache@v2
5959
- uses: julia-actions/julia-buildpkg@v1
60+
- run: |
61+
julia --project=docs -e '
62+
using Pkg;
63+
Pkg.develop(PackageSpec(path=pwd()));
64+
Pkg.instantiate()'
6065
- uses: julia-actions/julia-docdeploy@v1
6166
env:
6267
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "Peridynamics"
22
uuid = "4dc47793-80f3-4232-b30e-ca78ca9d621b"
33
authors = ["Kai Partmann"]
4-
version = "0.4.1-DEV"
4+
version = "0.4.2-DEV"
55

66
[deps]
77
AbaqusReader = "bc6b9049-e460-56d6-94b4-a597b2c0390d"
@@ -30,7 +30,7 @@ LibGit2 = "1.8"
3030
LightXML = "0.9"
3131
LinearAlgebra = "1.8"
3232
MPI = "0.20.0"
33-
PointNeighbors = "0.4.5, 0.5"
33+
PointNeighbors = "0.5, 0.6"
3434
PrecompileTools = "1.0"
3535
Printf = "1.8"
3636
ProgressMeter = "1.0"

docs/servedocs.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
const REPO_ROOT = dirname(@__DIR__)
77

88
# Make sure the docs environment is active and instantiated
9-
import Pkg
9+
using Pkg
1010
Pkg.activate(@__DIR__)
11+
Pkg.develop(PackageSpec(path=REPO_ROOT))
1112
Pkg.instantiate()
1213

1314
# Communicate with make.jl that docs are build in live mode

test/auxiliary/test_mpi.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ end
3535
job = Job(body, ts; path, freq=10)
3636
submit(job)
3737
"""
38-
cmd = `$(Peridynamics.MPI.mpiexec()) -n 2 $(Base.julia_cmd()) --project -e $(mpi_cmd)`
38+
mpiexec = Peridynamics.MPI.mpiexec()
39+
jlcmd = Base.julia_cmd()
40+
pdir = pkgdir(Peridynamics)
41+
cmd = `$(mpiexec) -n 2 $(jlcmd) --project=$(pdir) -e $(mpi_cmd)`
3942
@test success(cmd) # does not print anything
4043
# for debugging use the run command:
4144
# run(cmd)

test/auxiliary/test_process_each_export.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,10 @@
7272
return nothing
7373
end
7474
"""
75-
run(`$(Peridynamics.MPI.mpiexec()) -n 3 $(Base.julia_cmd()) --project -e $(mpi_cmd)`)
75+
mpiexec = Peridynamics.MPI.mpiexec()
76+
jlcmd = Base.julia_cmd()
77+
pdir = pkgdir(Peridynamics)
78+
run(`$(mpiexec) -n 2 $(jlcmd) --project=$(pdir) -e $(mpi_cmd)`)
7679
file_1_mpi = joinpath(root_post_mpi, "max_displacement_1.txt")
7780
@test isfile(file_1_mpi)
7881
@test contains(read(file_1_mpi, String), "maximum displacement x: 0.0")

test/core/test_halo_exchange.jl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,10 @@ end
316316
@test dh.chunk.storage.b_int[:,3:4] ≈ randbint[:,1:2]
317317
end
318318
"""
319-
cmd = `$(Peridynamics.MPI.mpiexec()) -n 2 $(Base.julia_cmd()) --project -e $(mpi_cmd)`
319+
mpiexec = Peridynamics.MPI.mpiexec()
320+
jlcmd = Base.julia_cmd()
321+
pdir = pkgdir(Peridynamics)
322+
cmd = `$(mpiexec) -n 2 $(jlcmd) --project=$(pdir) -e $(mpi_cmd)`
320323
@test success(cmd) # does not print anything
321324
# for debugging use the run command:
322325
# run(cmd)
@@ -363,7 +366,10 @@ end
363366
@test dh.chunk.storage.position[:,1:2] ≈ position[:,1:2] + randpos[:,3:4]
364367
end
365368
"""
366-
cmd = `$(Peridynamics.MPI.mpiexec()) -n 2 $(Base.julia_cmd()) --project -e $(mpi_cmd)`
369+
mpiexec = Peridynamics.MPI.mpiexec()
370+
jlcmd = Base.julia_cmd()
371+
pdir = pkgdir(Peridynamics)
372+
cmd = `$(mpiexec) -n 2 $(jlcmd) --project=$(pdir) -e $(mpi_cmd)`
367373
@test success(cmd) # does not print anything
368374
# for debugging use the run command:
369375
# run(cmd)

test/discretization/test_bond_associated_system.jl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,20 @@ end
7070
# end
7171

7272
end
73+
74+
@testitem "bond horizon" begin
75+
# setup
76+
pos, vol = uniform_box(1, 0.25, 0.25, 0.25)
77+
body = Body(BACMaterial(), pos, vol)
78+
@test_throws ArgumentError material!(body, horizon=0.5, bond_horizon=-1, rho=1, E=1,
79+
nu=0.25, Gc=1)
80+
@test_logs (:warn,) material!(body, horizon=0.5, bond_horizon=0.1, rho=1, E=1, nu=0.25,
81+
Gc=1)
82+
end
83+
84+
@testitem "bond-associated compatibility" begin
85+
# setup
86+
pos, vol = uniform_box(1, 0.25, 0.25, 0.25)
87+
body = Body(BBMaterial(), pos, vol)
88+
@test_throws ArgumentError Peridynamics.check_bond_associated_system_compat(body.mat)
89+
end

test/discretization/test_interaction_system.jl

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99

1010
system = Peridynamics.InteractionSystem(body, pd, 1)
1111

12+
@test Peridynamics.has_three_nis(body.point_params[1]) == false
13+
@test Peridynamics.has_three_nis(body,1) == false
14+
15+
@test Peridynamics.has_two_nis(body,1) == true
16+
1217
@test system.one_nis == [
1318
Peridynamics.Bond(2, 1.0, true),
1419
Peridynamics.Bond(3, 1.0, true),
@@ -27,6 +32,66 @@
2732
@test system.three_nis == Vector{Peridynamics.ThreeNeighborInteraction}()
2833
@test system.n_three_nis == Vector{Int}()
2934
@test system.three_ni_idxs == Vector{UnitRange{Int}}()
35+
36+
point_set!(body, :a, 1:2)
37+
material!(body, :a; horizon=1.5, rho=7e-6, E=200e3, nu=0.3, Gc=1.0, C1=1, C2=1)
38+
39+
ts = VelocityVerlet(steps=1)
40+
dh = Peridynamics.threads_data_handler(body, ts, 1)
41+
chunk = dh.chunks[1]
42+
@test Peridynamics.has_three_nis(chunk.paramsetup) == false
43+
end
44+
45+
@testitem "one- and three-neighbor interactions" begin
46+
position = [0.0 1.0 0.0 0.0
47+
0.0 0.0 0.0 1.0
48+
0.0 0.0 1.0 0.0]
49+
volume = fill(1.0, 4)
50+
body = Body(CKIMaterial(), position, volume)
51+
material!(body; horizon=1.5, rho=8e-6, E=210e3, nu=0.3, Gc=1.0, C1=1, C3=1)
52+
pd = Peridynamics.PointDecomposition(body, 1)
53+
54+
system = Peridynamics.InteractionSystem(body, pd, 1)
55+
56+
@test Peridynamics.has_two_nis(body.point_params[1]) == false
57+
@test Peridynamics.has_two_nis(body) == false
58+
@test Peridynamics.has_two_nis(body,1) == false
59+
60+
@test Peridynamics.has_three_nis(body,1) == true
61+
62+
@test system.one_nis == [
63+
Peridynamics.Bond(2, 1.0, true),
64+
Peridynamics.Bond(3, 1.0, true),
65+
Peridynamics.Bond(4, 1.0, true),
66+
Peridynamics.Bond(1, 1.0, true),
67+
Peridynamics.Bond(3, 2, true),
68+
Peridynamics.Bond(4, 2, true),
69+
Peridynamics.Bond(1, 1.0, true),
70+
Peridynamics.Bond(2, 2, true),
71+
Peridynamics.Bond(4, 2, true),
72+
Peridynamics.Bond(1, 1.0, true),
73+
Peridynamics.Bond(2, 2, true),
74+
Peridynamics.Bond(3, 2, true)]
75+
@test system.n_one_nis == [3, 3, 3, 3]
76+
@test system.one_ni_idxs == [1:3, 4:6, 7:9, 10:12]
77+
@test system.two_nis == Vector{Peridynamics.TwoNeighborInteraction}()
78+
@test system.n_two_nis == Vector{Int}()
79+
@test system.two_ni_idxs == Vector{UnitRange{Int}}()
80+
@test system.three_nis == [
81+
Peridynamics.ThreeNeighborInteraction(1, 2, 3, 1.0),
82+
Peridynamics.ThreeNeighborInteraction(4, 5, 6, 1.0),
83+
Peridynamics.ThreeNeighborInteraction(7, 8, 9, 1.0),
84+
Peridynamics.ThreeNeighborInteraction(10, 11, 12, 1.0)]
85+
@test system.n_three_nis == [1, 1, 1, 1]
86+
@test system.three_ni_idxs == [1:1, 2:2, 3:3, 4:4]
87+
88+
point_set!(body, :a, 1:2)
89+
material!(body, :a; horizon=1.5, rho=7e-6, E=200e3, nu=0.3, Gc=1.0, C1=1, C3=1)
90+
91+
ts = VelocityVerlet(steps=1)
92+
dh = Peridynamics.threads_data_handler(body, ts, 1)
93+
chunk = dh.chunks[1]
94+
@test Peridynamics.has_two_nis(chunk.paramsetup) == false
3095
end
3196

3297
@testitem "one-, two-, and three-neighbor interactions" begin
@@ -131,3 +196,10 @@ end
131196
@test is.volume_two_nis [fill(1.33333333333333, 4); 0.0]
132197
@test is.volume_three_nis [fill(4.0, 4); 0.0]
133198
end
199+
200+
@testitem "interaction system compatibility" begin
201+
# setup
202+
pos, vol = uniform_box(1, 0.25, 0.25, 0.25)
203+
body = Body(BBMaterial(), pos, vol)
204+
@test_throws ArgumentError Peridynamics.check_interaction_system_compat(body.mat)
205+
end

test/integration/mpi_threads_comparison.jl

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@
4747
end
4848
sim_bb(30, "$path_mpi")
4949
"""
50-
run(`$(Peridynamics.MPI.mpiexec()) -n 2 $(Base.julia_cmd()) --project -e $(mpi_cmd)`)
50+
mpiexec = Peridynamics.MPI.mpiexec()
51+
jlcmd = Base.julia_cmd()
52+
pdir = pkgdir(Peridynamics)
53+
run(`$(mpiexec) -n 2 $(jlcmd) --project=$(pdir) -e $(mpi_cmd)`)
5154

5255
@test isdir(path_threads_vtk)
5356
@test isdir(path_mpi_vtk)
@@ -112,7 +115,10 @@ end
112115
end
113116
sim_bb(30, "$path_mpi")
114117
"""
115-
run(`$(Peridynamics.MPI.mpiexec()) -n 2 $(Base.julia_cmd()) --project -e $(mpi_cmd)`)
118+
mpiexec = Peridynamics.MPI.mpiexec()
119+
jlcmd = Base.julia_cmd()
120+
pdir = pkgdir(Peridynamics)
121+
run(`$(mpiexec) -n 2 $(jlcmd) --project=$(pdir) -e $(mpi_cmd)`)
116122

117123
@test isdir(path_threads_vtk)
118124
@test isdir(path_mpi_vtk)
@@ -182,7 +188,10 @@ end
182188
end
183189
sim_bb(30, "$path_mpi")
184190
"""
185-
run(`$(Peridynamics.MPI.mpiexec()) -n 2 $(Base.julia_cmd()) --project -e $(mpi_cmd)`)
191+
mpiexec = Peridynamics.MPI.mpiexec()
192+
jlcmd = Base.julia_cmd()
193+
pdir = pkgdir(Peridynamics)
194+
run(`$(mpiexec) -n 2 $(jlcmd) --project=$(pdir) -e $(mpi_cmd)`)
186195

187196
@test isdir(path_threads_vtk)
188197
@test isdir(path_mpi_vtk)
@@ -247,7 +256,10 @@ end
247256
end
248257
sim_osb(30, "$path_mpi")
249258
"""
250-
run(`$(Peridynamics.MPI.mpiexec()) -n 2 $(Base.julia_cmd()) --project -e $(mpi_cmd)`)
259+
mpiexec = Peridynamics.MPI.mpiexec()
260+
jlcmd = Base.julia_cmd()
261+
pdir = pkgdir(Peridynamics)
262+
run(`$(mpiexec) -n 2 $(jlcmd) --project=$(pdir) -e $(mpi_cmd)`)
251263

252264
@test isdir(path_threads_vtk)
253265
@test isdir(path_mpi_vtk)
@@ -312,7 +324,10 @@ end
312324
end
313325
sim_cc(30, "$path_mpi")
314326
"""
315-
run(`$(Peridynamics.MPI.mpiexec()) -n 2 $(Base.julia_cmd()) --project -e $(mpi_cmd)`)
327+
mpiexec = Peridynamics.MPI.mpiexec()
328+
jlcmd = Base.julia_cmd()
329+
pdir = pkgdir(Peridynamics)
330+
run(`$(mpiexec) -n 2 $(jlcmd) --project=$(pdir) -e $(mpi_cmd)`)
316331

317332
@test isdir(path_threads_vtk)
318333
@test isdir(path_mpi_vtk)
@@ -378,7 +393,10 @@ end
378393
end
379394
sim_bac(30, "$path_mpi")
380395
"""
381-
run(`$(Peridynamics.MPI.mpiexec()) -n 2 $(Base.julia_cmd()) --project -e $(mpi_cmd)`)
396+
mpiexec = Peridynamics.MPI.mpiexec()
397+
jlcmd = Base.julia_cmd()
398+
pdir = pkgdir(Peridynamics)
399+
run(`$(mpiexec) -n 2 $(jlcmd) --project=$(pdir) -e $(mpi_cmd)`)
382400

383401
@test isdir(path_threads_vtk)
384402
@test isdir(path_mpi_vtk)

test/time_solvers/test_dynamic_relaxation.jl

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,46 @@
1+
@testitem "DynamicRelaxation wrong input" begin
2+
@test_throws ArgumentError DynamicRelaxation(steps=0)
3+
@test_throws ArgumentError DynamicRelaxation(steps=10, stepsize=0)
4+
@test_throws ArgumentError DynamicRelaxation(steps=10, damping_factor=0)
5+
end
6+
7+
@testitem "dynamic_relaxation_check" begin
8+
dr = DynamicRelaxation(steps=1)
9+
dr.n_steps = -1
10+
msg = "`n_steps` of DynamicRelaxation smaller than zero!\n"
11+
@test_throws ErrorException(msg) Peridynamics.dynamic_relaxation_check(dr)
12+
13+
dr = DynamicRelaxation(steps=1)
14+
dr.Δt = -1
15+
msg = "`Δt` of DynamicRelaxation smaller than zero!\n"
16+
@test_throws ErrorException(msg) Peridynamics.dynamic_relaxation_check(dr)
17+
18+
dr = DynamicRelaxation(steps=1)
19+
dr.Λ = -1
20+
msg = "`Λ` of DynamicRelaxation smaller than zero!\n"
21+
@test_throws ErrorException(msg) Peridynamics.dynamic_relaxation_check(dr)
22+
end
23+
24+
@testitem "_init_density_matrix" begin
25+
using Peridynamics
26+
position = [0.0 1.0 0.0 0.0
27+
0.0 0.0 0.0 1.0
28+
0.0 0.0 1.0 0.0]
29+
volume = fill(1.0, 4)
30+
body = Body(BBMaterial(), position, volume)
31+
material!(body; horizon=1.5, rho=8e-6, E=210e3)
32+
point_set!(body, :a, 1:2)
33+
material!(body, :a; horizon=1.5, rho=7.8e-6, E=200e3)
34+
35+
dr = DynamicRelaxation(steps=1)
36+
dh = Peridynamics.threads_data_handler(body, dr, 1)
37+
chunk = dh.chunks[1]
38+
Peridynamics._init_density_matrix!(chunk,dr,chunk.paramsetup)
39+
40+
@test chunk.storage.density_matrix [4.0e6 4.0e6 4.2e6 4.2e6
41+
4.0e6 4.0e6 4.2e6 4.2e6
42+
4.0e6 4.0e6 4.2e6 4.2e6]
43+
end
144

245
@testitem "show DynamicRelaxation" begin
346
io = IOBuffer()

0 commit comments

Comments
 (0)