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)xis a single value: Convert to aTupleof length 1xis aTupleorNothing: 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, 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 — 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.
MechanicalMaterialModels.get_resid_eltype — Functionget_resid_eltype(res::AbstractResidual)Return the element type used to store res as a vector
MechanicalMaterialModels.get_num_unknowns — Functionget_num_unknowns(res::AbstractResidual)Return the number of unknowns for the residual res