Tensor types
The fixed-size, three-dimensional vector and tensor classes MUESLI uses throughout. All of them support 1-based indexing, slicing, iteration and convert to ordinary Julia arrays; see Tensors and vectors for worked examples.
Types
MuesliMaterials.Ivector — Type
Ivector(v::AbstractVector)
Ivector(a, b, c)A three-component vector, MUESLI's ivector.
Supports 1-based indexing, iteration and convert(Vector{Float64}, v).
Examples
v = Ivector([1.0, 2.0, 3.0])v[2] # 2.0convert(Vector{Float64}, v)MuesliMaterials.Itensor — Type
Itensor(m::AbstractMatrix)
Itensor(a::AbstractVector, b::AbstractVector, c::AbstractVector)
Itensor(a00, a01, a02, a10, a11, a12, a20, a21, a22)A general second-order tensor in three dimensions, MUESLI's itensor.
Details
The matrix constructor takes a 3 × 3 Julia matrix. Julia stores matrices column-major while MUESLI's constructor is row-major, so the components are reordered on the way in — the round trip is faithful and nothing is transposed. Any other shape raises an error.
Behaves like a 3 × 3 array: indexing and slicing (both 1-based), axes, length, ndims, iteration, and convert to Matrix{Float64}. copyto!(A, T) and copyto!(T, A) move a whole tensor in one call and do not allocate for Float64 arrays, which is what to use in a hot loop. With Tensors.jl loaded it also converts to Tensor{2, 3}.
Finite strain material points take the deformation gradient as an Itensor, since it is not symmetric.
Examples
F = Itensor([1.05 0.02 0.0; 0.0 0.98 0.01; 0.0 0.0 1.01])F[1, 2] # 0.02F[1, :] # first rowconvert(Matrix{Float64}, F)A = zeros(3, 3)copyto!(A, F) # no allocationcopyto!(F, 2 .* A) # overwrite F in placeSee Also
Istensorfor the symmetric counterpart
MuesliMaterials.Istensor — Type
Istensor(m::AbstractMatrix)
Istensor(t00, t11, t22, t12, t20, t01)A symmetric second-order tensor in three dimensions, MUESLI's istensor.
Details
Only six components are stored. The matrix constructor reads the symmetric part of the 3 × 3 matrix it is given, so a non-symmetric input is symmetrised rather than rejected.
Istensor is a subtype of Itensor on the C++ side, so it supports the same array interface, and converts to SymmetricTensor{2, 3} when Tensors.jl is loaded.
Small strain material points take the strain and return stresses as Istensor; in the finite strain setting the second Piola-Kirchhoff, Kirchhoff and Cauchy stresses are Istensor while the first Piola-Kirchhoff stress is a general Itensor.
Examples
ε = Istensor([0.001 0.0002 0.0; 0.0002 -0.0005 0.0001; 0.0 0.0001 0.0003])σ = Istensor() # empty, to be filled by a bang methodMuesliMaterials.Itensor4 — Type
Itensor4(a::AbstractArray{<:Real, 4})
Itensor4()A fourth-order tensor in three dimensions, MUESLI's itensor4.
Details
The constructor takes a 3 × 3 × 3 × 3 array; anything else raises an error. The default constructor gives an uninitialised tensor to be filled by a bang method such as tangentTensor!.
Indexing is 1-based in all four slots.
Examples
ℂ = Itensor4()tangentTensor!(mp, ℂ)ℂ[1, 1, 2, 2]Array interface
Each type implements enough of the AbstractArray interface to be used like one:
getindex/setindex!, includingUnitRangeslicesaxes,ndims,length,similariterate, sosum,collectand comprehensions workcopyto!to and from a preallocatedVector/Matrix/Array{Float64, 4}, in one call and without allocating (other element types are converted first)converttoMatrix{Float64}/Array{Float64}, and — with Tensors.jl loaded — toTensor{2,3}andSymmetricTensor{2,3}
Collections of tensors
Some MUESLI routines take a list of tensors, for instance the relaxation strains of a viscoelastic material.
MuesliMaterials.ArrayOfITensors — Type
ArrayOfITensors()A growable list of Itensor values, for MUESLI routines that take several tensors at once.
Use push! to append a 3 × 3 Julia matrix, clear! to empty it and size for the count.
MuesliMaterials.ArrayOfIsTensors — Type
ArrayOfIsTensors()A growable list of Istensor values, for MUESLI routines that take several symmetric tensors at once — the per-branch relaxation strains of a viscoelastic material, for instance.
Use push! to append a 3 × 3 Julia matrix, clear! to empty it and size for the count.