@@ -77,6 +77,7 @@ When specifying the `fields` keyword of [`Job`](@ref) for a [`Body`](@ref) with
7777- `b_ext::Matrix{Float64}`: External force density of each point.
7878- `damage::Vector{Float64}`: Damage of each point.
7979- `n_active_bonds::Vector{Int}`: Number of intact bonds of each point.
80+ - `strain_energy_density::Vector{Float64}`: Strain energy density of each point.
8081"""
8182struct OSBMaterial{Correction,K,DM} <: AbstractBondSystemMaterial{Correction}
8283 kernel:: K
@@ -226,33 +227,39 @@ function calc_dilatation(storage::OSBStorage, system::BondSystem, mat::OSBMateri
226227 return dil
227228end
228229
229- function export_field (:: Val{:strain_energy_density} , mat:: OSBMaterial , system:: BondSystem ,
230- storage:: AbstractStorage , paramsetup:: AbstractParameterSetup , t)
230+ function strain_energy_density_point! (storage:: AbstractStorage , system:: BondSystem ,
231+ mat:: OSBMaterial , paramsetup:: AbstractParameterSetup ,
232+ i)
231233 (; bond_active, bond_length, strain_energy_density) = storage
232234 (; bonds, correction, volume) = system
233- strain_energy_density .= 0.0
235+ params_i = get_params (paramsetup, i)
236+ wvol = calc_weighted_volume (storage, system, mat, params_i, i)
237+ iszero (wvol) && return nothing
238+ dil = calc_dilatation (storage, system, mat, params_i, wvol, i)
239+ Ψvol = 0.5 * params_i. K * dil^ 2
240+ Ψdev = 0.0
241+ for bond_id in each_bond_idx (system, i)
242+ bond = bonds[bond_id]
243+ j, L = bond. neighbor, bond. length
244+ l = bond_length[bond_id]
245+ e = l - L
246+ edev = e - 1 / 3 * dil * L
247+ ωij = kernel (system, bond_id) * bond_active[bond_id]
248+ β = surface_correction_factor (correction, bond_id)
249+ params_j = get_params (paramsetup, j)
250+ G = (params_i. G + params_j. G) / 2
251+ cdev = 15.0 * G / (2 * wvol)
252+ Ψdev += cdev * ωij * β * edev * edev * volume[j]
253+ end
254+ Ψ = Ψvol + Ψdev
255+ strain_energy_density[i] = Ψ
256+ return nothing
257+ end
258+
259+ function export_field (:: Val{:strain_energy_density} , mat:: OSBMaterial , system:: BondSystem ,
260+ storage:: AbstractStorage , paramsetup:: AbstractParameterSetup , t)
234261 for i in each_point_idx (system)
235- params_i = get_params (paramsetup, i)
236- wvol = calc_weighted_volume (storage, system, mat, params_i, i)
237- iszero (wvol) && continue
238- dil = calc_dilatation (storage, system, mat, params_i, wvol, i)
239- Ψvol = 0.5 * params_i. K * dil^ 2
240- Ψdev = 0.0
241- for bond_id in each_bond_idx (system, i)
242- bond = bonds[bond_id]
243- j, L = bond. neighbor, bond. length
244- l = bond_length[bond_id]
245- e = l - L
246- edev = e - 1 / 3 * dil * L
247- ωij = kernel (system, bond_id) * bond_active[bond_id]
248- β = surface_correction_factor (correction, bond_id)
249- params_j = get_params (paramsetup, j)
250- G = (params_i. G + params_j. G) / 2
251- cdev = 15.0 * G / (2 * wvol)
252- Ψdev += cdev * ωij * β * edev * edev * volume[j]
253- end
254- Ψ = Ψvol + Ψdev
255- strain_energy_density[i] = Ψ
262+ strain_energy_density_point! (storage, system, mat, paramsetup, i)
256263 end
257- return strain_energy_density
264+ return storage . strain_energy_density
258265end
0 commit comments