Skip to content

Commit cb0eac1

Browse files
authored
Merge branch 'main' into mpi_test_fixes
2 parents 6e1d132 + ae97d00 commit cb0eac1

17 files changed

+625
-41
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
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.0"
4+
version = "0.4.1"
55

66
[deps]
77
AbaqusReader = "bc6b9049-e460-56d6-94b4-a597b2c0390d"

docs/src/public_api_reference.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Pages = ["public_api_reference.md"]
1111
## Material models
1212
```@docs
1313
BBMaterial
14+
DHBBMaterial
1415
OSBMaterial
1516
CMaterial
1617
CRMaterial
@@ -24,6 +25,7 @@ CriticalStretch
2425
NoCorrection
2526
EnergySurfaceCorrection
2627
ZEMSilling
28+
ZEMWan
2729
LinearElastic
2830
NeoHooke
2931
MooneyRivlin

src/Peridynamics.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ end
99
import LibGit2, Dates
1010

1111
# Material models
12-
export BBMaterial, OSBMaterial, CMaterial, CRMaterial, BACMaterial, CKIMaterial
12+
export BBMaterial, DHBBMaterial, OSBMaterial, CMaterial, CRMaterial, BACMaterial,
13+
CKIMaterial
1314

1415
# CMaterial related types
15-
export LinearElastic, NeoHooke, MooneyRivlin, SaintVenantKirchhoff, ZEMSilling
16+
export LinearElastic, NeoHooke, MooneyRivlin, SaintVenantKirchhoff, ZEMSilling, ZEMWan
1617

1718
# Kernels
1819
export linear_kernel, cubic_b_spline_kernel
@@ -75,6 +76,7 @@ abstract type AbstractCorrection end
7576
abstract type AbstractStorage end
7677
abstract type AbstractCondition end
7778
abstract type AbstractBondSystemMaterial{Correction} <: AbstractMaterial end
79+
abstract type AbstractBondBasedMaterial{CM} <: AbstractBondSystemMaterial{CM} end
7880
abstract type AbstractCorrespondenceMaterial{CM,ZEM} <: AbstractBondSystemMaterial{ZEM} end
7981
abstract type AbstractBondAssociatedSystemMaterial <: AbstractMaterial end
8082
abstract type AbstractConstitutiveModel end
@@ -132,6 +134,7 @@ include("time_solvers/velocity_verlet.jl")
132134
include("time_solvers/dynamic_relaxation.jl")
133135

134136
include("physics/bond_based.jl")
137+
include("physics/dh_bond_based.jl")
135138
include("physics/continuum_kinematics_inspired.jl")
136139
include("physics/ordinary_state_based.jl")
137140
include("physics/constitutive_models.jl")

src/core/storages.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Example definition of the storage for the bond-based material:
5757
bond_active::Vector{Bool}
5858
@pointfield n_active_bonds::Vector{Int}
5959
end
60-
60+
````
6161
"""
6262
macro storage end
6363

src/discretization/body.jl

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,15 @@ Construct a `Body` for a peridynamics simulation.
77
# Arguments
88
- `material::AbstractMaterial`: The material which is defined for the whole body.
99
Available material models:
10-
- [`BBMaterial`](@ref): Bond-based peridynamics
11-
- [`OSBMaterial`](@ref): Ordinary state-based peridynamics
12-
- [`CMaterial`](@ref): Correspondence formulation
13-
- [`BACMaterial`](@ref): Bond-associated correspondence formulation of Chen and Spencer
14-
- [`CKIMaterial`](@ref): Continuum-kinematics-inspired peridynamics
10+
- [`BBMaterial`](@ref): Bond-based peridynamics.
11+
- [`DHBBMaterial`](@ref): Dual-horizon bond-based peridynamics.
12+
- [`OSBMaterial`](@ref): Ordinary state-based peridynamics, also called linear
13+
peridynamic solid (LPS).
14+
- [`CMaterial`](@ref): Correspondence formulation.
15+
- [`CRMaterial`](@ref): Correspondence formulation stress rotation for objectivity
16+
enforcement.
17+
- [`BACMaterial`](@ref): Bond-associated correspondence formulation of Chen and Spencer.
18+
- [`CKIMaterial`](@ref): Continuum-kinematics-inspired peridynamics.
1519
- `position::AbstractMatrix`: A `3×n` matrix with the point position of the `n` points.
1620
- `volume::AbstractVector`: A vector with the volume of each point.
1721
- `inp_file::AbstractString`: An Abaqus input file containing meshes, imported with

src/discretization/zem_stabilization.jl

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
function get_correction(mat::AbstractBondSystemMaterial{<:AbstractZEMStabilization},
22
::Int, ::Int, ::Int)
3-
return mat.zem_stabilization
3+
return mat.zem
44
end
55

66
"""
@@ -19,3 +19,35 @@ struct ZEMSilling <: AbstractZEMStabilization
1919
return new(Cs)
2020
end
2121
end
22+
23+
"""
24+
ZEMWan()
25+
26+
Zero-energy mode stabilization algorithm of Wan et al. (2019), which is an improvement to
27+
Silling's algorithm that does not require a stabilization parameter.
28+
See also [`CMaterial`](@ref) on how to use this stabilization algorithm.
29+
"""
30+
struct ZEMWan <: AbstractZEMStabilization end
31+
32+
function calc_zem_stiffness_tensor(C, Kinv)
33+
C_1 = zero(SMatrix{3,3,Float64,9})
34+
for i in 1:3, j in 1:3
35+
sum_value = 0.0
36+
for k in 1:3, l in 1:3
37+
@inbounds sum_value += C[i, j, k, l] * Kinv[k, l]
38+
end
39+
C_1 = setindex(C_1, sum_value, i, j)
40+
end
41+
return C_1
42+
end
43+
44+
function calc_rotated_zem_stiffness_tensor!(C_rotated, C, Kinv, R)
45+
for m in 1:3, n in 1:3, o in 1:3, p in 1:3
46+
sum_value = 0.0
47+
for i in 1:3, j in 1:3, k in 1:3, l in 1:3
48+
@inbounds sum_value += C[i, j, k, l] * R[i, m] * R[j, n] * R[k, o] * R[l, p]
49+
end
50+
@inbounds C_rotated[m, n, o, p] = sum_value
51+
end
52+
return calc_zem_stiffness_tensor(C_rotated, Kinv)
53+
end

src/physics/bond_based.jl

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ When specifying the `fields` keyword of [`Job`](@ref) for a [`Body`](@ref) with
7070
- `damage::Vector{Float64}`: Damage of each point.
7171
- `n_active_bonds::Vector{Int}`: Number of intact bonds of each point.
7272
"""
73-
struct BBMaterial{Correction,DM} <: AbstractBondSystemMaterial{Correction}
73+
struct BBMaterial{Correction,DM} <: AbstractBondBasedMaterial{Correction}
7474
dmgmodel::DM
7575
function BBMaterial{C}(dmgmodel::DM) where {C,DM}
7676
new{C,DM}(dmgmodel)
@@ -83,6 +83,14 @@ end
8383
BBMaterial(; kwargs...) = BBMaterial{NoCorrection}(; kwargs...)
8484

8585
function StandardPointParameters(mat::BBMaterial, p::Dict{Symbol,Any})
86+
(; δ, rho, E, nu, G, K, λ, μ) = get_required_point_parameters_bb(mat, p)
87+
(; Gc, εc) = get_frac_params(mat.dmgmodel, p, δ, K)
88+
bc = 18 * K /* δ^4) # bond constant
89+
return StandardPointParameters(δ, rho, E, nu, G, K, λ, μ, Gc, εc, bc)
90+
end
91+
92+
function get_required_point_parameters_bb(mat::AbstractBondBasedMaterial,
93+
p::Dict{Symbol,Any})
8694
par = get_given_elastic_params(p)
8795
(; E, nu, G, K, λ, μ) = par
8896
if isfinite(nu) && !isapprox(nu, 0.25)
@@ -100,9 +108,7 @@ function StandardPointParameters(mat::BBMaterial, p::Dict{Symbol,Any})
100108
msg *= "Please define either only one or two fitting elastic parameters!\n"
101109
throw(ArgumentError(msg))
102110
end
103-
(; Gc, εc) = get_frac_params(mat.dmgmodel, p, δ, K)
104-
bc = 18 * K /* δ^4) # bond constant
105-
return StandardPointParameters(δ, rho, E, nu, G, K, λ, μ, Gc, εc, bc)
111+
return (; δ, rho, E, nu, G, K, λ, μ)
106112
end
107113

108114
@params BBMaterial StandardPointParameters
@@ -130,8 +136,8 @@ function init_field(::BBMaterial, ::AbstractTimeSolver, system::BondSystem,
130136
end
131137

132138
# Customized calc_failure to save the bond stretch ε for force density calculation
133-
function calc_failure!(storage::BBStorage, system::BondSystem,
134-
::BBMaterial, ::CriticalStretch,
139+
function calc_failure!(storage::AbstractStorage, system::BondSystem,
140+
::AbstractBondBasedMaterial, ::CriticalStretch,
135141
paramsetup::AbstractParameterSetup, i)
136142
(; εc) = get_params(paramsetup, i)
137143
(; position, n_active_bonds, bond_active, bond_stretch) = storage

src/physics/constitutive_models.jl

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,43 @@ function first_piola_kirchhoff(::LinearElastic, storage::AbstractStorage,
2020
params::AbstractPointParameters, F::SMatrix{3,3,T,9}) where T
2121
E = 0.5 .* (F' * F - I)
2222
Evoigt = SVector{6,Float64}(E[1,1], E[2,2], E[3,3], 2 * E[2,3], 2 * E[3,1], 2 * E[1,2])
23-
Cvoigt = get_hooke_matrix(params.nu, params.λ, params.μ)
23+
Cvoigt = get_hooke_matrix_voigt(params.nu, params.λ, params.μ)
2424
Pvoigt = Cvoigt * Evoigt
2525
P = SMatrix{3,3,Float64,9}(Pvoigt[1], Pvoigt[6], Pvoigt[5],
2626
Pvoigt[6], Pvoigt[2], Pvoigt[4],
2727
Pvoigt[5], Pvoigt[4], Pvoigt[3])
2828
return P
2929
end
3030

31-
function get_hooke_matrix(nu, λ, μ)
31+
function get_hooke_matrix_voigt(nu, λ, μ)
3232
a = (1 - nu) * λ / nu
33-
CVoigt = SMatrix{6,6,Float64,36}(a, λ, λ, 0, 0, 0, λ, a, λ, 0, 0, 0, λ, λ, a, 0, 0, 0,
34-
0, 0, 0, μ, 0, 0, 0, 0, 0, 0, μ, 0, 0, 0, 0, 0, 0, μ)
35-
return CVoigt
33+
Cvoigt = SMatrix{6,6,Float64,36}(
34+
a, λ, λ, 0, 0, 0,
35+
λ, a, λ, 0, 0, 0,
36+
λ, λ, a, 0, 0, 0,
37+
0, 0, 0, μ, 0, 0,
38+
0, 0, 0, 0, μ, 0,
39+
0, 0, 0, 0, 0, μ
40+
)
41+
return Cvoigt
3642
end
3743

44+
function get_hooke_matrix(nu, λ, μ)
45+
Cvoigt = get_hooke_matrix_voigt(nu, λ, μ)
46+
C = zero(MArray{NTuple{4,3},Float64,4,81})
47+
voigt_map = @SVector [(1,1), (2,2), (3,3), (2,3), (1,3), (1,2)]
48+
for I in 1:6, J in 1:6
49+
i1, i2 = voigt_map[I]
50+
j1, j2 = voigt_map[J]
51+
C[i1, i2, j1, j2] = Cvoigt[I, J]
52+
C[i2, i1, j1, j2] = Cvoigt[I, J]
53+
C[i1, i2, j2, j1] = Cvoigt[I, J]
54+
C[i2, i1, j2, j1] = Cvoigt[I, J]
55+
end
56+
return C
57+
end
58+
59+
3860
@doc raw"""
3961
NeoHooke
4062

src/physics/correspondence.jl

Lines changed: 69 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@ consistent (correspondence) formulation of non-ordinary state-based peridynamics
1717
- [`NeoHooke`](@ref)
1818
- [`MooneyRivlin`](@ref)
1919
- [`SaintVenantKirchhoff`](@ref)
20-
- `zem::AbstractZEMStabilization`: Zero-energy mode stabilization. The
21-
stabilization algorithm of Silling (2017) is used as default. \\
22-
(default: [`ZEMSilling`](@ref))
20+
- `zem::AbstractZEMStabilization`: Algorithm of zero-energy mode stabilization. \\
21+
(default: [`ZEMSilling`](@ref)) \\
22+
The following algorithms can be used:
23+
- [`ZEMSilling`](@ref)
24+
- [`ZEMWan`](@ref)
2325
- `dmgmodel::AbstractDamageModel`: Damage model defining the damage behavior. \\
2426
(default: [`CriticalStretch`](@ref))
2527
- `maxdmg::Float64`: Maximum value of damage a point is allowed to obtain. If this value is
@@ -106,7 +108,7 @@ When specifying the `fields` keyword of [`Job`](@ref) for a [`Body`](@ref) with
106108
struct CMaterial{CM,ZEM,K,DM} <: AbstractCorrespondenceMaterial{CM,ZEM}
107109
kernel::K
108110
constitutive_model::CM
109-
zem_stabilization::ZEM
111+
zem::ZEM
110112
dmgmodel::DM
111113
maxdmg::Float64
112114
function CMaterial(kernel::K, cm::CM, zem::ZEM, dmgmodel::DM,
@@ -132,15 +134,38 @@ function log_material_property(::Val{:constitutive_model}, mat; indentation)
132134
return msg_qty("constitutive model", mat.constitutive_model; indentation)
133135
end
134136

135-
function log_material_property(::Val{:zem_stabilization}, mat; indentation)
136-
return msg_qty("zero-energy mode stabilization", mat.zem_stabilization; indentation)
137+
function log_material_property(::Val{:zem}, mat; indentation)
138+
return msg_qty("zero-energy mode stabilization", mat.zem; indentation)
137139
end
138140

139141
function log_material_property(::Val{:maxdmg}, mat; indentation)
140142
return msg_qty("maximum damage", mat.maxdmg; indentation)
141143
end
142144

143-
@params CMaterial StandardPointParameters
145+
struct CPointParameters <: AbstractPointParameters
146+
δ::Float64
147+
rho::Float64
148+
E::Float64
149+
nu::Float64
150+
G::Float64
151+
K::Float64
152+
λ::Float64
153+
μ::Float64
154+
Gc::Float64
155+
εc::Float64
156+
bc::Float64
157+
C::MArray{NTuple{4,3},Float64,4,81}
158+
end
159+
160+
function CPointParameters(mat::AbstractMaterial, p::Dict{Symbol,Any})
161+
(; δ, rho, E, nu, G, K, λ, μ) = get_required_point_parameters(mat, p)
162+
(; Gc, εc) = get_frac_params(mat.dmgmodel, p, δ, K)
163+
bc = 18 * K /* δ^4) # bond constant
164+
C = get_hooke_matrix(nu, λ, μ)
165+
return CPointParameters(δ, rho, E, nu, G, K, λ, μ, Gc, εc, bc, C)
166+
end
167+
168+
@params CMaterial CPointParameters
144169

145170
@storage CMaterial struct CStorage
146171
@lthfield position::Matrix{Float64}
@@ -187,13 +212,12 @@ function force_density_point!(storage::AbstractStorage, system::AbstractSystem,
187212
defgrad_res = calc_deformation_gradient(storage, system, mat, params, i)
188213
too_much_damage!(storage, system, mat, defgrad_res, i) && return nothing
189214
PKinv = calc_first_piola_kirchhoff!(storage, mat, params, defgrad_res, Δt, i)
190-
zem = mat.zem_stabilization
191-
c_force_density!(storage, system, mat, params, zem, PKinv, defgrad_res, i)
215+
c_force_density!(storage, system, mat, params, mat.zem, PKinv, defgrad_res, i)
192216
return nothing
193217
end
194218

195219
function calc_deformation_gradient(storage::CStorage, system::BondSystem, ::CMaterial,
196-
::StandardPointParameters, i)
220+
::CPointParameters, i)
197221
(; bonds, volume) = system
198222
(; bond_active) = storage
199223
K = zero(SMatrix{3,3,Float64,9})
@@ -217,7 +241,7 @@ function calc_deformation_gradient(storage::CStorage, system::BondSystem, ::CMat
217241
end
218242

219243
function calc_first_piola_kirchhoff!(storage::CStorage, mat::CMaterial,
220-
params::StandardPointParameters, defgrad_res, Δt, i)
244+
params::CPointParameters, defgrad_res, Δt, i)
221245
(; F, Kinv) = defgrad_res
222246
P = first_piola_kirchhoff(mat.constitutive_model, storage, params, F)
223247
PKinv = P * Kinv
@@ -252,6 +276,40 @@ function c_force_density!(storage::AbstractStorage, system::AbstractSystem,
252276
return nothing
253277
end
254278

279+
function c_force_density!(storage::AbstractStorage, system::AbstractSystem,
280+
mat::AbstractCorrespondenceMaterial,
281+
params::AbstractPointParameters, zem::ZEMWan, PKinv, defgrad_res,
282+
i)
283+
(; bonds, volume) = system
284+
(; bond_active) = storage
285+
(; F) = defgrad_res
286+
C_1 = calc_zem_stiffness_tensor!(storage, system, mat, params, zem, defgrad_res, i)
287+
for bond_id in each_bond_idx(system, i)
288+
bond = bonds[bond_id]
289+
j = bond.neighbor
290+
ΔXij = get_vector_diff(system.position, i, j)
291+
Δxij = get_vector_diff(storage.position, i, j)
292+
293+
# improved stabilization from this article:
294+
# https://doi.org/10.1007/s10409-019-00873-y
295+
ωij = kernel(system, bond_id) * bond_active[bond_id]
296+
tzem = ωij * C_1 * (Δxij .- F * ΔXij)
297+
298+
# update of force density
299+
tij = ωij * PKinv * ΔXij + tzem
300+
update_add_vector!(storage.b_int, i, tij .* volume[j])
301+
update_add_vector!(storage.b_int, j, -tij .* volume[i])
302+
end
303+
return nothing
304+
end
305+
306+
function calc_zem_stiffness_tensor!(storage::CStorage, system::BondSystem, mat::CMaterial,
307+
params::CPointParameters, zem::ZEMWan, defgrad_res, i)
308+
(; Kinv) = defgrad_res
309+
C_1 = calc_zem_stiffness_tensor(params.C, Kinv)
310+
return C_1
311+
end
312+
255313
function too_much_damage!(storage::AbstractStorage, system::AbstractSystem,
256314
mat::AbstractCorrespondenceMaterial, defgrad_res, i)
257315
(; F) = defgrad_res

0 commit comments

Comments
 (0)