Materials are implemented by subclassing the matmodlab.core.Material
base class. The user material is called at each frame of every step. It is provided with the material state at the start of the increment (stress, solution-dependent state variables, temperature, etc) and with the increments in temperature, deformation, and time.
The implementation of a material model will be demonstrated with a standard isotropic linear elastic model.
The mechanical response of a linear elastic material is defined by
$$ \boldsymbol{\sigma} = \mathbb{C}{:}\boldsymbol{\epsilon} = 3K\boldsymbol{\epsilon}^{\rm iso} + 2G\boldsymbol{\epsilon}^{\rm dev} $$where $K$ is the bulk modulus and $G$ is the shear modulus. The strain $\boldsymbol{\epsilon}$ can be determined from the deformation gradient $\pmb{F}$ as
$$ \boldsymbol{\epsilon} = \frac{1}{2\kappa}\left[\left(\boldsymbol{F}^{\rm T}{\cdot}\boldsymbol{F}\right)^{2\kappa} - \boldsymbol{I}\right] $$where $\kappa$ is the generalized Seth-Hill strain parameter. Defined as such, several well known finite strain measures are emitted:
The implementations of linear elasticity to follow will take as input Young's modulus E
, Poisson's ratio Nu
, and the Seth-Hill parameter k
for changing the strain definition.
The easiest way to implement a material model is to subclass the matmodlab2.core.material.Material
class and define:
name
: class attribute
Used for referencing the material model in the MaterialPointSimulator
.
eval
: instance method
Updates the material stress, stiffness (optional), and state dependent variables. If the stiffness is returned as None
, Matmodlab will determine it numerically.
Other optional attributes and methods include:
num_sdv
: instance attribute
The number of state dependent variables. Default is None
.
sdv_names
: instance attribute
List of state dependent variable names. Default is SDV_N
for the N$^{\rm th}$ state dependent variable.
sdvini
: instance method [optional]
Initializes solution dependent state variables (otherwise assumed to be 0).
In the example below, in addition to some standard functions imported from numpy
, several helper functions are imported from various locations in Matmodlab:
matmodlab2.core.tensor
logm
, powm
: computes the matrix logarithm and powerarray_rep
: converts a symmetric tensor stored as a 3x3 matrix to an array of length 6polar_decomp
: computes the polar decomposition of the deformation gradient $\pmb{F}$isotropic_part
, deviatoric_part
: computes the isotropic and deviatoric parts of a second-order symmetric tensor stored as an array of length 6VOIGT
: mulitplier for converting tensor strain components to engineering strain componentsThe relevant input parameters to the material's eval
method from Matmodlab are:
F
: the deformation gradient at the end of the stepThe isotropic elastic material described above is implemented as ElasticMaterialTotal
in the file matmodlab/materials/elastic3.py
. The implementation can be viewed by executing the following cell.
In [1]:
%pycat ../matmodlab2/materials/elastic3.py
In [2]:
%pylab inline
from matmodlab2 import *
Exercising the elastic model through a path of uniaxial stress should result in the slope of axial stress vs. axial strain being equal to the input parameter E
.
Note: it is the responsibility of the model developer to define the material's instantiation. In the case of ElasticMaterialTotal
, the interface takes the elastic parameters as keywords. Parameters not specified are initialized to a value of zero.
In [3]:
mps1 = MaterialPointSimulator('uelastic-std')
mps1.material = ElasticMaterialTotal(E=10e6, Nu=.333)
mps1.run_step('ESS', (.1, 0, 0), frames=50)
i = where(mps1.df['E.XX'] > 0.)
E = mps1.df['S.XX'].iloc[i] / mps1.df['E.XX'].iloc[i]
assert allclose(E, 10e6, atol=1e-3, rtol=1e-3)