pyoptmat.flowrules: inelastic flow rules for structural materials
Module containing inelastic flow rules. These provide the rate of the viscoplastic strain and internal variables as a function of the stress, the current values of the internal variables, the time, and the temperature.
So these objects define two functions
\[ \begin{align}\begin{aligned}\sigma, h, t, T \rightarrow \dot{\varepsilon}_{in}\\\sigma, h, t, T \rightarrow \dot{h}\end{aligned}\end{align} \]
In addition, the object needs to define the derivative of the inelastic strain rate and internal variable evolution rates with respect to the current values of stress and the current values of the internal variables. The objects return “self” derivatives (i.e. the derivative of the inelastic strain rate with respect to stress and the derivative of the internal variable rate with respect to the internal variables) along with the rates themselves. The “cross” derivatives are defined with separate methods.
- class pyoptmat.flowrules.FlowRule
Bases:
ModuleSuperclass for flow rule models
This implementation provides default zero cross derivatives and that’s it.
- dflow_derate(s, h, t, T, e)
The derivative of the flow rate with respect to the total strain rate
The superclass implementation provides a default of zero with the right shape.
- Parameters:
s (torch.tensor) – stress
h (torch.tensor) – internal variables
t (torch.tensor) – time
T (torch.tensor) – temperature
e (torch.tensor) – total strain rate
- Returns:
- derivative of flow rate with respect to the
internal variables
- Return type:
torch.tensor
- dflow_dhist(s, h, t, T, e)
The derivative of the flow rate with respect to the internal variables
The superclass implementation provides a default of zero with the right shape.
- Parameters:
s (torch.tensor) – stress
h (torch.tensor) – internal variables
t (torch.tensor) – time
T (torch.tensor) – temperature
e (torch.tensor) – total strain rate
- Returns:
- derivative of flow rate with respect to the
internal variables
- Return type:
torch.tensor
- dhist_derate(s, h, t, T, e)
The derivative of the flow rate with respect to the total strain rate
The superclass implementation provides a default of zero with the right shape.
- Parameters:
s (torch.tensor) – stress
h (torch.tensor) – internal variables
t (torch.tensor) – time
T (torch.tensor) – temperature
e (torch.tensor) – total strain rate
- Returns:
derivative of flow rate with respect to the strain rate
- Return type:
torch.tensor
- dhist_dstress(s, h, t, T, e)
The derivative of the flow rate with respect to the stress
The superclass implementation provides a default of zero with the right shape.
- Parameters:
s (torch.tensor) – stress
h (torch.tensor) – internal variables
t (torch.tensor) – time
T (torch.tensor) – temperature
e (torch.tensor) – total strain rate
- Returns:
derivative of flow rate with respect to the stress
- Return type:
torch.tensor
- class pyoptmat.flowrules.IsoKinViscoplasticity(n, eta, s0, isotropic, kinematic)
Bases:
FlowRuleViscoplasticity with isotropic and kinematic hardening, defined as
\[\dot{\varepsilon}_{in}=\left\langle \frac{\left|\sigma-x\right|-s_{0}-k}{\eta}\right\rangle ^{n}\operatorname{sign}\left(\sigma-X\right)\]and where the
pyoptmat.hardening.IsotropicHardeningModelandpyoptmat.hardening.KinematicHardeningModelobjects determine the history rate.The
pyoptmat.hardening.IsotropicHardeningModelandpyoptmat.hardening.KinematicHardeningModelobjects each define both a set of internal variables, including the corresponding rate forms and Jacobians, but also a map from those internal variables to the isotropic hardening value \(k\) (forpyoptmat.hardening.IsotropicHardeningModel) and the kinematic hardening value \(x\) (forpyoptmat.hardening.KinematicHardeningModel), along with the derivatives of those maps. All this information is required to assemble the information this class needs to provide.- Parameters:
n (
TemperatureParameter) – rate sensitivityeta (
TemperatureParameter) – flow viscositys0 (
TemperatureParameter) – initial value of flow stress (i.e. the threshold stress)isotropic (
pyoptmat.hardening.IsotropicHardeningModel) – object providing the isotropic hardening modelkinematic (
pyoptmat.hardening.IsotropicHardeningModel) – object providing the kinematic hardening model
- dflow_dhist(s, h, t, T, e)
The derivative of the flow rate with respect to the internal variables
- Parameters:
s (torch.tensor) – stress
h (torch.tensor) – history
t (torch.tensor) – time
T (torch.tensor) – temperature
e (torch.tensor) – total strain rate
- Returns:
the derivative of the flow rate
- Return type:
torch.tensor
- dflow_diso(s, h, t, T, e)
The derivative of the flow rate with respect to the isotropic hardening
- Parameters:
s (torch.tensor) – stress
h (torch.tensor) – history
t (torch.tensor) – time
T (torch.tensor) – temperature
e (torch.tensor) – total strain rate
- Returns:
the derivative of the flow rate
- Return type:
torch.tensor
- dflow_dkin(s, h, t, T, e)
The derivative of the flow rate with respect to the kinematic hardening
- Parameters:
s (torch.tensor) – stress
h (torch.tensor) – history
t (torch.tensor) – time
T (torch.tensor) – temperature
e (torch.tensor) – total strain rate
- Returns:
the derivative of the flow rate
- Return type:
torch.tensor
- dhist_derate(s, h, t, T, e)
The derivative of the flow rate with respect to the total strain rate
- Parameters:
s (torch.tensor) – stress
h (torch.tensor) – internal variables
t (torch.tensor) – time
T (torch.tensor) – temperature
e (torch.tensor) – total strain rate
- Returns:
derivative of flow rate with respect to the strain rate
- Return type:
torch.tensor
- dhist_dstress(s, h, t, T, e)
The derivative of the history rate with respect to the stress
- Parameters:
s (torch.tensor) – stress
h (torch.tensor) – history
t (torch.tensor) – time
T (torch.tensor) – temperature
e (torch.tensor) – total strain rate
- Returns:
the derivative of the flow rate
- Return type:
torch.tensor
- flow_rate(s, h, t, T, e)
The flow rate itself and the derivative with respect to stress
- Parameters:
s (torch.tensor) – stress
h (torch.tensor) – history
t (torch.tensor) – time
T (torch.tensor) – temperature
e (torch.tensor) – total strain rate
- Returns:
- the flow rate and the derivative of the flow rate with
respect to stress
- Return type:
tuple(torch.tensor, torch.tensor)
- history_rate(s, h, t, T, e)
The vector of the rates of the internal variables split into portions defined by each hardening model
The first chunk of entries is for the isotropic hardening, the second for the kinematic hardening.
- Parameters:
s (torch.tensor) – stress
h (torch.tensor) – history
t (torch.tensor) – time
T (torch.tensor) – temperature
e (torch.tensor) – total strain rate
- Returns:
- the history rate and the
derivative of the history rate with respect to history
- Return type:
tuple(torch.tensor, torch.tensor)
- property nhist
The number of internal variables, here the sum from the isotropic and kinematic hardening models
- class pyoptmat.flowrules.KocksMeckingRegimeFlowRule(model1, model2, g0, mu, b, eps0, k, eps=tensor(1.0000e-20), g0_scale=<function KocksMeckingRegimeFlowRule.<lambda>>)
Bases:
FlowRuleSwitches between two different flow rules depending on the value of the Kocks-Mecking normalized activation energy
\[g = \frac{kT}{\mu b^3} \log{\frac{\dot{\varepsilon}_0}{\dot{\varepsilon}}}\]with \(k\) the Boltzmann constant, \(T\) temperature, \(\mu\) the shear modulus, \(b\) a representative Burgers vector, \(\dot{\varepsilon}_0\) a reference strain rate, and \(\dot{\varepsilon}\) the current applied strain rate.
If the activation energy is less than or equal to a threshold \(g_0\) the flow rate is equal to that of the first model. If the activation energy is greater than the threshold then the model switches to the second flow rule.
The two models should have compatible internal history vectors.
- Parameters:
model1 (flowrules.FlowRule) – first flow rule
model2 (flowrules.FlowRule) – second flow rule
g0 (torch.tensor) – activation energy threshold
mu (temperature.TemperatureParameter) – shear modulus
b (torch.tensor) – burgers vector
eps0 (torch.tensor) – reference strain rate
k (torch.tensor) – Boltzmann constant
- Keyword Arguments:
eps (float) – default 1e-20, offset to avoid divide-by-zero
g0_scale (function) – scaling function for g0, defaults to no scaling
- dflow_derate(s, h, t, T, e)
The derivative of the flow rate with respect to the total strain rate
- Parameters:
s (torch.tensor) – stress
h (torch.tensor) – internal variables
t (torch.tensor) – time
T (torch.tensor) – temperature
e (torch.tensor) – total strain rate
- Returns:
- derivative of flow rate with respect to the
internal variables
- Return type:
torch.tensor
- dflow_dhist(s, h, t, T, e)
The derivative of the flow rate with respect to the internal variables
- Parameters:
s (torch.tensor) – stress
h (torch.tensor) – history
t (torch.tensor) – time
T (torch.tensor) – temperature
e (torch.tensor) – total strain rate
- Returns:
the derivative of the flow rate
- Return type:
torch.tensor
- dhist_derate(s, h, t, T, e)
The derivative of the history rate with respect to the stress
- Parameters:
s (torch.tensor) – stress
h (torch.tensor) – history
t (torch.tensor) – time
T (torch.tensor) – temperature
e (torch.tensor) – total strain rate
- Returns:
the derivative of the flow rate
- Return type:
torch.tensor
- dhist_dstress(s, h, t, T, e)
The derivative of the history rate with respect to the stress
- Parameters:
s (torch.tensor) – stress
h (torch.tensor) – history
t (torch.tensor) – time
T (torch.tensor) – temperature
e (torch.tensor) – total strain rate
- Returns:
the derivative of the flow rate
- Return type:
torch.tensor
- flow_rate(s, h, t, T, e)
The uniaxial flow rate itself and the derivative with respect to stress
- Parameters:
s (torch.tensor) – stress
h (torch.tensor) – history
t (torch.tensor) – time
T (torch.tensor) – temperature
e (torch.tensor) – total strain rate
- Returns:
- the flow rate and the derivative
of the flow rate with respect to stress
- Return type:
tuple(torch.tensor, torch.tensor)
- g(T, e)
The current value of activation energy
- Parameters:
T (torch.tensor) – temperature
e (torch.tensor) – total strain rate
- Returns:
value of the activation energy
- Return type:
torch.tensor
- history_rate(s, h, t, T, e)
The history rate and the derivative of the history rate with respect to the current history
- Parameters:
s (torch.tensor) – stress
h (torch.tensor) – history
t (torch.tensor) – time
T (torch.tensor) – temperature
e (torch.tensor) – total strain rate
- Returns:
- the history rate and the
derivative of the history rate with respect to history
- Return type:
tuple(torch.tensor, torch.tensor)
- property nhist
The number of internal variables
- switch_values(vals1, vals2, T, e)
Switch between the two model results
- Parameters:
vals1 (torch.tensor) – values from first model
vals2 (torch.tensor) – values from second model
T (torch.tensor) – temperatures
e (torch.tensor) – strain rates
- class pyoptmat.flowrules.PerfectViscoplasticity(n, eta)
Bases:
FlowRulePerfect viscoplasticity defined as
\[ \begin{align}\begin{aligned}\dot{\varepsilon}_{in}=\left(\frac{\left|\sigma\right|}{\eta}\right)^{n}\operatorname{sign}\left(\sigma\right)\\\dot{h} = \emptyset\end{aligned}\end{align} \]- Parameters:
n (
TemperatureParameter) – rate sensitivityeta (
TemperatureParameter) – flow viscosity
- flow_rate(s, h, t, T, e)
The uniaxial flow rate itself and the derivative with respect to stress
- Parameters:
s (torch.tensor) – stress
h (torch.tensor) – history
t (torch.tensor) – time
T (torch.tensor) – temperature
e (torch.tensor) – total strain rate
- Returns:
- the flow rate and the derivative
of the flow rate with respect to stress
- Return type:
tuple(torch.tensor, torch.tensor)
- history_rate(s, h, t, T, e)
The history rate and the derivative of the history rate with respect to the current history
- Parameters:
s (torch.tensor) – stress
h (torch.tensor) – history
t (torch.tensor) – time
T (torch.tensor) – temperature
- Returns:
- the history rate and the
derivative of the history rate with respect to history
- Return type:
tuple(torch.tensor, torch.tensor)
- property nhist
The number of internal variables
Here 0…
- class pyoptmat.flowrules.RateIndependentFlowRuleWrapper(base, lmbda, eps_ref)
Bases:
FlowRuleWraps another flow rule using Walker’s time dilation trick to make it behave as if it was rate-independent.
Specifically, the model dilates time with the formula:
\[\Delta t \rightarrow \kappa \Delta t\]with
\[\kappa = 1 - \lambda + \frac{\lambda \left| \dot{\varepsilon} \right|}{\dot{\varepsilon}_{ref}}\]where \(\lambda\) is a parameter where \(\lambda = 0\) gives the original, rate dependent response and \(\lambda \approx 1\) gives an approximately rate independent response, \(\dot{\varepsilon}_{ref}\) is a reference strain rate which should be several orders of magnitude smaller than the applied strain rate, and \(\dot{\varepsilon}\) is the current, transient strain rate applied to the model.
- Parameters:
base (flowrules.FlowRule) – the base model
lmbda (scalar) – the tuning parameter \(\lambda\)
eps_ref (scalar) – the reference strain rate \(\dot{\varepsilon}_{ref}\)
- dflow_derate(s, h, t, T, e)
The derivative of the flow rate with respect to the total strain rate
- Parameters:
s (torch.tensor) – stress
h (torch.tensor) – internal variables
t (torch.tensor) – time
T (torch.tensor) – temperature
e (torch.tensor) – total strain rate
- Returns:
- derivative of flow rate with respect to the
internal variables
- Return type:
torch.tensor
- dflow_dhist(s, h, t, T, e)
The derivative of the flow rate with respect to the internal variables
- Parameters:
s (torch.tensor) – stress
h (torch.tensor) – history
t (torch.tensor) – time
T (torch.tensor) – temperature
e (torch.tensor) – total strain rate
- Returns:
the derivative of the flow rate
- Return type:
torch.tensor
- dhist_derate(s, h, t, T, e)
The derivative of the history rate with respect to the stress
- Parameters:
s (torch.tensor) – stress
h (torch.tensor) – history
t (torch.tensor) – time
T (torch.tensor) – temperature
e (torch.tensor) – total strain rate
- Returns:
the derivative of the flow rate
- Return type:
torch.tensor
- dhist_dstress(s, h, t, T, e)
The derivative of the history rate with respect to the stress
- Parameters:
s (torch.tensor) – stress
h (torch.tensor) – history
t (torch.tensor) – time
T (torch.tensor) – temperature
e (torch.tensor) – total strain rate
- Returns:
the derivative of the flow rate
- Return type:
torch.tensor
- dscale(e)
The derivative of the current value of the time dilation factor with respect to the total strain rate
- Parameters:
e (torch.tensor) – total strain rate
- Returns:
- derivative of the scale factor
with respect to the total strain rate
- Return type:
torch.tensor
- flow_rate(s, h, t, T, e)
The uniaxial flow rate itself and the derivative with respect to stress
- Parameters:
s (torch.tensor) – stress
h (torch.tensor) – history
t (torch.tensor) – time
T (torch.tensor) – temperature
e (torch.tensor) – total strain rate
- Returns:
- the flow rate and the derivative
of the flow rate with respect to stress
- Return type:
tuple(torch.tensor, torch.tensor)
- history_rate(s, h, t, T, e)
The history rate and the derivative of the history rate with respect to the current history
- Parameters:
s (torch.tensor) – stress
h (torch.tensor) – history
t (torch.tensor) – time
T (torch.tensor) – temperature
e (torch.tensor) – total strain rate
- Returns:
- the history rate and the
derivative of the history rate with respect to history
- Return type:
tuple(torch.tensor, torch.tensor)
- property nhist
The number of internal variables
- scale(e)
The current value of the time dilation factor
- Parameters:
e (torch.tensor) – total strain rate
- Returns:
current scale factor
- Return type:
torch.tensor
- class pyoptmat.flowrules.SoftKocksMeckingRegimeFlowRule(model1, model2, g0, mu, b, eps0, k, sf, eps=tensor(1.0000e-20), g0_scale=<function SoftKocksMeckingRegimeFlowRule.<lambda>>)
Bases:
FlowRuleSwitches between two different flow rules depending on the value of the Kocks-Mecking normalized activation energy
\[g = \frac{kT}{\mu b^3} \log{\frac{\dot{\varepsilon}_0}{\dot{\varepsilon}}}\]with \(k\) the Boltzmann constant, \(T\) temperature, \(\mu\) the shear modulus, \(b\) a representative Burgers vector, \(\dot{\varepsilon}_0\) a reference strain rate, and \(\dot{\varepsilon}\) the current applied strain rate.
If the activation energy is less than or equal to a threshold \(g_0\) the flow rate is equal to that of the first model. If the activation energy is greater than the threshold then the model switches to the second flow rule.
The two models should have compatible internal history vectors.
This version uses a soft blending of the two models rather than a hard switch. Specifically,
\[M = f M_1 + (1-f) M_2\]with
\[f = \frac{\tanh \left[s_f \left(g - g_0 \right) \right] + 1}{2}\]where \(s_f\) is some scaling function, with values around 100 providing a fairly hard switch between the two models
- Parameters:
model1 (flowrules.FlowRule) – first flow rule
model2 (flowrules.FlowRule) – second flow rule
g0 (torch.tensor) – activation energy threshold
mu (temperature.TemperatureParameter) – shear modulus
b (torch.tensor) – burgers vector
eps0 (torch.tensor) – reference strain rate
k (torch.tensor) – Boltzmann constant
sf (torch.tensor) – sharpness parameter
- Keyword Arguments:
eps (float) – default 1e-20, offset to avoid divide-by-zero
g0_scale (function) – scaling function for g0, defaults to no scaling
- blend_values(vals1, vals2, T, e)
Switch between the two model results
- Parameters:
vals1 (torch.tensor) – values from first model
vals2 (torch.tensor) – values from second model
T (torch.tensor) – temperatures
e (torch.tensor) – strain rates
- df_e(T, e)
The derivative of the weight function with respect to the strain rate
- Parameters:
T (torch.tensor) – temperature
e (torch.tensor) – total strain rate
- Returns:
derivative of the weight function
- Return type:
torch.tensor
- dflow_derate(s, h, t, T, e)
The derivative of the flow rate with respect to the total strain rate
- Parameters:
s (torch.tensor) – stress
h (torch.tensor) – internal variables
t (torch.tensor) – time
T (torch.tensor) – temperature
e (torch.tensor) – total strain rate
- Returns:
- derivative of flow rate with respect to the
internal variables
- Return type:
torch.tensor
- dflow_dhist(s, h, t, T, e)
The derivative of the flow rate with respect to the internal variables
- Parameters:
s (torch.tensor) – stress
h (torch.tensor) – history
t (torch.tensor) – time
T (torch.tensor) – temperature
e (torch.tensor) – total strain rate
- Returns:
the derivative of the flow rate
- Return type:
torch.tensor
- dg_e(T, e)
Derivative of the activation energy with respect to the strain rate
- Parameters:
T (torch.tensor) – temperature
e (torch.tensor) – total strain rate
- Returns:
derivative of the activation energy
- Return type:
torch.tensor
- dhist_derate(s, h, t, T, e)
The derivative of the history rate with respect to the stress
- Parameters:
s (torch.tensor) – stress
h (torch.tensor) – history
t (torch.tensor) – time
T (torch.tensor) – temperature
e (torch.tensor) – total strain rate
- Returns:
the derivative of the flow rate
- Return type:
torch.tensor
- dhist_dstress(s, h, t, T, e)
The derivative of the history rate with respect to the stress
- Parameters:
s (torch.tensor) – stress
h (torch.tensor) – history
t (torch.tensor) – time
T (torch.tensor) – temperature
e (torch.tensor) – total strain rate
- Returns:
the derivative of the flow rate
- Return type:
torch.tensor
- f(T, e)
The weight function value
- Parameters:
T (torch.tensor) – temperature
e (torch.tensor) – total strain rate
- Returns:
value of the weighting function
- Return type:
torch.tensor
- flow_rate(s, h, t, T, e)
The uniaxial flow rate itself and the derivative with respect to stress
- Parameters:
s (torch.tensor) – stress
h (torch.tensor) – history
t (torch.tensor) – time
T (torch.tensor) – temperature
e (torch.tensor) – total strain rate
- Returns:
- the flow rate and the derivative
of the flow rate with respect to stress
- Return type:
tuple(torch.tensor, torch.tensor)
- g(T, e)
The current value of activation energy
- Parameters:
T (torch.tensor) – temperature
e (torch.tensor) – total strain rate
- Returns:
value of the activation energy
- Return type:
torch.tensor
- history_rate(s, h, t, T, e)
The history rate and the derivative of the history rate with respect to the current history
- Parameters:
s (torch.tensor) – stress
h (torch.tensor) – history
t (torch.tensor) – time
T (torch.tensor) – temperature
e (torch.tensor) – total strain rate
- Returns:
- the history rate and the
derivative of the history rate with respect to history
- Return type:
tuple(torch.tensor, torch.tensor)
- property nhist
The number of internal variables
- class pyoptmat.flowrules.SuperimposedFlowRule(models)
Bases:
FlowRuleSuperimpose multiple flow rules with
\[\dot{\varepsilon}_{in}=\sum_i \dot{\varepsilon}_{in,i}\]and the history the union of all the individual models
- Parameters:
models (list) – list of the individual models
- dflow_derate(s, h, t, T, e)
The derivative of the flow rate with respect to the total strain rate
- Parameters:
s (torch.tensor) – stress
h (torch.tensor) – internal variables
t (torch.tensor) – time
T (torch.tensor) – temperature
e (torch.tensor) – total strain rate
- Returns:
- derivative of flow rate with respect to the
internal variables
- Return type:
torch.tensor
- dflow_dhist(s, h, t, T, e)
The derivative of the flow rate with respect to the internal variables
- Parameters:
s (torch.tensor) – stress
h (torch.tensor) – history
t (torch.tensor) – time
T (torch.tensor) – temperature
e (torch.tensor) – total strain rate
- Returns:
the derivative of the flow rate
- Return type:
torch.tensor
- dhist_derate(s, h, t, T, e)
The derivative of the history rate with respect to the stress
- Parameters:
s (torch.tensor) – stress
h (torch.tensor) – history
t (torch.tensor) – time
T (torch.tensor) – temperature
e (torch.tensor) – total strain rate
- Returns:
the derivative of the flow rate
- Return type:
torch.tensor
- dhist_dstress(s, h, t, T, e)
The derivative of the history rate with respect to the stress
- Parameters:
s (torch.tensor) – stress
h (torch.tensor) – history
t (torch.tensor) – time
T (torch.tensor) – temperature
e (torch.tensor) – total strain rate
- Returns:
the derivative of the flow rate
- Return type:
torch.tensor
- flow_rate(s, h, t, T, e)
The uniaxial flow rate itself and the derivative with respect to stress
- Parameters:
s (torch.tensor) – stress
h (torch.tensor) – history
t (torch.tensor) – time
T (torch.tensor) – temperature
e (torch.tensor) – total strain rate
- Returns:
- the flow rate and the derivative
of the flow rate with respect to stress
- Return type:
tuple(torch.tensor, torch.tensor)
- history_rate(s, h, t, T, e)
The history rate and the derivative of the history rate with respect to the current history
- Parameters:
s (torch.tensor) – stress
h (torch.tensor) – history
t (torch.tensor) – time
T (torch.tensor) – temperature
e (torch.tensor) – total strain rate
- Returns:
- the history rate and the
derivative of the history rate with respect to history
- Return type:
tuple(torch.tensor, torch.tensor)
- property nhist
The number of internal variables