From 9d533353eecfbef63006d461c39eaec7901a36e4 Mon Sep 17 00:00:00 2001 From: Jukka Aho Date: Sat, 9 May 2026 18:34:40 +0300 Subject: [PATCH] feat(materials): add eigenstrain-augmented linear elasticity Support prescribed eigenstrain tensors updated outside `compute_stress`. - Add `LinearElasticWithEigenstrain` and matching state-variable declarations. --- src/materials/eigenstrain_elastic.jl | 40 ++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/materials/eigenstrain_elastic.jl diff --git a/src/materials/eigenstrain_elastic.jl b/src/materials/eigenstrain_elastic.jl new file mode 100644 index 0000000..b187cd1 --- /dev/null +++ b/src/materials/eigenstrain_elastic.jl @@ -0,0 +1,40 @@ +# SPDX-FileCopyrightText: 2015-2026 Jukka Aho +# SPDX-License-Identifier: MIT + +""" +Linear elastic response on the mechanical strain `ε − ε_e`, where the eigenstrain +`ε_e` (e.g. drying shrinkage) is stored per integration point and updated outside this +routine—typically after a moisture diffusion solve. +""" + +using Tensors + +struct LinearElasticWithEigenstrain <: AbstractElasticMaterial + elastic::LinearElastic +end + +LinearElasticWithEigenstrain(; E::Real, ν::Real) = LinearElasticWithEigenstrain(LinearElastic(E = E, ν = ν)) + +material_behavior(::LinearElasticWithEigenstrain) = StatefulStrainDependent() +supported_physics(::LinearElasticWithEigenstrain) = (Elasticity{3}(),) +required_state_variables(::LinearElasticWithEigenstrain) = (Eigenstrain,) + +function compute_stress( + mat::LinearElasticWithEigenstrain, + ε::SymmetricTensor{2,3}, + ::Nothing, + Δt::Float64, +) + return compute_stress(mat, ε, NamedTuple(), Δt) +end + +function compute_stress( + mat::LinearElasticWithEigenstrain, + ε::SymmetricTensor{2,3}, + state_old::NamedTuple, + Δt::Float64, +) + ε_e = get(state_old, :ε_e, zero(SymmetricTensor{2,3})) + σ, 𝔻, _ = compute_stress(mat.elastic, ε - ε_e, NamedTuple(), 0.0) + return σ, 𝔻, (ε_e=ε_e,) +end