Developer Documentation
The following functions and their docstrings may be helpful for understanding the code, but these may change.
MechanicalMaterialModels.get_promoted_type — Function
get_promoted_type(args...)Get the promoted type for the type of the arguments, e.g. get_promoted_type(1, 1.f0) is Float32
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.
MechanicalMaterialModels.baseof — Function
baseof(t::AbstractTensor)Get the base-type of t, i.e. if t::SymmetricTensor{2,3,Float64,6}, baseof(t) returns SymmetricTensor{2,3}
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
MechanicalMaterialModels.compute_potential — Function
compute_potential(m::AbstractHyperElastic, C::SymmetricTensor)Compute the potential Ψ(C) given the Right-Cauchy-Green deformation tensor C for the hyperelastic material m.
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
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.
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.
MechanicalMaterialModels.static_vector — Function
static_vector(args::Union{Number, SVector}...)Convert the elements of args into an SVector.
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.