pyoptmat.models: structural material models
This module contains objects to define and integrate full material models.
In our context a material model is a ODE that defines the stress rate and an associated set of internal variables. Mathematically, we can define this as two ODEs:
where \(\sigma\) is the uniaxial stress, \(h\) is some
arbitrary set of internal variables, \(T\) is the temperature,
\(\dot{\varepsilon}\) is the strain rate, and \(t\) is the time.
Note then that we mathematically define models as strain controlled: the input
is the strain rate and the output is the stress rate. Currently there is
only one implemented full material model: pyoptmat.models.InelasticModel,
which is a standard viscoplastic formulation. However other types of
models, including rate-independent plasticity, could be defined with
the same basic form.
The model itself just defines a system of ODEs. To solve for stress or
strain as a function of the experimental conditions we need to integrate
this model using the methods in pyoptmat.ode. We could do this
in two ways, in strain control where we provide the strains and temperatures
as a function of time and integrate for the stress or provide the
stresses and temperatures as a function of time and integrate for the
strains. The pyoptmat.models.ModelIntegrator provides both
options, where each experiment can either be strain or stress controlled.
The basic process of setting up a material model capable of simulating
experimental tests is to define the model form mathematically, using a
Model class and wrap that Model with an Integrator to provide actual
time series of stress or strain. As the integrator class uses the
methods in pyoptmat.ode to actually do the integration, the
results (and subsequent mathematical operations on the results) can be
differentiated using either PyTorch backpropogation AD or the adjoint
method.
- class pyoptmat.models.BothBasedModel(model, rate_fn, base_fn, T_fn, control, *args, **kwargs)
Bases:
ModuleProvides both the strain rate and stress rate form at once, for better vectorization
- Parameters:
model – base InelasticModel
rate_fn – controlled quantity rate interpolator
base_fn – controlled quantity base interpolator
T_fn – temperature interpolator
indices – split into strain and stress control
- forward(t, y)
Evaluate both strain and stress control and paste into the right locations.
- Parameters:
t – input times
y – input state
- class pyoptmat.models.DamagedInelasticModel(E, flowrule, *args, dmodel=NoDamage(), **kwargs)
Bases:
ModuleThis object provides the standard strain-based rate form of a constitutive model
\[\dot{\sigma} = E \left(\dot{\varepsilon} - (1-d) \dot{\varepsilon}_{in} \right)\]- Parameters:
E – Material Young’s modulus
flowrule –
pyoptmat.flowrules.FlowRuledefining the inelastic strain ratedmodel (optional) –
pyoptmat.damage.DamageModeldefining the damage variable evolution rate, defaults topyoptmat.damage.NoDamage
- forward(t, y, erate, T)
Return the rate equations for the strain-based version of the model
- Parameters:
t – (nbatch,) times
y – (nbatch,1+nhist+1) [stress, history, damage]
erate – (nbatch,) strain rates
T – (nbatch,) temperatures
- Returns:
(nbatch,1+nhist+1) state rate d_y_dot_d_y: (nbatch,1+nhist+1,1+nhist+1) Jacobian wrt the state d_y_dot_d_erate:(nbatch,1+nhist+1) Jacobian wrt the strain rate d_y_dot_d_T: (nbatch,1+nhist+1) derivative wrt temperature (unused)
- Return type:
y_dot
- property nhist
Number of internal variables
- class pyoptmat.models.InelasticModel(E, flowrule, *args, **kwargs)
Bases:
ModuleThis object provides the standard strain-based rate form of a constitutive model
\[\dot{\sigma} = E \left(\dot{\varepsilon} - \dot{\varepsilon}_{in} \right)\]- Parameters:
E – Material Young’s modulus
flowrule –
pyoptmat.flowrules.FlowRuledefining the inelastic strain rate
- forward(t, y, erate, T)
Return the rate equations for the strain-based version of the model
- Parameters:
t – (nbatch,) times
y – (nbatch,1+nhist) [stress, history]
erate – (nbatch,) strain rates
T – (nbatch,) temperatures
- Returns:
(nbatch,1+nhist) state rate d_y_dot_d_y: (nbatch,1+nhist,1+nhist) Jacobian wrt the state d_y_dot_d_erate:(nbatch,1+nhist) Jacobian wrt the strain rate d_y_dot_d_T: (nbatch,1+nhist) derivative wrt temperature (unused)
- Return type:
y_dot
- property nhist
Number of internal variables
- class pyoptmat.models.ModelIntegrator(model, *args, use_adjoint=True, **kwargs)
Bases:
ModuleThis class provides infrastructure for integrating constitutive models in either strain or stress control.
- Parameters:
model – base strain-controlled model
method (optional) – integrate method used to solve the equations, defaults to “backward-euler”
use_adjoint (optional) – if True use the adjoint approach to
**kwargs – passed on to the odeint method
- forward(t, y)
Evaluate both strain and stress control and paste into the right locations.
- Parameters:
t – input times
y – input state
- solve_both(times, temperatures, idata, control)
Solve for either strain or stress control at once
- Parameters:
times – input times, (ntime,nexp)
temperatures – input temperatures (ntime,nexp)
idata – input data (ntime,nexp)
control – signal for stress/strain control (nexp,)
- solve_strain(times, strains, temperatures)
Basic model definition: take time and strain rate and return stress
- Parameters:
times – input times, shape (ntime)
strains – input strains, shape (ntime, nbatch)
temperatures – input temperatures, shape (ntime, nbatch)
- Returns:
- stacked [stress, history, damage] vector of shape
(ntime,nbatch,1+nhist+1)
- Return type:
y
- solve_stress(times, stresses, temperatures)
Inverse model definition: take time and stress rate and return strain
- Parameters:
times – input times, shape (ntime,)
stresses – input stresses, shape (ntime, nbatch)
temperatures – input temperatures, shape (ntime, nbatch)
- Returns:
- stack [strain, history, damage] vector
of shape (ntime,nbatch,2+nhist)
- Return type:
y
- class pyoptmat.models.StrainBasedModel(model, erate_fn, T_fn, *args, **kwargs)
Bases:
ModuleProvides the strain rate form
- Parameters:
model – base InelasticModel
erate_fn – erate(t)
T_fn – T(t)
- forward(t, y)
Strain rate as a function of t and state
- Parameters:
t – input times
y – input state
- class pyoptmat.models.StressBasedModel(model, srate_fn, stress_fn, T_fn, *args, **kwargs)
Bases:
ModuleProvides the stress rate form
- Parameters:
model – base InelasticModel
srate_fn – srate(t)
T_fn – T(t)
- forward(t, y)
Stress rate as a function of t and state
- Parameters:
t – input times
y – input state