Conversion
MaterialModelsBase
defines an interface for converting parameters and state variables to and from AbstractVector
s. 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_tensorbase
— Functionget_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.
MaterialModelsBase.get_num_statevars
— Functionget_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.
MaterialModelsBase.get_statevar_eltype
— Functionget_statevar_eltype(s::AbstractMaterialState)
Get the type used to store each scalar component of the material state variables, defaults to Float64
.
MaterialModelsBase.get_num_params
— Functionget_num_params(m::AbstractMaterial)
Return the number of material parameters in m
. No default value implemented.
MaterialModelsBase.get_params_eltype
— Functionget_params_eltype(m::AbstractMaterial)
Return the number type for the scalar material parameters, defaults to Float64
MaterialModelsBase.get_num_tensorcomponents
— Functionget_num_tensorcomponents(::AbstractMaterial)
Returns the number of independent components for the given material.
It is not required to implement this function, it is inferred by the implementation of get_tensorbase
Conversion functions
MaterialModelsBase.tovector!
— Functiontovector!(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.
MaterialModelsBase.fromvector
— Functionfromvector(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
MaterialModelsBase.tovector
— Functiontovector(m::AbstractMaterial)
Out-of place version of tovector!
. Relies on get_num_params
and get_params_eltype
to be correctly defined
tovector(m::AbstractMaterialState)
Out-of place version of tovector!
. Relies on get_num_statevars
and get_statevar_eltype
to be correctly defined