Developer Documentation
The following functions and their docstrings may be helpful for understanding the code, but these may change.
MechanicalMaterialModels.maketuple_or_nothing
— Functionmaketuple_or_nothing(x)
x
is a single value: Convert to aTuple
of length 1x
is aTuple
orNothing
: Returnx
MechanicalMaterialModels.get_promoted_type
— Functionget_promoted_type(args...)
Get the promoted type for the type of the arguments, e.g. get_promoted_type(1, 1.f0)
is Float32
MechanicalMaterialModels.baseof
— Functionbaseof(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!
— Functionvector_residual!(rf::Function, r_vector::AbstractVector, x_vector::AbstractVector, x)
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
and output r
of rf
should have the same type, RT
, and support Tensors.get_base(RT)
, frommandel(Tensors.get_base(RT), x_vector)
, and tomandel!(r_vector, r)
.
The approach was adopted from https://github.com/kimauth/MaterialModels.jl
MechanicalMaterialModels.compute_potential
— Functioncompute_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
— Functioncompute_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
— Functioncompute_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
— Functioncompute_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
— Functionstatic_vector(args::Union{Number, SVector}...)
Convert the elements of args
into an SVector
.