Skip to content

Commit

Permalink
plastic strain @gernerated function
Browse files Browse the repository at this point in the history
  • Loading branch information
albert-de-montserrat committed Jan 24, 2024
1 parent 1f61cc7 commit b9ffe31
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/rheology/StressUpdate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,12 @@ function _compute_τ_nonlinear!(
end

# fill plastic strain rate tensor
ntuple(Val(N1)) do i
Base.@_inline_meta
λdQdτᵢ = λdQdτ[i]
ε_pl[i][idx...] = !isinf(λdQdτᵢ) * λdQdτᵢ
end
# ntuple(Val(N1)) do i
# Base.@_inline_meta
# λdQdτᵢ = λdQdτ[i]
# ε_pl[i][idx...] = !isinf(λdQdτᵢ) * λdQdτᵢ
# end
update_plastic_strain_rate!(ε_pl, λdQdτ, idx)
# update and correct stress
τij = τij .+ dτij
correct_stress!(τ, τij, idx...)
Expand All @@ -61,6 +62,14 @@ function _compute_τ_nonlinear!(
return nothing
end

# fill plastic strain rate tensor
@generated function update_plastic_strain_rate!(ε_pl::NTuple{N, T}, λdQdτ, idx) where {N,T}
quote
Base.@_inline_meta
Base.@nexprs $N i -> ε_pl[i][idx...] = !isinf(λdQdτ[i]) * λdQdτ[i]
end
end

# check if plasticity is active
@inline isyielding(is_pl, τII_trial, τy) = is_pl * (τII_trial > τy)

Expand Down

0 comments on commit b9ffe31

Please sign in to comment.