Small strain materials
using MuesliMaterialsusing MuesliMaterials: check, updateCurrentState, stress!, tangentTensor!, storedEnergy, pressure, commitCurrentState, resetCurrentState, setProperty!, getProperty, MaterialProperties, PR_YOUNGSmall strain models take the linearised strain tensor $\varepsilon$ and return the Cauchy stress $\sigma$. This page uses linear isotropic elasticity, where every result can be checked against a closed form.
Building a material
The isotropic material takes Young's modulus, Poisson's ratio and optionally a density:
E, ν = 210000.0, 0.3material = ElasticIsotropicMaterial(E, ν)check(material)truecheck asks MUESLI whether the parameters are admissible — worth calling once after construction, since an inadmissible set is otherwise only noticed much later.
Printing a material reports what MUESLI made of it:
MuesliMaterials.print(material)
Small strain, elastic, isotropic material
Young modulus E : 210000
Poisson ratio nu : 0.3
Lame constants lambda : 121154
mu : 80769.2
Bulk modulus k : 175000
Density : 1
Wave velocities C_p : 531.688
C_s : 284.199The property map
Most materials can also be built from a MuesliMaterials.MaterialProperties map, which is how MUESLI passes named parameters. This is the only route for models with many parameters:
props = MaterialProperties()setProperty!(props, "young", E)setProperty!(props, "poisson", ν)fromProps = ElasticIsotropicMaterial(props)getProperty(fromProps, PR_YOUNG)210000.0Both routes give the same material.
Driving a material point
A material point carries the state. Push a strain into it with updateCurrentState, giving the time and the strain tensor:
mp = ElasticIsotropicMP(material)ε = [0.001 0.0002 0.0 0.0002 -0.0005 0.0001 0.0 0.0001 0.0003]updateCurrentState(mp, 1.0, Istensor(ε))Then read what you need. Stresses come back in a tensor you preallocate:
σ = Istensor()stress!(mp, σ)σMuesliMaterials.IstensorAllocated with 3x3 entries
258.46153846153845 32.30769230769231 0.0
32.30769230769231 16.153846153846146 16.153846153846153
0.0 16.153846153846153 145.38461538461536
which is exactly $2\mu\varepsilon + \lambda\,\mathrm{tr}(\varepsilon)\,I$:
λ = E * ν / ((1 + ν) * (1 - 2ν))μ = E / (2 * (1 + ν))2μ * ε + λ * (ε[1, 1] + ε[2, 2] + ε[3, 3]) * [1.0 0 0; 0 1 0; 0 0 1]3×3 Matrix{Float64}:
258.462 32.3077 0.0
32.3077 16.1538 16.1538
0.0 16.1538 145.385The stored energy is half the stress power:
storedEnergy(mp), 0.5 * sum(σ[i, j] * ε[i, j] for i in 1:3, j in 1:3)(0.15507692307692306, 0.15507692307692308)and the pressure is minus a third of the trace:
pressure(mp), -sum(σ[i, i] for i in 1:3) / 3(-140.0, -139.99999999999997)The tangent
tangentTensor! fills a fourth-order tensor with $\partial\sigma/\partial\varepsilon$:
ℂ = Itensor4()tangentTensor!(mp, ℂ)ℂ[1, 1, 1, 1], ℂ[1, 1, 2, 2], ℂ[1, 2, 1, 2](282692.3076923077, 121153.84615384616, 80769.23076923077)For an isotropic material those are $\lambda + 2\mu$, $\lambda$ and $\mu$:
λ + 2μ, λ, μ(282692.3076923077, 121153.84615384616, 80769.23076923077)Contracting the tangent with the strain reproduces the stress, which is the check worth making when wiring a new model into an element routine:
contracted = [sum(ℂ[i, j, k, l] * ε[k, l] for k in 1:3, l in 1:3) for i in 1:3, j in 1:3]contracted ≈ convert(Matrix{Float64}, σ)trueState bookkeeping
A material point distinguishes the current state from the last converged one. That is what lets a solver iterate and then accept a step:
updateCurrentState(mp, t, ε)sets the trial statecommitCurrentState(mp)accepts it as convergedresetCurrentState(mp)throws the trial state away and returns to the converged one
commitCurrentState(mp)# a trial step that the solver then rejectsupdateCurrentState(mp, 2.0, Istensor(5 .* ε))resetCurrentState(mp)stress!(mp, σ)σMuesliMaterials.IstensorAllocated with 3x3 entries
258.46153846153845 32.30769230769231 0.0
32.30769230769231 16.153846153846146 16.153846153846153
0.0 16.153846153846153 145.38461538461536
The stress is back to the committed value.
Other small strain models
The same pattern covers the rest of the catalogue. The anisotropic families take their constants as a vector, whose length identifies the model:
using MuesliMaterials: ElasticOrthotropicMaterial, ElasticTransverselyisotropicMaterialorthotropic = ElasticOrthotropicMaterial( [210000.0, 210000.0, 210000.0, 80000.0, 80000.0, 80000.0, 0.3, 0.3, 0.3], 1.0)check(orthotropic)truePlasticity, viscoelasticity, viscoplasticity and the damage models (SplasticMaterial, ViscoelasticMaterial, ViscoplasticMaterial, GTN_Material, Gurson_Material, Lemaitre_Material, LemKin_Material) follow the same material/point split; see the API reference for their constructors.