Developer Documentation

The following functions and their docstrings may be helpful for understanding the code, but these may change.

MechanicalMaterialModels.promote_tuple_eltype — Function
promote_tuple_eltype(::Type{T}, xs::Tuple...) where {T<:Number}

Fold over the entries of each tuple in xs (Numbers or AbstractArrays, e.g. Tensors.jl tensors), promoting T with every entry's scalar element type. Any number (≥1) of tuples may be given; T is returned unchanged if all tuples are empty.

source
MechanicalMaterialModels.vector_residual! — Function
vector_residual!(rf::Function, r_vector::AbstractVector, x_vector::AbstractVector, xbase::RT)

Makes it easy to construct a mutating vector residual function from a tensor-like equation, r = rf(x) = residual(x, args...), e.g. rf!(r_vector, x_vector) = vector_residual!(z -> residual(z, args...), r_vector, x_vector, x)

The input x::RT must support MaterialModelsBase.fromvector, and the output r from rf must supportMaterialModelsBase.fromvector!.

The approach was adopted from MaterialModels.jl

source
MechanicalMaterialModels.compute_stress — Function
compute_stress(m::AbstractHyperElastic, C::SymmetricTensor)

Compute the 2nd PiolaKirchhoff stress, S = 2 ∂Ψ/∂C, for the potential Ψ defined by m for the Right-Cauchy-Green deformation tensor C

source
MechanicalMaterialModels.compute_tangent — Function
compute_tangent(m::AbstractHyperElastic, C::SymmetricTensor)

Compute the tangent stiffness, ∂S/∂E = 4 ∂²Ψ/∂C², for the potential Ψ defined by m for the Right-Cauchy-Green deformation tensor C.

source
MechanicalMaterialModels.compute_stress_and_tangent — Function
compute_stress_and_tangent(m::AbstractHyperElastic, C::SymmetricTensor)

Compute both the 2nd Piola-Kirchhoff stress, S, and the tangent stiffness, ∂S/∂E = 4 ∂²Ψ/∂C², for the potential Ψ defined by m for the Right-Cauchy-Green deformation tensor C. This is normally more efficient than computing the stress and tangents invidividually.

source
MechanicalMaterialModels.remove_dual — Function
remove_dual(x::T) where {T <: Number}
remove_dual(x::AbstractTensor{<:Any, <:Any, T}) where {T}

Removes the dual part if T <: ForwardDiff.Dual, extract the value part, helpful when implementing custom gradients.

source