morphogen.learning.standard¶
A learned generalized standard material (Halphen & Nguyen 1975) in small and finite
strains: a learned free energy psi(eps, alpha) of a few internal variables alpha,
convex, and a learned dissipation potential phi(alpha'), convex, nonnegative and zero
at zero; the state of a step is the minimizer of the incremental potential (Ortiz &
Stainier 1999),
alpha_{n+1} = argmin_alpha psi(eps_{n+1}, alpha) + dt phi((alpha - alpha_n) / dt),
a convex problem solved by Newton’s method on its gradient (a backtracking line search on
the potential), and sigma = d psi / d eps. By construction the dissipation of a step,
D dt = -d psi/d alpha . (alpha_{n+1} - alpha_n), is nonnegative (phi convex and
least at zero), the consistent tangent is symmetric and positive definite (the Schur
complement of the Hessian of the incremental potential, by the implicit function theorem)
and the law is stable whatever its parameters.
In the normalized variables of the models (Scales; x
= eps / s_eps, alpha dimensionless, z = (x, alpha)):
the free energy
psi = s_sigma s_eps (W(z) - W(0) - z . dW/dz(0)),W(z) = z . A z / 2 + sum_i w_i g(u_i . z + b_i): an input-convex network of one hidden layer (Amos, Xu & Kolter 2017;gthe softplus,w = softplus(.) >= 0) and a quadratic termA = L L^T, convex in(eps, alpha)jointly, zero with its gradient at the natural state (no stress, no thermodynamic force);the dissipation of a step
Phi(dalpha) = phi_1(dalpha) + dalpha . V dalpha / (2 tau)(tau = dt / s_t): withplastic, a rate-independent partphi_1, positively homogeneous of degree 1 beyond the smoothingdeltaand taken on the increment (the time step drops out),phi_1(v) = sum_k S(t_k(v)) - S(0) - c_k . v / 2,t_k = sum_j P_kj n_j(v) + c_k . v,n_j = sqrt(|B_j v|^2 + delta^2) - delta(smoothed norms),S(t) = (t + sqrt(t^2 + delta^2)) / 2(a smoothed ramp),P = softplus(.) >= 0: convex, zero with its gradient at zero, hence nonnegative, its elastic domain the support set ofphi_1sharpened at the scaledeltaof the increments; withrate, a viscous partV = M M^T(a quadratic potential of the rate).
The training fits the stresses along whole paths from the natural state: the gradient of
the objective goes through the minimization of each step by implicit differentiation (the
adjoint of a step solves K mu = lambda with K the Hessian of the incremental
potential in alpha) and back through the steps (lambda_n = d2 Phi mu_n, the next
state depending on the previous one through the dissipation only); the gradients of the
parameters are those of the derivatives of W and Phi along the adjoint directions,
written out and compiled by Numba (no automatic differentiation).
In finite strains (data of the Green-Lagrange strain E and the second Piola-Kirchhoff
stress S) the free energy is of an objective Lagrangian strain, psi(H, alpha):
strain="logarithmic"(the default):H = 1/2 ln C(C = I + 2 E), the space of the Hencky points of morphoGen (Miehe, Apel & Lambrecht 2002):T = d psi/dHandS = T : dH/dE = J^T T(J = dH/dE, 6 x 6, from the divided differences of1/2 lnin the eigenbasis ofC, Daleckii-Krein;morphogen.learning.logarithmic, the kernels of every learned law ofln C), the tangentdS/dE = J^T (dT/dH) J + T : d2H/dE2; internal variables additive inH(an isochoric flow of the logarithmic strain) represent isotropic multiplicative plasticity;strain="green-lagrange":H = E,S = d psi/dE, the tangent the Schur complement itself (positive definite inE).
Either way S : dE = T : dH, so that the dissipation of a step is the same
-d psi/d alpha . (alpha_{n+1} - alpha_n) >= 0 and S derives from psi(E)
(J does not depend on the parameters: the training sees the gaps of S through
J); a superposed rotation leaves C, hence S and the state, unchanged.
- morphogen.learning.standard.NEWTON_TOL = 1e-10¶
the tolerance of the gradient of the incremental potential (normalized forces), the iterations, the factor of Armijo’s condition
- Type:
Newton’s method of a step
- class morphogen.learning.standard.Standard(hidden: int = 32, *, internal: int = 8, rate: bool = False, plastic: bool = True, smoothing: float = 0.01, strain: str = 'logarithmic', seed: int = 0)[source]¶
Bases:
ModelA learned generalized standard material (see the module):
internal, the number of internal variables;hidden, the softplus ridges of its free energy;rate, a viscous dissipation (the time step matters);plastic, a rate-independent one (by default;ratealone gives viscoelasticity);smoothing, the scaledeltaof the normalized increments below which the rate-independent dissipation is smoothed;seed, that of its initial parameters. Its dissipation hasinternalsmoothed norms andinternalridges.strain: that of its free energy in finite strains (STRAINS), the logarithmic strain (the default) or the Green-Lagrange strain; in small strains the free energy is of the small strain, which both linearize to.- property n_state: int¶
The internal variables of a point (the state of a recurrent network).
- prepare(data: Dataset) tuple[source]¶
The normalized strains at the ends of the steps (paths x steps x 6), the normalized time steps (paths x steps) and the normalized stresses.
- objective(arrays, grad=True)[source]¶
The mean square of the gaps of the normalized stresses, and its gradients with respect to the parameters (with
grad).
- history(strain, times=None) dict[source]¶
The evolution of paths from the natural state (paths x points x 6, or one path): their
stress, internal variables (internal), free energy (energy, per unit volume) and the energy dissipated by each step (dissipation,-dpsi/ dalpha . dalpha, nonnegative to the round-off of Newton’s method), the first point the natural state; the consistenttangentof each step (its first point that of the natural state, not used); theiterationsof Newton’s method of each step (negative where it stopped without converging). In finite strains: the Green-Lagrange strains, the second Piola-Kirchhoff stresses and their tangentsdS/dE.
- predict(strain, times=None) ndarray[source]¶
The stresses of strains (…, 6); of a recurrent model, of paths (paths x points x 6, the first point the natural state, at the
times). In finite strains: the second Piola-Kirchhoff stresses of Green-Lagrange strains.
- tangent(strain)[source]¶
The tangents
d sigma / d eps(…, 6, 6) at strains (…, 6);dS/dEin finite strains.