Conversion

MaterialModelsBase defines an interface for converting parameters and state variables to and from AbstractVectors. This is useful when doing parameter identification, or when interfacing with different languages that require information to be passed as arrays.

These function can be divided into those providing information about the material and state variables, and those doing the actual conversion.

Information functions

MaterialModelsBase.get_tensorbaseFunction
get_tensorbase(m::AbstractMaterial)

Return the type of the primary input (strain-like) and associated output (stress-like) to the material model. The default is SymmetricTensor{2, 3} for small-strain material models in 3D, but typically, it can be

  • Small strain material model: SymmetricTensor{2, dim}
  • Large strain material model: Tensor{2, dim}
  • Traction-separation law: Vec{dim}

Where dim = 3 is most common, but any value, 1, 2, or 3, is valid.

source
MaterialModelsBase.get_num_statevarsFunction
get_num_statevars(s::AbstractMaterialState)
get_num_statevars(m::AbstractMaterial)

Return the number of state variables. A tensorial state variable should be counted by how many components it has. E.g. if a state consists of one scalar and one symmetric 2nd order tensor in 3d, get_num_statevars should return 7.

It suffices to define for the state, s, only, but defining for material, m, directly as well can improve performance.

source

Conversion functions

MaterialModelsBase.tovector!Function
tovector!(v::AbstractVector, m::AbstractMaterial)

Put the material parameters of m into the vector v. This is typically used when the parameters should be fitted.

tovector!(v::AbstractVector, s::AbstractMaterialState)

Put the state variables in s into the vector v. This is typically used when differentiating the material wrt. the the old state variables.

source
MaterialModelsBase.fromvectorFunction
fromvector(v::AbstractVector, ::MT) where {MT<:AbstractMaterial}

Create a material of type MT with the parameters according to v

fromvector(v::AbstractVector, ::ST) where {ST<:AbstractMaterialState}

Create a material state of type ST with the values according to v

source
MaterialModelsBase.tovectorFunction
tovector(m::AbstractMaterial)

Out-of place version of tovector!. Relies on get_num_params and get_params_eltype to be correctly defined

source
tovector(m::AbstractMaterialState)

Out-of place version of tovector!. Relies on get_num_statevars and get_statevar_eltype to be correctly defined

source