|
9 | 9 |
|
10 | 10 | system = Peridynamics.InteractionSystem(body, pd, 1) |
11 | 11 |
|
| 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 | + |
12 | 17 | @test system.one_nis == [ |
13 | 18 | Peridynamics.Bond(2, 1.0, true), |
14 | 19 | Peridynamics.Bond(3, 1.0, true), |
|
27 | 32 | @test system.three_nis == Vector{Peridynamics.ThreeNeighborInteraction}() |
28 | 33 | @test system.n_three_nis == Vector{Int}() |
29 | 34 | @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) # nur als dummy |
| 40 | + dh = Peridynamics.threads_data_handler(body, ts, 1) # ein thread |
| 41 | + chunk = dh.chunks[1] # das erste und einzige chunk |
| 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) # nur als dummy |
| 92 | + dh = Peridynamics.threads_data_handler(body, ts, 1) # ein thread |
| 93 | + chunk = dh.chunks[1] # das erste und einzige chunk |
| 94 | + @test Peridynamics.has_two_nis(chunk.paramsetup) == false |
30 | 95 | end |
31 | 96 |
|
32 | 97 | @testitem "one-, two-, and three-neighbor interactions" begin |
|
131 | 196 | @test is.volume_two_nis ≈ [fill(1.33333333333333, 4); 0.0] |
132 | 197 | @test is.volume_three_nis ≈ [fill(4.0, 4); 0.0] |
133 | 198 | 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 |
0 commit comments