|
NEML2 2.1.0
|
neml2.reader._llm.LLMClient defines the protocol for chat-completion client. It can be extended to define custom clients, e.g., OpenAI clients, Anthropic clients, etc.
In this example, we will use Argonne's Argo as the chat client. If you are not on Argonne's internal network, this example will not work. However, you can still use this example as a reference when wrapping your own chat clients.
For ANL employees, the request body requires a field "user" which should be your ANL domain username
The describe method parses the input file and looks up object and parameter descriptions from the syntax database.
This input defines a small-strain, isotropic elastoplastic material model with:
Its intended use is for metals where plastic flow changes character with temperature and strain rate: essentially rate-independent plasticity in one regime, but smooth transition to viscoplastic (Perzyna-type) flow when thermal activation becomes important.
You can think of the model as a standard J2 metal plasticity framework, but with a “smart gearbox” for the plastic multiplier:
So the backbone is familiar: elastic predictor + von Mises yield check + isotropic hardening + associative flow, but the flow rate is governed by a Kocks–Mecking-based transition between two regimes.
This provides the scalar driving stress for yielding.
Three constants are defined:
These are Kocks–Mecking parameters controlling thermal activation/rate sensitivity behavior.
ys computes the base yield stress as
\[\sigma_y = e^C \mu \]
where mu is the shear modulus, interpolated from temperature.
So the initial yield stress scales with the temperature-dependent shear modulus, which is physically reasonable for metals.
isoharden is a Voce hardening law:
\[h = R \left(1 - e^{-d \bar{\varepsilon}_p}\right) \]
Here:
This means the hardening response evolves with temperature: both the amount of hardening and how fast it saturates can change across the training temperatures.
The internal hardening variable k enters the yield condition as an additive resistance.
yield defines the usual overstress function:
\[f = \bar{\sigma} - \sigma_y - k \]
where:
There is also yield_zero, which sets the yield stress term to zero and writes an alternative yield function fp_alt. From the structure, this appears to be used specifically for the rate-dependent flow law, likely so the overstress expression is built in a convenient form using only hardening resistance. It is a modeling/implementation detail rather than a different physical mechanism.
normality computes derivatives of the yield function with respect to:
Then:
\[ \dot{\varepsilon}_p = -\dot{\gamma}\,\frac{\partial f}{\partial M} \]
\[ \dot{\bar{\varepsilon}}_p = -\dot{\gamma}\,\frac{\partial f}{\partial k} \]
So this is classical associative J2 plasticity: plastic flow is normal to the yield surface.
Two possible plastic flow rates are computed.
ri_flowrate enforces the standard consistency/complementarity condition through a smooth residual form. This is the usual return-mapping style plasticity behavior.
rd_flowrate uses a Perzyna overstress law:
\[\dot{\gamma} = \left(\frac{\langle f \rangle}{\eta}\right)^n \]
where:
Both n and \eta depend on temperature and shear modulus through Kocks–Mecking relations, so the viscous response is physically informed rather than purely phenomenological.
The model computes a normalized activation energy g:
\[g = \frac{kT}{\mu b^3}\ln\left(\frac{\dot{\varepsilon}_0}{\dot{\varepsilon}}\right) \]
This compares thermal energy and strain-rate effects against the material resistance scale.
A threshold g0 is computed from A, B, and C.
Then flowrate uses KocksMeckingFlowSwitch to smoothly blend between:
with a sharpness of 100, meaning the transition is quite steep but still continuous.
Physically, this says: when thermal activation is below a critical level, use classical plasticity; above it, use thermally activated viscoplastic flow.
elasticity is standard small-strain isotropic linear elasticity with:
and it is written in rate form.
Eerate computes elastic strain rate as:
\[\dot{\varepsilon}_e = \dot{\varepsilon} - \dot{\varepsilon}_p \]
So total strain rate is split into elastic and plastic parts in the usual additive small-strain sense.
Erate, integrate_stress, and integrate_ep indicate backward-Euler time integration of total strain, stress, and equivalent plastic strain/internal variables.
Several quantities are interpolated from temperature:
This means the model is explicitly thermomechanically coupled through prescribed temperature-dependent properties, though not through heat generation or full thermodynamic temperature evolution. Temperature acts as an input field affecting stiffness, strength, hardening, and rate sensitivity.
The magnitude of the constants suggests a specific unit system is being used consistently; that matters a lot for interpreting the Boltzmann constant, Burgers vector, stress, and strain-rate scales.
This is a temperature-dependent small-strain J2 metal plasticity model with linear elasticity, Voce isotropic hardening, and a Kocks–Mecking-informed transition from classical rate-independent plasticity to Perzyna viscoplasticity as thermal activation and strain-rate effects become important.