Skip to content

hertzforge.core.stress_scalars

stress_scalars

Scalars of a stress tensor, and stress through modal superposition.

A stress tensor is held as its six components, xx, yy, zz, xy, yz, xz, the shear components being the tensor's own (not engineering strains). Its scalars are what a model is colored by: von Mises, Tresca, the three principal stresses, or one component.

Stress is linear in the modal coordinates, so an element's stress at an instant is the sum over modes of its stress shape times the mode's coordinate then, and a response never has to be stored point by point in time: the shapes are as large as the modes. Von Mises and the principal stresses are not linear, so they are formed from the summed tensor, never summed mode by mode.

These are the reference formulas. The 3-D view forms the same scalars each frame from the summed tensor (ui/src/lib/viz/stress.ts), and both are held to schema/golden/stress_scalars.json. The principal stresses here are the eigenvalues of the symmetric tensor; the shell uses the closed form through the invariants, so the two are independent checks of each other.

Functions:

Name Description
signed

Whether the scalar can be below zero, so its color scale runs from minus its peak.

von_mises

Von Mises stress of each tensor (..., 6): the square root of three times J2.

principal_stresses

The principal stresses of each tensor (..., 6) as (..., 3), largest first.

stress_scalar

One scalar of each tensor (..., 6): von Mises, Tresca, a principal stress or a component.

modal_stress

Each element's stress tensor from its stress shapes and the modal coordinates.

clip_peak

The largest value of a scalar over every element and every sample of a clip, its magnitude

mode_peaks

Each mode's largest value of a scalar over its elements and its cycle: a mode's own color

Functions:

signed

signed(scalar: str) -> bool

Whether the scalar can be below zero, so its color scale runs from minus its peak.

von_mises

von_mises(tensor: Any) -> ndarray

Von Mises stress of each tensor (..., 6): the square root of three times J2.

principal_stresses

principal_stresses(tensor: Any) -> ndarray

The principal stresses of each tensor (..., 6) as (..., 3), largest first.

stress_scalar

stress_scalar(tensor: Any, scalar: str) -> ndarray

One scalar of each tensor (..., 6): von Mises, Tresca, a principal stress or a component.

modal_stress

modal_stress(shapes: Any, coordinates: Any) -> ndarray

Each element's stress tensor from its stress shapes and the modal coordinates.

Args: shapes: (modes, elements, 6), each mode's stress per unit modal coordinate. coordinates: (modes,) at one instant, or (modes, samples) over a clip.

Returns: (elements, 6) for one instant, or (samples, elements, 6).

clip_peak

clip_peak(shapes: Any, coordinates: Any, scalar: str) -> float

The largest value of a scalar over every element and every sample of a clip, its magnitude for a scalar that can be negative: the top of a color scale every frame of the clip shares. The samples are summed a chunk at a time, so a long clip never holds every frame at once. NaN samples are passed over; 0.0 when nothing is finite.

mode_peaks

mode_peaks(shapes: Any, scalar: str, shapes_imag: Any = None) -> ndarray

Each mode's largest value of a scalar over its elements and its cycle: a mode's own color scale. A real mode's stress is its shape times the sine of the phase, so its peak is the shape's; a complex mode's tensor turns through its cycle, which is sampled at 64 points.