|
| 1 | +@testitem "EnergySurfaceCorrection BBMaterial" begin |
| 2 | + Δx = 0.1 |
| 3 | + pos, vol = uniform_box(1, 1, 1, Δx) |
| 4 | + horizon = 3.01 * Δx |
| 5 | + rho = 8000 |
| 6 | + E = 210e9 |
| 7 | + nu = 0.25 |
| 8 | + mat = BBMaterial{EnergySurfaceCorrection}() |
| 9 | + body = Body(mat, pos, vol) |
| 10 | + material!(body; horizon, rho, E, nu) |
| 11 | + ts = VelocityVerlet(steps=1) |
| 12 | + |
| 13 | + dh = Peridynamics.threads_data_handler(body, ts, 1) |
| 14 | + Peridynamics.initialize!(dh, ts) |
| 15 | + chunk = dh.chunks[1] |
| 16 | + (; system) = chunk |
| 17 | + (; correction) = system |
| 18 | + (; mfactor, scfactor) = correction |
| 19 | + |
| 20 | + @test minimum(mfactor[1, :]) ≈ 1.0 atol=0.08 |
| 21 | + @test maximum(mfactor[1, :]) ≈ 3.7 atol=1.0 |
| 22 | + @test minimum(mfactor[2, :]) ≈ 1.0 atol=0.08 |
| 23 | + @test maximum(mfactor[2, :]) ≈ 3.7 atol=1.0 |
| 24 | + @test minimum(mfactor[3, :]) ≈ 1.0 atol=0.08 |
| 25 | + @test maximum(mfactor[3, :]) ≈ 3.7 atol=1.0 |
| 26 | + @test minimum(scfactor) ≈ 1.0 atol=0.08 |
| 27 | + @test maximum(scfactor) ≈ 3.5 atol=1.0 |
| 28 | +end |
| 29 | + |
| 30 | +@testitem "EnergySurfaceCorrection OSBMaterial" begin |
| 31 | + Δx = 0.1 |
| 32 | + pos, vol = uniform_box(1, 1, 1, Δx) |
| 33 | + horizon = 3.01 * Δx |
| 34 | + rho = 8000 |
| 35 | + E = 210e9 |
| 36 | + nu = 0.25 |
| 37 | + mat = OSBMaterial{EnergySurfaceCorrection}() |
| 38 | + body = Body(mat, pos, vol) |
| 39 | + material!(body; horizon, rho, E, nu) |
| 40 | + ts = VelocityVerlet(steps=1) |
| 41 | + |
| 42 | + dh = Peridynamics.threads_data_handler(body, ts, 1) |
| 43 | + Peridynamics.initialize!(dh, ts) |
| 44 | + chunk = dh.chunks[1] |
| 45 | + (; system) = chunk |
| 46 | + (; correction) = system |
| 47 | + (; mfactor, scfactor) = correction |
| 48 | + |
| 49 | + @test minimum(mfactor[1, :]) ≈ 0.75 atol=0.2 |
| 50 | + @test maximum(mfactor[1, :]) ≈ 1.5 atol=0.3 |
| 51 | + @test minimum(mfactor[2, :]) ≈ 0.75 atol=0.2 |
| 52 | + @test maximum(mfactor[2, :]) ≈ 1.5 atol=0.3 |
| 53 | + @test minimum(mfactor[3, :]) ≈ 0.75 atol=0.2 |
| 54 | + @test maximum(mfactor[3, :]) ≈ 1.5 atol=0.3 |
| 55 | + @test minimum(scfactor) ≈ 0.75 atol=0.2 |
| 56 | + @test maximum(scfactor) ≈ 1.5 atol=0.3 |
| 57 | +end |
| 58 | + |
| 59 | +@testitem "EnergySurfaceCorrection DHBBMaterial" begin |
| 60 | + Δx = 0.1 |
| 61 | + pos, vol = uniform_box(1, 1, 1, Δx) |
| 62 | + horizon = 3.01 * Δx |
| 63 | + rho = 8000 |
| 64 | + E = 210e9 |
| 65 | + nu = 0.25 |
| 66 | + mat = DHBBMaterial{EnergySurfaceCorrection}() |
| 67 | + body = Body(mat, pos, vol) |
| 68 | + material!(body; horizon, rho, E, nu) |
| 69 | + ts = VelocityVerlet(steps=1) |
| 70 | + |
| 71 | + dh = Peridynamics.threads_data_handler(body, ts, 1) |
| 72 | + Peridynamics.initialize!(dh, ts) |
| 73 | + chunk = dh.chunks[1] |
| 74 | + (; system) = chunk |
| 75 | + (; correction) = system |
| 76 | + (; mfactor, scfactor) = correction |
| 77 | + |
| 78 | + @test minimum(mfactor[1, :]) ≈ 1.0 atol=0.08 |
| 79 | + @test maximum(mfactor[1, :]) ≈ 3.7 atol=1.0 |
| 80 | + @test minimum(mfactor[2, :]) ≈ 1.0 atol=0.08 |
| 81 | + @test maximum(mfactor[2, :]) ≈ 3.7 atol=1.0 |
| 82 | + @test minimum(mfactor[3, :]) ≈ 1.0 atol=0.08 |
| 83 | + @test maximum(mfactor[3, :]) ≈ 3.7 atol=1.0 |
| 84 | + @test minimum(scfactor) ≈ 1.0 atol=0.08 |
| 85 | + @test maximum(scfactor) ≈ 3.5 atol=1.0 |
| 86 | +end |
| 87 | + |
| 88 | +@testitem "Analytical strain energy density functions" begin |
| 89 | + test_cases = [ |
| 90 | + (210e9, 0.25, 1.01), |
| 91 | + (200e9, 0.30, 1.05), |
| 92 | + (150e9, 0.20, 1.10), |
| 93 | + (300e9, 0.35, 1.02), |
| 94 | + ] |
| 95 | + for (E, nu, λ) in test_cases |
| 96 | + λ_lame = E * nu / ((1 + nu) * (1 - 2 * nu)) |
| 97 | + μ_lame = E / (2 * (1 + nu)) |
| 98 | + lame = [λ_lame, μ_lame] |
| 99 | + Ψ_small = 1/2 * λ_lame * (λ - 1)^2 + μ_lame * (λ - 1)^2 |
| 100 | + Ψ_finite = 1/8 * λ_lame * (λ^2 - 1)^2 + 1/4 * μ_lame * (λ^2 - 1)^2 |
| 101 | + @test Peridynamics.stendens_uniext_small_strain(lame, λ) ≈ Ψ_small |
| 102 | + @test Peridynamics.stendens_uniext_finite_strain(lame, λ) ≈ Ψ_finite |
| 103 | + end |
| 104 | +end |
| 105 | + |
| 106 | +@testitem "Get averaged Lamé parameters" begin |
| 107 | + pos = [0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 |
| 108 | + 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 |
| 109 | + 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0] |
| 110 | + vol = [1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0] |
| 111 | + horizon = 1.01 |
| 112 | + rho = 8000 |
| 113 | + E = 105e9 |
| 114 | + nu = 0.25 |
| 115 | + mat = BBMaterial{EnergySurfaceCorrection}() |
| 116 | + body = Body(mat, pos, vol) |
| 117 | + point_set!(x -> x < 4.5, body, :left) |
| 118 | + point_set!(x -> x > 4.5, body, :right) |
| 119 | + material!(body, :left; horizon, rho, E, nu) |
| 120 | + material!(body, :right; horizon, rho, E=2E, nu) |
| 121 | + ts = VelocityVerlet(steps=1) |
| 122 | + |
| 123 | + dh = Peridynamics.threads_data_handler(body, ts, 1) |
| 124 | + Peridynamics.initialize!(dh, ts) |
| 125 | + chunk = dh.chunks[1] |
| 126 | + (; system, storage, paramsetup) = chunk |
| 127 | + |
| 128 | + params1 = Peridynamics.get_params(paramsetup, 1) |
| 129 | + params4 = Peridynamics.get_params(paramsetup, 4) |
| 130 | + params5 = Peridynamics.get_params(paramsetup, 5) |
| 131 | + params6 = Peridynamics.get_params(paramsetup, 6) |
| 132 | + params7 = Peridynamics.get_params(paramsetup, 7) |
| 133 | + params10 = Peridynamics.get_params(paramsetup, 10) |
| 134 | + |
| 135 | + # point #1 |
| 136 | + lame = Peridynamics.get_averaged_lame_parameters(system, storage, paramsetup, 1) |
| 137 | + @test lame[1] ≈ params1.λ |
| 138 | + @test lame[2] ≈ params1.μ |
| 139 | + |
| 140 | + # point #4 |
| 141 | + lame = Peridynamics.get_averaged_lame_parameters(system, storage, paramsetup, 4) |
| 142 | + @test lame[1] ≈ params4.λ |
| 143 | + @test lame[2] ≈ params4.μ |
| 144 | + |
| 145 | + # point #5 |
| 146 | + lame = Peridynamics.get_averaged_lame_parameters(system, storage, paramsetup, 5) |
| 147 | + @test lame[1] ≈ (params4.λ + 2 * params5.λ + params6.λ) / 4 |
| 148 | + @test lame[2] ≈ (params4.μ + 2 * params5.μ + params6.μ) / 4 |
| 149 | + |
| 150 | + # point #6 |
| 151 | + lame = Peridynamics.get_averaged_lame_parameters(system, storage, paramsetup, 6) |
| 152 | + @test lame[1] ≈ (params5.λ + 2 * params6.λ + params7.λ) / 4 |
| 153 | + @test lame[2] ≈ (params5.μ + 2 * params6.μ + params7.μ) / 4 |
| 154 | + |
| 155 | + # point #7 |
| 156 | + lame = Peridynamics.get_averaged_lame_parameters(system, storage, paramsetup, 7) |
| 157 | + @test lame[1] ≈ params7.λ |
| 158 | + @test lame[2] ≈ params7.μ |
| 159 | + |
| 160 | + # point #10 |
| 161 | + lame = Peridynamics.get_averaged_lame_parameters(system, storage, paramsetup, 10) |
| 162 | + @test lame[1] ≈ params10.λ |
| 163 | + @test lame[2] ≈ params10.μ |
| 164 | +end |
0 commit comments