crashmetrics.materials¶
tensile
¶
Tensile test data for material cards: read, clean, properties.
The first step towards an LS-DYNA *MAT_PIECEWISE_LINEAR_PLASTICITY
(*MAT_024) card:
read_tensile: a tensile test from a CSV / text export or an Excel.xlsxfile, as force-elongation (with the specimen size) or as engineering stress-strain. Columns are found by their header names.TensileTest: engineering stress-strain curve of one specimen;TensileTest.from_force_elongationbuilds it from machine data.clean_tensile: cuts the curve after fracture, smooths noise and removes the toe region at the start (the initial non-linear part from specimen seating and slack), so the curve starts at the origin with the elastic slope.tensile_properties: Young's modulus (linear fit), offset yield strength Rp0.2, tensile strength Rm, uniform elongation and elongation after fracture, following the definitions of ISO 6892-1.
Units: stress in MPa (N/mm²), force in N, lengths in mm, strain dimensionless (mm/mm, not %). Young's modulus is in MPa (210 000 MPa for steel).
TensileTest
dataclass
¶
TensileTest(
strain: FloatArray,
stress: FloatArray,
name: str = "",
info: Mapping[str, object] = dict(),
)
Engineering stress-strain curve of one tensile specimen.
info
class-attribute
instance-attribute
¶
Specimen data, source file, columns and processing steps.
from_force_elongation
classmethod
¶
from_force_elongation(
force: ArrayLike,
elongation: ArrayLike,
*,
gauge_length: float,
area: float | None = None,
width: float | None = None,
thickness: float | None = None,
diameter: float | None = None,
name: str = "",
info: Mapping[str, object] | None = None,
) -> TensileTest
Engineering stress-strain from force (N) and elongation (mm).
stress = force / area with the original cross-section: give
area (mm²), width and thickness (flat specimen, mm) or
diameter (round specimen, mm). strain = elongation /
gauge_length (extensometer gauge length, mm).
TensileProperties
dataclass
¶
TensileProperties(
modulus: float,
modulus_r2: float,
yield_strength: float,
yield_strain: float,
offset: float,
tensile_strength: float,
uniform_elongation_total: float,
uniform_elongation: float,
fracture_strain_total: float,
elongation_after_fracture: float,
fracture_stress: float,
)
Tensile properties of one engineering stress-strain curve (ISO 6892-1 definitions).
yield_strength
instance-attribute
¶
Offset yield strength Rp (Rp0.2 by default), MPa.
tensile_strength
instance-attribute
¶
Tensile strength Rm (maximum engineering stress), MPa.
uniform_elongation_total
instance-attribute
¶
Agt: total engineering strain at Rm.
uniform_elongation
instance-attribute
¶
Ag: plastic engineering strain at Rm, Agt - Rm / E.
fracture_strain_total
instance-attribute
¶
At: total engineering strain at the end of the curve (fracture, if the curve was cut there).
elongation_after_fracture
instance-attribute
¶
A: plastic engineering strain at fracture, At - stress / E.
fracture_stress
instance-attribute
¶
Engineering stress at the end of the curve, MPa.
read_tensile
¶
read_tensile(
path: str | Path,
*,
strain: Column | None = None,
stress: Column | None = None,
force: Column | None = None,
elongation: Column | None = None,
gauge_length: float | None = None,
area: float | None = None,
width: float | None = None,
thickness: float | None = None,
diameter: float | None = None,
strain_unit: str | None = None,
stress_unit: str | None = None,
force_unit: str | None = None,
elongation_unit: str | None = None,
sheet: str | int | None = None,
delimiter: str | None = None,
decimal: str | None = None,
name: str | None = None,
) -> TensileTest
Read a tensile test from a CSV / text file or an .xlsx file.
Give either engineering strain and stress columns, or
force and elongation columns with gauge_length and the
cross-section (area, width and thickness, or
diameter; see TensileTest.from_force_elongation). Columns are
header names (case-insensitive; a unique part of the name is
enough) or 0-based indices. Without any column names, columns whose
headers contain "stress" and "strain" (or "force"/"load" and
"elongation"/"extension"/"displacement") are used.
All text rows above the data are read as headers, so a units row
under the names is fine. Units are taken from the header when they
appear there (for example Strain [%], Force (kN)), or from
the *_unit arguments: strain "-" or "%"; stress
"MPa", "GPa", "Pa"; force "N" or "kN";
elongation "mm" or "m".
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
|
required |
sheet
|
str | int | None
|
Worksheet name or 0-based index ( |
None
|
delimiter
|
str | None
|
Text files: the column separator (default: detected). |
None
|
decimal
|
str | None
|
|
None
|
name
|
str | None
|
Specimen name (default: the file name). |
None
|
Returns:
| Type | Description |
|---|---|
TensileTest
|
With |
clean_tensile
¶
clean_tensile(
test: TensileTest,
*,
cut_fracture: bool = True,
fracture_drop: float = 0.1,
smooth: int = 0,
toe: bool = True,
modulus_window: tuple[float, float] = (0.1, 0.4),
modulus_stress: tuple[float, float] | None = None,
) -> TensileTest
Clean an engineering stress-strain curve, in this order:
- Cut after fracture (
cut_fracture): the curve ends at the last point before the first sudden stress drop after the maximum, a drop larger thanfracture_droptimes the maximum stress from one point to the next (default 10 %), or where the stress falls below 10 % of the maximum. - Smooth (
smooth, odd number of points, 0 = off): Savitzky- Golay filter (quadratic) on the stress. Use the smallest window that removes the noise; it rounds sharp yield points. - Toe correction (
toe, as ISO 6892-1): a straight line is fitted to the loading curve betweenmodulus_windowfractions of the maximum stress (or betweenmodulus_stressin MPa). The strain is shifted so the line passes through the origin, the points below the window are replaced by the origin, and the curve then rises with the fitted slope.
Returns a new TensileTest; info["cleaning"] records what was
done (cut point, strain shift, points removed).
tensile_properties
¶
tensile_properties(
test: TensileTest,
*,
modulus_window: tuple[float, float] = (0.1, 0.4),
modulus_stress: tuple[float, float] | None = None,
offset: float = 0.002,
) -> TensileProperties
Young's modulus, Rp, Rm, uniform elongation and elongation after fracture of an engineering stress-strain curve.
- E: least-squares line through the loading curve between
modulus_windowfractions of Rm (default 10-40 %), or betweenmodulus_stress(MPa) if given. - Rp: first intersection of the curve with the fitted line moved
by
offsetin strain (Rp0.2 with the default 0.002), linearly interpolated between samples. The line keeps its fitted intercept, so a toe region does not shift Rp. - Rm, Agt, Ag: maximum stress, total and plastic strain there.
- At, A: total and plastic strain at the last point. Cut the
curve at fracture first (
clean_tensile).
corrections
¶
Corrections of tensile curves: Lüders plateau and machine compliance.
luders_plateau: finds discontinuous yielding (the Lüders plateau of mild and some micro-alloyed steels): upper yield strength ReH, lower yield strength ReL and the yield point elongation Ae (ISO 6892-1 definitions).smooth_luders: prepares such a curve for a*MAT_024card, which cannot represent the plateau: either a flat line at ReL in place of the spike and the oscillations (mode="flat"), or the plateau removed so hardening starts at the yield point (mode="remove").correct_compliance: removes the machine and grip compliance from a strain measured with the cross-head travel (no extensometer), using a known Young's modulus.
Units: stress MPa, strain dimensionless, compliance mm/N.
LudersPlateau
dataclass
¶
LudersPlateau(
upper_yield: float,
lower_yield: float,
start_strain: float,
end_strain: float,
band: float,
)
Discontinuous yielding of a tensile curve (ISO 6892-1 terms).
upper_yield
instance-attribute
¶
ReH: stress at the first drop of force after yielding, MPa.
lower_yield
instance-attribute
¶
ReL: lowest stress during the plateau, the initial transient minimum after ReH ignored, MPa.
start_strain
instance-attribute
¶
Strain at ReH, where discontinuous yielding starts.
end_strain
instance-attribute
¶
Strain where uniform work hardening starts: from here on the
stress stays above ReL * (1 + band).
luders_plateau
¶
luders_plateau(
test: TensileTest,
*,
drop: float = 0.01,
band: float = 0.02,
min_elongation: float = 0.002,
) -> LudersPlateau | None
Find a Lüders plateau; None if the material yields continuously.
- ReH: the running maximum of the stress at the first point
where the stress falls more than
drop(fraction, default 1 %) below it, before the tensile strength. - ReL: the lowest stress between ReH and the point where the stress first returns to ReH (or to Rm). As ISO 6892-1, the initial transient dip straight after ReH (up to where the curve first reaches the median stress of that range) is ignored when the plateau dips again later; otherwise that dip is ReL.
- End of the plateau (start of uniform work hardening): the
point from which the stress stays above
ReL * (1 + band)(default 2 %) up to Rm.
A plateau shorter than min_elongation (default 0.2 % strain) is
treated as noise and None is returned. Smooth noisy data first
(crashmetrics.materials.clean_tensile, smooth=), with a short
window so the yield point is not rounded away.
smooth_luders
¶
smooth_luders(
test: TensileTest,
plateau: LudersPlateau | None = None,
*,
mode: Literal["flat", "remove"] = "flat",
**find: float,
) -> TensileTest
Replace the Lüders plateau for use in a material card.
The plateau (plateau, or found with luders_plateau and the
keyword arguments in find) is replaced from the point where the
loading line reaches ReL to the end of the plateau:
mode="flat": a straight line at ReL. The upper yield spike and the oscillations go; the plateau strain stays (the card then has a perfectly plastic start).mode="remove": the plateau strain is taken out and the hardening curve moved back to the yield point, so hardening starts at ReL. Common for crash cards: the plateau is a local, band-propagation effect that a*MAT_024element cannot reproduce.
Returns the curve unchanged (with a note in info) when there is
no plateau.
correct_compliance
¶
correct_compliance(
test: TensileTest,
modulus: float,
*,
modulus_window: tuple[float, float] = (0.1, 0.4),
modulus_stress: tuple[float, float] | None = None,
) -> TensileTest
Remove the machine and grip compliance from a cross-head strain.
Without an extensometer the measured elongation includes the
deflection of the frame, load cell and grips, so the elastic slope
comes out too low (often 50-150 GPa for steel). With the material's
real Young's modulus modulus (MPa, for example 210 000 for steel)
the extra strain is removed at every point:
strain_corrected = strain - stress * (1 / E_measured - 1 / E)
where E_measured is fitted on the loading curve as in
crashmetrics.materials.tensile_properties. This assumes a linear
machine; the toe region should be corrected after this
(crashmetrics.materials.clean_tensile). When the test was built
from force and elongation, info["compliance_mm_per_n"] gives the
machine compliance C = (1 / E_measured - 1 / E) * L0 / S0.
Strains past necking are local and not corrected by this; use them
with care.
specimens
¶
Several specimens of one material: mean curve and scatter.
mean_curve: the mean engineering stress-strain curve of several tests, with standard deviation, minimum and maximum at each strain;MeanCurve.as_testcontinues the material-card chain with it.property_scatter: mean, standard deviation and coefficient of variation of the tensile properties (E, Rp0.2, Rm, Ag, A).
Clean the curves first (crashmetrics.materials.clean_tensile): with
the toe removed they all start at the origin, so they are aligned.
Units: stress MPa, strain dimensionless.
MeanCurve
dataclass
¶
MeanCurve(
strain: FloatArray,
mean: FloatArray,
std: FloatArray,
minimum: FloatArray,
maximum: FloatArray,
names: tuple[str, ...],
)
Mean of several engineering stress-strain curves on one strain grid.
std
instance-attribute
¶
Sample standard deviation of the stress, MPa (0 for one test).
PropertyScatter
dataclass
¶
mean_curve
¶
mean_curve(
tests: Sequence[TensileTest],
*,
points: int = 300,
strain_max: float | None = None,
) -> MeanCurve
Mean curve of several tests on a common strain grid.
Each curve is interpolated linearly at points strains from 0 to
strain_max (default: the end of the shortest curve, so every
test contributes at every strain). Averaging after necking mixes
different local strains; for a card, use the mean up to the
uniform elongation and extrapolate from there.
property_scatter
¶
property_scatter(
tests: Sequence[TensileTest], **options: object
) -> dict[str, PropertyScatter]
Scatter of E, Rp, Rm, Ag and A over several tests.
options go to crashmetrics.materials.tensile_properties
(modulus_window, offset ...). Use scatter_summary for a
text table.
scatter_summary
¶
scatter_summary(
scatter: Mapping[str, PropertyScatter],
) -> str
Text table of property_scatter (mean, std, CV, min, max).
hardening
¶
Hardening curve for *MAT_024: true stress, necking, plastic strain,
extrapolation.
*MAT_PIECEWISE_LINEAR_PLASTICITY needs true stress against effective
plastic strain, from the yield point to large strains (crash elements
reach 50-100 % plastic strain), while a tensile test gives a valid curve
only up to necking. The steps:
true_curve: engineering -> true stress-strain,eps = ln(1 + e),sigma = s (1 + e), valid up to necking.necking_point: necking at the maximum engineering stress (Considère:d sigma / d eps = sigma), located between samples.plastic_curve: true stress against effective plastic straineps_p = eps - sigma / Efrom the yield point to necking: the measured part of the card curve.fit_hardening: Swift, Voce, Hockett-Sherby and Swift-Voce laws fitted to it, with the fit error and the Considère check at necking;compare_fitsshows how far the laws part beyond necking.extrapolate_curve: measured curve up to necking, the chosen law beyond it.n_value: strain-hardening exponent n and strength coefficient K (Hollomon fitsigma = K eps^n).
Units: stress MPa, strain dimensionless; laws use true stress and effective plastic strain.
LAWS
module-attribute
¶
LAWS: dict[str, str] = {
"swift": "sigma = K (eps0 + eps_p)^n",
"voce": "sigma = sigma0 + Q (1 - exp(-beta eps_p))",
"hockett_sherby": "sigma = sigma_s - (sigma_s - sigma0) exp(-a eps_p^m)",
"swift_voce": "sigma = alpha Swift + (1 - alpha) Voce",
}
Hardening laws of fit_hardening (true stress, effective plastic
strain). Swift keeps hardening (power law); Voce and Hockett-Sherby
saturate; Swift-Voce lies between.
TrueCurve
dataclass
¶
NeckingPoint
dataclass
¶
NeckingPoint(
engineering_strain: float,
engineering_stress: float,
true_strain: float,
true_stress: float,
considere_ratio: float,
)
Onset of necking (diffuse necking, maximum force).
considere_ratio
instance-attribute
¶
(d sigma / d eps) / sigma of the true curve around necking
(linear fit over the window); about 1 by the Considère criterion.
Far from 1: the maximum is poorly defined (noise, few points).
HardeningCurve
dataclass
¶
HardeningCurve(
plastic_strain: FloatArray,
stress: FloatArray,
modulus: float,
necking_strain: float,
name: str = "",
info: Mapping[str, object] = dict(),
)
True stress against effective plastic strain: the *MAT_024
hardening curve (LCSS).
HardeningFit
dataclass
¶
HardeningFit(
law: str,
params: dict[str, float],
rms: float,
r2: float,
fit_range: tuple[float, float],
considere_ratio: float,
_x: tuple[float, ...] = (),
)
A hardening law fitted to the measured plastic curve.
considere_ratio
instance-attribute
¶
(d sigma / d eps_true) / sigma of the law at the necking
strain: 1 if the law reproduces the onset of necking. Below 1: the
law hardens too little there (necking too early in a simulation of
the test); above 1: too much.
stress
¶
Stress of the law at the given plastic strains, MPa.
slope
¶
d sigma / d eps_p of the law, MPa (central difference).
NValue
dataclass
¶
Hollomon fit sigma = K eps^n of the true curve.
true_curve
¶
true_curve(
test: TensileTest, *, after_necking: bool = False
) -> TrueCurve
True stress and strain from the engineering curve.
The conversion assumes uniform deformation at constant volume, which
holds up to necking (the maximum engineering stress). Points after
necking are dropped unless after_necking=True (then they are
only nominal: the real strain in the neck is larger).
necking_point
¶
necking_point(
test: TensileTest, *, window: float = 0.02
) -> NeckingPoint
Necking at the maximum engineering stress.
The maximum is located between samples by a parabola through the
points within window engineering strain around the largest stress
(default 2 %, that is ±1 %), which also averages out noise on the
flat top. The Considère ratio is the slope of the true curve over the
same points divided by the true stress there.
plastic_curve
¶
plastic_curve(
test: TensileTest,
*,
start: Literal["offset", "zero"] = "offset",
offset: float = 0.002,
modulus: float | None = None,
) -> HardeningCurve
True stress against effective plastic strain, yield to necking.
eps_p = ln(1 + e) - sigma / E with E fitted on the curve
(crashmetrics.materials.tensile_properties) unless modulus is
given.
start="offset"(default): the curve starts at the offset yield point (plastic strainoffset, 0.2 % for Rp0.2), and the plastic strain is counted from there, so the first point is(0, yield stress)as*MAT_024expects. The gradual elastic-plastic transition below Rp0.2 is left out.start="zero": the plastic strain as computed, from the first point where it becomes positive (the curve starts at the end of the linear part).
Points where the plastic strain does not increase (noise) are
dropped. Clean the curve first (clean_tensile), and handle a Lüders
plateau (smooth_luders).
fit_hardening
¶
fit_hardening(
curve: HardeningCurve,
laws: Sequence[str] = (
"swift",
"voce",
"hockett_sherby",
"swift_voce",
),
*,
fit_range: tuple[float, float] | None = None,
) -> dict[str, HardeningFit]
Fit hardening laws (LAWS) to the measured plastic curve.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
curve
|
HardeningCurve
|
From |
required |
laws
|
Sequence[str]
|
Laws to fit. |
('swift', 'voce', 'hockett_sherby', 'swift_voce')
|
fit_range
|
tuple[float, float] | None
|
Plastic strain range (default: the whole curve, yield to necking). Starting above the yield region (for example at 0.02) often extrapolates better when the transition after yield is not of the law's shape. |
None
|
Returns:
| Type | Description |
|---|---|
dict
|
Law name -> |
compare_fits
¶
compare_fits(
fits: Mapping[str, HardeningFit],
strains: Sequence[float] = (0.1, 0.2, 0.5, 1.0),
) -> str
Text table: fit error, Considère ratio and stress of each law at
strains (plastic). The laws agree up to necking and part beyond
it; the spread at large strain is what the choice of law decides.
extrapolate_curve
¶
extrapolate_curve(
curve: HardeningCurve,
fit: HardeningFit,
*,
strain_max: float = 1.0,
points: int = 40,
continuous: bool = True,
) -> HardeningCurve
Measured curve up to necking, the fitted law beyond.
points law points are spaced from the necking strain to
strain_max (plastic). With continuous=True the law is
shifted by the small stress difference at necking so the curve has
no step there.
n_value
¶
n_value(
test: TensileTest,
*,
strain_range: tuple[float, float | None] = (0.1, None),
strain: Literal["total", "plastic"] = "total",
modulus: float | None = None,
) -> NValue
Strain-hardening exponent n and strength coefficient K.
Least-squares line through ln(true stress) against
ln(true strain) over an engineering strain range (default from
10 % to the uniform elongation Ag, "n10-Ag"; give for example
(0.10, 0.20) for n10-20). strain="plastic" uses the true
plastic strain (elastic part removed with modulus or the fitted
E) instead of the total true strain; ISO 10275 and ASTM E646 give the
exact definitions for certificates.
rate
¶
Strain-rate dependence for *MAT_024: fits, rate tables, checks.
Crash structures deform at 10-1000 /s, where steels are 10-30 % stronger
than in a quasi-static test. *MAT_PIECEWISE_LINEAR_PLASTICITY takes
the rate effect in one of two ways:
- Cowper-Symonds (fields C and P of the card): the whole curve scaled
by
1 + (rate / C)^(1/P).fit_cowper_symondsfits C and P to tests at several rates. - A rate table (LCSS pointing to a
*DEFINE_TABLE): one hardening curve per strain rate.rate_table_from_curvesbuilds it from tests,rate_table_from_modelfrom a static curve and a fitted rate law;RateTable.keywordwrites the*DEFINE_TABLEand its curves.
fit_johnson_cook_rate fits the Johnson-Cook rate term
1 + c ln(rate / rate0) as an alternative law, and
RateTable.check finds the table errors that make simulations noisy or
wrong: crossing curves, rates not increasing, softening curves, rates
LS-DYNA would read in the wrong form.
Units: strain rate in 1/s, stress in MPa (true stress, effective plastic
strain). RateTable.keyword converts to the model's unit system.
UNIT_SYSTEMS
module-attribute
¶
UNIT_SYSTEMS: dict[str, tuple[float, float]] = {
"mm-ms-kg": (0.001, 0.001),
"mm-s-t": (1.0, 1.0),
"mm-s-kg": (1000.0, 1.0),
"m-s-kg": (1000000.0, 1.0),
}
LS-DYNA unit system -> (stress per MPa, time per s). Stress units: GPa in mm-ms-kg, MPa in mm-s-t, kPa in mm-s-kg, Pa in m-s-kg; strain rates are divided by the time factor (1/s -> 1/ms in mm-ms-kg).
CowperSymonds
dataclass
¶
Cowper-Symonds rate law sigma = sigma_static (1 + (rate / C)^(1/P)).
JohnsonCookRate
dataclass
¶
Johnson-Cook rate term sigma = sigma_ref (1 + c ln(rate / rate0)).
RateCheck
dataclass
¶
RateTable
dataclass
¶
RateTable(
rates: FloatArray,
plastic_strain: FloatArray,
stress: FloatArray,
info: Mapping[str, object] = dict(),
)
Hardening curves at several strain rates on one plastic strain grid.
check
¶
check(
*, log_rates: bool = False, unit_system: str = "mm-s-t"
) -> RateCheck
Check the table as LS-DYNA would use it.
Errors: rates not strictly increasing; a curve below the curve
of a lower rate at any strain (crossing curves give a negative
rate sensitivity and noisy, mesh-dependent results); a curve not
starting at zero plastic strain; with log_rates a first rate
whose natural log is not negative in the model's time unit
(LS-DYNA then reads all values as plain rates). Warnings:
softening (stress decreasing along a curve), widely spaced rates
in a linear table, a first rate above 0.01 /s.
keyword
¶
keyword(
table_id: int,
*,
unit_system: str = "mm-s-t",
log_rates: bool = False,
first_curve_id: int | None = None,
title: str = "",
) -> str
*DEFINE_TABLE followed by its *DEFINE_CURVE cards.
Rates are converted to the model's time unit and stresses to its
stress unit (UNIT_SYSTEMS); with log_rates the table holds
ln(rate). The curves get IDs first_curve_id (default
table_id + 1) upward and follow the table directly, as
LS-DYNA requires. Reference the table as LCSS of *MAT_024
(and leave C and P at zero).
fit_cowper_symonds
¶
fit_cowper_symonds(
curves: Mapping[float, HardeningCurve],
*,
strains: Sequence[float] | None = None,
reference_rate: float | None = None,
) -> CowperSymonds
Fit Cowper-Symonds C and P to hardening curves at several rates.
curves maps strain rate (1/s) to the plastic curve of that test
(crashmetrics.materials.plastic_curve). The stress of each curve
over the reference curve (the lowest rate unless
reference_rate) is taken at strains (plastic; default the
yield point and five strains up to 90 % of the smallest necking
strain), and C and P are fitted to these ratios by least squares,
accounting for the reference rate not being zero.
The *MAT_024 C and P scale the whole curve by the same factor at
every strain; if the measured ratio changes much with strain, a rate
table (rate_table_from_curves) represents the tests better.
fit_johnson_cook_rate
¶
fit_johnson_cook_rate(
curves: Mapping[float, HardeningCurve],
*,
strains: Sequence[float] | None = None,
reference_rate: float | None = None,
) -> JohnsonCookRate
Fit the Johnson-Cook rate constant c (least squares through the
origin of ratio - 1 against ln(rate / rate0)). Arguments as
fit_cowper_symonds.
rate_table_from_model
¶
rate_table_from_model(
curve: HardeningCurve,
law: CowperSymonds | JohnsonCookRate,
rates: Sequence[float],
*,
points: int = 50,
strain_max: float | None = None,
) -> RateTable
Rate table from the reference curve scaled by a fitted rate law.
curve is the (extrapolated) curve at the law's reference rate;
each rate's curve is curve * law.ratio(rate). The curves are
resampled at points plastic strains up to strain_max
(default: the end of curve), denser near yield.
rate_table_from_curves
¶
rate_table_from_curves(
curves: Mapping[float, HardeningCurve],
*,
points: int = 50,
strain_max: float | None = None,
) -> RateTable
Rate table from one (extrapolated) curve per strain rate.
Every curve is interpolated at points plastic strains up to
strain_max (default: the end of the shortest curve). Check the
result (RateTable.check): curves fitted separately easily cross
after necking.
card
¶
Write *MAT_PIECEWISE_LINEAR_PLASTICITY (*MAT_024) cards.
Mat024 holds one material in engineering units (density kg/m³, stress
and modulus MPa, strain rates 1/s) with its hardening curve
(crashmetrics.materials.HardeningCurve) or strain-rate table
(crashmetrics.materials.RateTable), and writes it for an LS-DYNA unit
system:
Mat024.keyword: the material card followed by its*DEFINE_CURVEor*DEFINE_TABLE(fixed 10- and 20-character fields).Mat024.write: an include file with a header recording where the card came from (provenance), the unit system and the date.failure_strain: a simple element-size dependent plastic strain at failure (FAIL), andfracture_strainfrom the reduction of area. A rough approach; damage models such as GISSMO describe failure far better.
Unit systems (UNIT_SYSTEMS): "mm-ms-kg" (GPa, kg/mm³, 1/ms),
"mm-s-t" (MPa, t/mm³, 1/s), "mm-s-kg" (kPa, kg/mm³, 1/s),
"m-s-kg" (Pa, kg/m³, 1/s).
DENSITY_SCALE
module-attribute
¶
DENSITY_SCALE: dict[str, float] = {
"mm-ms-kg": 1e-09,
"mm-s-t": 1e-12,
"mm-s-kg": 1e-09,
"m-s-kg": 1.0,
}
Density in the unit system per kg/m³ (7850 kg/m³ = 7.85e-6 kg/mm³ = 7.85e-9 t/mm³).
Mat024
dataclass
¶
Mat024(
mid: int,
density: float,
modulus: float,
curve: HardeningCurve | None = None,
table: RateTable | None = None,
poisson: float = 0.3,
c: float = 0.0,
p: float = 0.0,
vp: int = 0,
fail: float = 0.0,
tdel: float = 0.0,
curve_id: int | None = None,
title: str = "",
provenance: Mapping[str, object] = dict(),
)
One *MAT_PIECEWISE_LINEAR_PLASTICITY material.
Give the hardening as curve (one curve; optional Cowper-Symonds
c and p) or as table (a strain-rate table; then c
and p must stay 0, as both would scale the stress).
vp
class-attribute
instance-attribute
¶
0: scale the yield stress with the rate (default); 1: viscoplastic formulation.
fail
class-attribute
instance-attribute
¶
Plastic strain at failure (0: no failure).
tdel
class-attribute
instance-attribute
¶
Minimum time step for element deletion, s (converted on writing).
curve_id
class-attribute
instance-attribute
¶
ID of the curve or table (default mid + 1000).
provenance
class-attribute
instance-attribute
¶
Where the card came from (tests, fits, author); written in the include file header.
yield_stress
property
¶
SIGY: the first stress of the curve (of the lowest-rate curve of a table), MPa.
stress
¶
True stress (MPa) the card gives at plastic strains and a strain rate (1/s).
- Curve: interpolated, the last segment extended linearly beyond
the end (as LS-DYNA extrapolates); with C and P, scaled by
1 + (rate / C)^(1/P)(no scaling forrate=None). - Table: the lowest-rate curve for
rate=None; otherwise interpolated between the two neighbouring curves in ln(rate), and the end curves beyond the table.
keyword
¶
keyword(
unit_system: str = "mm-ms-kg",
*,
points: int | None = 50,
log_rates: bool = True,
) -> str
The material card and its curve or table, in unit_system.
A single curve is resampled at points plastic strains (denser
near yield, the necking point kept; None keeps the curve's own
points); a table keeps its own grid. TDEL is converted from s.
log_rates applies to a table (ln of the rates).
write
¶
write(
path: str | Path,
unit_system: str = "mm-ms-kg",
*,
points: int | None = 50,
log_rates: bool = True,
date: date | None = None,
damage: _Damage | None = None,
) -> Path
Write an include file: header, *KEYWORD, the card, *END.
The header names crashmetrics and its version, the unit system,
the date (date, default today) and every provenance entry.
damage (a crashmetrics.materials.GissmoCard with the same MID)
is written after the card.
keyword_number
¶
A number right-aligned in a fixed keyword field, with as many
significant digits as fit while keeping one leading blank
(7.85e-6, 210.0, 0.3).
fracture_strain
¶
True strain at fracture from the reduction of area Z (fraction,
0.55 for 55 %): ln(1 / (1 - Z)). It is the strain in the neck,
measured on the broken specimen.
failure_strain
¶
failure_strain(
*,
uniform: float,
fracture: float,
element_size: float,
neck_length: float,
) -> float
Plastic strain at failure (FAIL) for an element of a given size.
The strain to fracture is reached only over the neck (length about the sheet thickness); an element larger than the neck averages it with the uniformly strained material around:
FAIL = uniform + (fracture - uniform) * min(1, neck_length / element_size)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
uniform
|
float
|
Plastic strain at necking ( |
required |
fracture
|
float
|
Local plastic strain at fracture ( |
required |
element_size
|
float
|
Element edge length and neck length (about the thickness), mm. |
required |
neck_length
|
float
|
Element edge length and neck length (about the thickness), mm. |
required |
Notes
A rough size regularisation for simple element deletion: it ignores the stress state (triaxiality). Use it for screening, and a damage model (GISSMO) for failure predictions.
gissmo
¶
Failure with GISSMO: calibration and *MAT_ADD_DAMAGE_GISSMO.
GISSMO (Neukamm, Feucht, Haufe) accumulates damage along the loading path of every integration point:
dD = n D^(1 - 1/n) d eps_p / eps_f(eta), failure at D = 1
with eps_f(eta) the failure strain as a function of stress
triaxiality eta = sigma_m / sigma_vm (LCSDG) and n the damage
exponent (DMGEXP). An instability measure F accumulates the same way
against the critical strain eps_crit(eta) (ECRIT); when F reaches
1 the damage D_crit at that moment starts the stress fade-out
sigma* = sigma (1 - ((D - D_crit) / (1 - D_crit))^m)
with the fading exponent m (FADEXP). For any path,
D^(1/n) = integral of d eps_p / eps_f(eta), so the strain at fracture
does not depend on n; n shapes D and with it D_crit.
This module:
- Stress states (plane stress, von Mises, proportional loading):
TRIAXIALITYof the standard tests,triaxiality_from_strain_ratio,plane_stress_strains(major / minor strain -> triaxiality and equivalent strain, for forming limits and DIC),lode_parameter,average_triaxiality. - Failure curve:
FractureTest(a fracture point, optionally with its measured path) andfit_failure_curvewith the Hosford-Coulomb, Johnson-Cook or a tabulated model, fitted so that D reaches 1 exactly at the measured fracture of every test. - Instability curve from a forming limit curve
(
instability_from_flc) or the necking strain. - Regularisation:
regularization_estimate(first estimate of the element size factors LCREGD),RegularizationCurve. integrate_damage: D, F and the stress fading factor along any path (for checks and plots).GissmoCard: the*MAT_ADD_DAMAGE_GISSMOcard with its curves in any unit system, with checks; add it to a*MAT_024include withMat024.write(..., damage=card).
Strains are equivalent plastic strains; element sizes in mm; strain rates in 1/s.
TRIAXIALITY
module-attribute
¶
TRIAXIALITY: dict[str, float] = {
"uniaxial_compression": -1.0 / 3.0,
"shear": 0.0,
"uniaxial": 1.0 / 3.0,
"plane_strain": 1.0 / math.sqrt(3.0),
"equibiaxial": 2.0 / 3.0,
}
Stress triaxiality of the standard plane-stress states (von Mises).
FAILURE_MODELS
module-attribute
¶
FAILURE_MODELS: dict[str, str] = {
"hosford_coulomb": "b (1 + c)^(1/n) [Hosford_a(eta) + c (2 eta + f1 + f3)]^(-1/n)",
"johnson_cook": "d1 + d2 exp(d3 eta)",
"tabulated": "piecewise linear through the tests, constant beyond",
}
Failure strain models of fit_failure_curve. Hosford-Coulomb (Roth
and Mohr) in plane stress, with the Lode parameter from the triaxiality:
b is the fracture strain in uniaxial and equibiaxial tension, a
the Hosford exponent, c the friction coefficient, n fixed (0.1
by default).
FractureTest
dataclass
¶
FractureTest(
name: str,
fracture_strain: float,
triaxiality: float | None = None,
path_strain: FloatArray | None = None,
path_triaxiality: FloatArray | None = None,
weight: float = 1.0,
)
One fracture test: equivalent plastic strain at fracture and its stress state.
Give triaxiality for proportional loading (or the average), or
the measured / simulated path (path_strain, path_triaxiality
from the start of plasticity to fracture), which the fit integrates.
FailureFit
dataclass
¶
FailureFit(
model: str,
params: dict[str, float],
tests: tuple[FractureTest, ...],
predicted: tuple[float, ...],
_table: tuple[tuple[float, ...], tuple[float, ...]] = (
(),
(),
),
)
RegularizationCurve
dataclass
¶
Element size dependent factors on the failure strain (LCREGD).
DamageHistory
dataclass
¶
DamageHistory(
plastic_strain: FloatArray,
damage: FloatArray,
instability: FloatArray,
fading: FloatArray,
critical_damage: float,
coupling_strain: float,
fracture_strain: float,
)
GISSMO quantities along a loading path.
instability
instance-attribute
¶
F (NaN without an instability curve or constant).
fading
instance-attribute
¶
Stress factor 1 - ((D - D_crit) / (1 - D_crit))^m after
coupling starts, 1 before; 0 at failure.
coupling_strain
instance-attribute
¶
Plastic strain where coupling starts (F = 1), NaN if not reached.
fracture_strain
instance-attribute
¶
Plastic strain at D = 1, NaN if not reached on the path.
GissmoCard
dataclass
¶
GissmoCard(
mid: int,
failure: tuple[FloatArray, FloatArray] | FailureFit,
instability: tuple[FloatArray, FloatArray]
| float
| None = None,
dmgexp: float = 1.0,
dcrit: float = 0.0,
fadexp: float | tuple[FloatArray, FloatArray] = 1.0,
regularization: RegularizationCurve | None = None,
rate_scaling: tuple[FloatArray, FloatArray]
| None = None,
scale_instability_with_rate: bool = True,
dtyp: int = 1,
numfip: float = 1.0,
refsz: float = 0.0,
shrf: float = 0.0,
biaxf: float = 0.0,
triaxiality_range: tuple[float, float] = (
-2.0 / 3.0,
2.0 / 3.0,
),
points: int = 41,
first_curve_id: int | None = None,
)
One *MAT_ADD_DAMAGE_GISSMO card with its curves.
failure and instability are given as (triaxiality, strain)
arrays (or failure as a FailureFit, sampled on
triaxiality_range); instability may be a constant critical
strain or None (then dcrit sets the coupling: 0 means none).
fadexp is a constant or (element size mm, exponent) arrays.
Element sizes in mm and strain rates in 1/s are converted on writing.
Fields after LCREGD (card 2) and BIAXF (card 3) are left blank
(LS-DYNA defaults); SHRF and BIAXF are passed through as given.
rate_scaling
class-attribute
instance-attribute
¶
(strain rates 1/s, factors on the failure strain).
refsz
class-attribute
instance-attribute
¶
Reference element size for extra damage output, mm (0: none).
shrf
class-attribute
instance-attribute
¶
LS-DYNA's reduction factor of the regularisation in shear (eta 0); written as given, not modelled here.
biaxf
class-attribute
instance-attribute
¶
The same in equibiaxial tension (eta 2/3).
first_curve_id
class-attribute
instance-attribute
¶
IDs of the curves from here up (default mid + 2000).
failure_curve
¶
(triaxiality, failure strain) as written to LCSDG.
instability_curve
¶
(triaxiality, critical strain) as written to ECRIT, or None for a constant or no instability.
failure_strain
¶
failure_strain(
triaxiality: ArrayLike,
element_size: float | None = None,
rate: float | None = None,
) -> FloatArray
Failure strain the card gives (curve interpolated, constant
beyond its ends; times the regularisation factor at
element_size and the rate factor at rate; SHRF and BIAXF
not modelled).
critical_strain
¶
Critical (instability) strain the card gives, or None.
damage
¶
damage(
plastic_strain: ArrayLike,
triaxiality: ArrayLike,
*,
element_size: float | None = None,
) -> DamageHistory
integrate_damage with this card's curves and parameters (a
fading-exponent curve is read at element_size, or at its first
size when none is given).
curve_ids
¶
IDs of the written curves: failure, instability, regularization, fading, rate (only those present).
check
¶
(errors, warnings) of the card.
Errors: non-positive failure or critical strains; triaxiality not increasing; regularisation, fading or rate factors not positive. Warnings: failure curve not covering shear to equibiaxial tension (0 to 2/3); critical strain at or above the failure strain (no fading there: brittle failure under full stress), or, from some element size, at or above the regularised failure strain; DMGEXP below 1; regularisation factors rising with element size; no coupling at all (ECRIT and DCRIT 0).
keyword
¶
The card and its curves in unit_system (element sizes and
strain rates converted; strains and triaxialities have no unit).
Raises if check finds errors.
triaxiality_from_strain_ratio
¶
Triaxiality of proportional plane-stress loading with strain ratio
beta = eps2 / eps1 (von Mises, plastic incompressibility):
(1 + beta) / (sqrt(3) sqrt(1 + beta + beta^2)). -0.5 uniaxial
(1/3), 0 plane strain (0.577), 1 equibiaxial (2/3), -1 shear (0).
plane_stress_strains
¶
Triaxiality and equivalent plastic strain from major and minor
in-plane (true, plastic) strains of proportional plane-stress
loading, for example points of a forming limit curve or DIC fracture
strains: eps_eq = 2 / sqrt(3) eps1 sqrt(1 + beta + beta^2).
lode_parameter
¶
Normalised Lode angle parameter of plane stress,
1 - (2/pi) arccos(-27/2 eta (eta^2 - 1/3)): 1 uniaxial tension,
0 shear and plane strain, -1 equibiaxial tension (clipped outside
-2/3 to 2/3, where plane stress is not possible).
average_triaxiality
¶
Strain-weighted average triaxiality of a path,
(1 / eps_f) integral eta d eps_p (trapezoidal rule).
fit_failure_curve
¶
fit_failure_curve(
tests: Sequence[FractureTest],
model: Literal[
"hosford_coulomb", "johnson_cook", "tabulated"
] = "hosford_coulomb",
*,
hc_exponent: float = 0.1,
) -> FailureFit
Fit a failure curve so that D reaches 1 at every test's fracture.
The residual of a test is ln(integral d eps / eps_f(eta)) along
its path (proportional at its triaxiality if no path is given): 0
when the curve predicts fracture exactly at the measured strain, and
for proportional loading equal to the log of the measured over the
curve's failure strain. Least squares (weighted), NumPy only.
"hosford_coulomb": a, b, c fitted, n =hc_exponent; needs 3 or more tests with different stress states."johnson_cook": d1, d2, d3 fitted; 3 or more tests."tabulated": one point per test at its (average) triaxiality, adjusted until each path reaches D = 1 at its fracture; linear between, constant beyond.
instability_from_flc
¶
instability_from_flc(
major: ArrayLike,
minor: ArrayLike,
*,
extend_to: tuple[float, float] = (
-1.0 / 3.0,
2.0 / 3.0,
),
) -> tuple[FloatArray, FloatArray]
Critical strain curve (ECRIT) from a forming limit curve.
Each FLC point (true major and minor limit strains) becomes
(triaxiality, equivalent strain) with plane_stress_strains; the
curve is sorted by triaxiality and extended with constant values to
extend_to (default -1/3 to 2/3), as an FLC covers only
uniaxial to equibiaxial tension.
regularization_estimate
¶
regularization_estimate(
element_sizes: Sequence[float],
*,
reference_size: float,
necking_strain: float,
fracture_strain: float,
neck_length: float,
) -> RegularizationCurve
First estimate of the element size factors (LCREGD).
An element larger than the neck (about the sheet thickness) averages
the fracture strain in the neck with the uniform strain around:
eps(h) = eps_n + (eps_f - eps_n) min(1, L / h); the factor is
eps(h) / eps(reference_size), so it is 1 at the size the failure
curve was calibrated for. Use it as the start of a mesh study (the
tensile test simulated with each element size), not as the answer.
integrate_damage
¶
integrate_damage(
plastic_strain: ArrayLike,
triaxiality: ArrayLike,
failure: Callable[[FloatArray], FloatArray] | float,
*,
dmgexp: float = 1.0,
instability: Callable[[FloatArray], FloatArray]
| float
| None = None,
dcrit: float = 0.0,
fadexp: float = 1.0,
) -> DamageHistory
D, F and the stress fading along a path, as GISSMO accumulates them.
failure and instability are curves of triaxiality (for
example a FailureFit, or a GissmoCard method) or constants.
Without instability, coupling starts at D = dcrit (0: no
fading, brittle failure at D = 1). The integration is exact for the
piecewise-linear path: D^(1/n) = integral d eps / eps_f.
keyword
¶
Read, check, convert and compare existing *MAT_024 cards.
read_keyword: the*MAT_PIECEWISE_LINEAR_PLASTICITY(*MAT_024) cards of a keyword file or text, with the*DEFINE_CURVEand*DEFINE_TABLEthey use. Fixed (10/20 characters), long (*KEYWORD LONG=Yor a+after the keyword) and comma-separated formats;_TITLEvariants. Includes are not followed.guess_unit_system: the unit system from density and Young's modulus.KeywordDeck.material: one card as acrashmetrics.materials.Mat024in engineering units, to check, compare, convert or rewrite it.check_keyword: finds unit-system mix-ups, curve and table errors, hardening steeper than elasticity, crossing rate curves, curve detail lost to LS-DYNA's re-discretisation, and more.convert_keyword: the cards in another unit system.compare_cards: two cards side by side (E, density, SIGY, C, P, the stress at chosen strains and rates).
KeywordCurve
dataclass
¶
A *DEFINE_CURVE, with SFA/SFO/OFFA/OFFO applied
(x = SFA a + OFFA, y = SFO o + OFFO).
KeywordTable
dataclass
¶
Mat024Keyword
dataclass
¶
Mat024Keyword(
mid: int,
ro: float,
e: float,
pr: float,
sigy: float,
etan: float,
fail: float,
tdel: float,
c: float,
p: float,
lcss: int,
lcsr: int,
vp: float,
eps: tuple[float, ...],
es: tuple[float, ...],
title: str = "",
line: int = 0,
parameters: tuple[str, ...] = (),
)
One *MAT_024 card as written (model units).
parameters
class-attribute
instance-attribute
¶
Fields given as ¶meters (not evaluated; read as 0).
GissmoKeyword
dataclass
¶
GissmoKeyword(
mid: int,
dtyp: float,
refsz: float,
numfip: float,
lcsdg: int,
ecrit: float,
dmgexp: float,
dcrit: float,
fadexp: float,
lcregd: int,
lcsrs: int,
shrf: float,
biaxf: float,
line: int = 0,
parameters: tuple[str, ...] = (),
)
One *MAT_ADD_DAMAGE_GISSMO card as written (model units).
KeywordDeck
dataclass
¶
KeywordDeck(
materials: dict[int, Mat024Keyword],
curves: dict[int, KeywordCurve],
tables: dict[int, KeywordTable],
source: str = "",
notes: tuple[str, ...] = (),
gissmo: dict[int, GissmoKeyword] = dict(),
)
*MAT_024 cards with their curves and tables, and
*MAT_ADD_DAMAGE_GISSMO cards.
notes
class-attribute
instance-attribute
¶
What the reader skipped (unsupported keywords, includes).
gissmo
class-attribute
instance-attribute
¶
gissmo: dict[int, GissmoKeyword] = field(
default_factory=dict
)
*MAT_ADD_DAMAGE_GISSMO cards by MID.
damage
¶
damage(
mid: int, unit_system: str | None = None
) -> GissmoCard
A *MAT_ADD_DAMAGE_GISSMO card as a GissmoCard (element
sizes in mm, rates in 1/s). The unit system comes from
unit_system, else from the *MAT_024 of the same MID, else
mm-ms-kg is assumed (length in mm).
material
¶
material(
mid: int, unit_system: str | None = None
) -> Mat024
One card as a Mat024 in engineering units (kg/m³, MPa, 1/s).
unit_system defaults to guess_unit_system. The hardening
comes from LCSS (curve or table) or, without LCSS, from the
EPS/ES pairs or SIGY and ETAN (bilinear to plastic strain 1).
CardCheck
dataclass
¶
Check result of one *MAT_024 card.
CardComparison
dataclass
¶
Two cards side by side (engineering units).
read_keyword
¶
read_keyword(source: str | Path) -> KeywordDeck
Read the *MAT_024 cards, curves and tables of a keyword file.
source is a path or the keyword text itself (any text with a
line break). Only *MAT_PIECEWISE_LINEAR_PLASTICITY /
*MAT_024 cards are read as materials; every *DEFINE_CURVE
and *DEFINE_TABLE is read (the curves directly after a table
belong to it). *INCLUDE files are not followed (noted in
notes).
guess_unit_system
¶
The unit system that makes both density and Young's modulus
plausible for a *MAT_024 solid (density 500-25 000 kg/m³, E
500 MPa to 1000 GPa: plastics to steels), or None if none does (or
more than one).
check_keyword
¶
check_keyword(
deck: KeywordDeck,
*,
unit_system: str | None = None,
mids: Sequence[int] | None = None,
lcint: int = 100,
) -> list[CardCheck]
Check every *MAT_024 card of a deck (or mids).
Errors:
- density and Young's modulus not of one unit system (or not of the
given
unit_system); - Poisson's ratio outside 0-0.5; LCSS not in the deck; no hardening;
- a curve not starting at zero plastic strain, not increasing in strain, with zero or negative stress, or hardening more steeply than E (unstable);
- a rate table whose values do not increase, with missing curves, or with crossing curves (negative rate sensitivity).
Warnings: SIGY not matching the curve; softening; curve detail lost
when LS-DYNA re-samples the curve at lcint equal intervals
(*CONTROL_SOLUTION LCINT, default 100); a curve ending below
50 % plastic strain; C and P given with a rate table (ignored);
implausible rates for the unit system; ¶meters not checked.
check_gissmo
¶
check_gissmo(
deck: KeywordDeck,
*,
unit_system: str | None = None,
mids: Sequence[int] | None = None,
) -> list[CardCheck]
Check every *MAT_ADD_DAMAGE_GISSMO card of a deck (or mids).
Errors: curves referenced by LCSDG, ECRIT, FADEXP, LCREGD or LCSRS
missing; Lode- or temperature-dependent tables (not checked); and
the errors of GissmoCard.check. Warnings: no *MAT_024 with
the same MID in the deck; DMGEXP or FADEXP left blank (LS-DYNA
default used); element sizes assumed in mm; the warnings of
GissmoCard.check (failure curve range, critical strain above the
failure strain, no coupling, DMGEXP below 1, regularisation rising
with size).
convert_keyword
¶
convert_keyword(
source: str | Path | KeywordDeck,
to_system: str,
*,
from_system: str | None = None,
mids: Sequence[int] | None = None,
) -> str
The *MAT_024 cards (with their curves and tables) of a deck in
another unit system, as keyword text.
The original points, IDs and titles are kept; from_system
defaults to guess_unit_system per card. Tables are written with
ln(rate) values when they had them.
compare_cards
¶
compare_cards(
a: Mat024,
b: Mat024,
*,
strains: Sequence[float] = (
0.0,
0.02,
0.05,
0.1,
0.2,
0.5,
1.0,
),
rates: Sequence[float | None] = (None, 100.0),
names: tuple[str, str] | None = None,
) -> CardComparison
Compare two cards (for example a supplier's and your own, or the same card before and after a change).
Rows: density, E, Poisson's ratio, SIGY, C, P, FAIL, and the true
stress (Mat024.stress) at every plastic strain in strains and
rate in rates (None: without rate effect, the lowest table
curve).
verify
¶
Verify a *MAT_024 card with a single-element tension test.
single_element_deck: a complete LS-DYNA model of one solid element (a cube) pulled in z under uniaxial stress, with the card under test, writingspcforcandnodout. Run it with your LS-DYNA.verify_single_element: reads those two files back (crashmetrics.lsdyna_ascii) and compares the true stress against plastic strain of the element with the card's curve.compare_tension: the same comparison from force and displacement arrays.
A one-element test shows what the solver makes of the card: curve re-discretisation (LCINT), extrapolation beyond the last point, rate scaling and unit mistakes all show up as a difference to the input curve.
FORCE_SCALE
module-attribute
¶
FORCE_SCALE: dict[str, float] = {
"mm-ms-kg": 1000.0,
"mm-s-t": 1.0,
"mm-s-kg": 0.001,
"m-s-kg": 1.0,
}
N per force unit of the unit system (kN, N, mN, N).
LENGTH_SCALE
module-attribute
¶
LENGTH_SCALE: dict[str, float] = {
"mm-ms-kg": 1.0,
"mm-s-t": 1.0,
"mm-s-kg": 1.0,
"m-s-kg": 1000.0,
}
mm per length unit of the unit system.
TOP_NODE
module-attribute
¶
Node at the top of the element whose z displacement gives the strain.
SingleElementCheck
dataclass
¶
SingleElementCheck(
plastic_strain: FloatArray,
stress: FloatArray,
expected: FloatArray,
max_error: float,
rms_error: float,
)
Element response against the card's curve.
max_error
instance-attribute
¶
Largest relative difference (fraction) above 0.2 % plastic strain.
single_element_deck
¶
single_element_deck(
mat: Mat024,
unit_system: str = "mm-ms-kg",
*,
size: float = 1.0,
strain: float = 0.5,
rate: float = 1.0,
rate_effect: bool = False,
title: str = "",
) -> str
Keyword text of a one-element uniaxial tension test.
A cube of edge size (mm) is pulled in z at a constant strain
rate rate (1/s, nominal) to the engineering strain strain,
with a smooth start over the first 2 % of the time. Symmetry
constraints leave the lateral faces free (uniaxial stress). The
solid uses the fully integrated formulation (ELFORM 2), so no
hourglass control is involved.
rate_effect=False (default) writes the card without C and P so
the static curve is checked; with a rate table the lowest-rate
curve dominates at slow rates. Output: spcforc and nodout
(node 5 at the top) at 500 steps, glstat, and d3plot.
compare_tension
¶
compare_tension(
displacement: ArrayLike,
force: ArrayLike,
mat: Mat024,
*,
size: float = 1.0,
rate: float | None = None,
) -> SingleElementCheck
Compare a one-element tension response with the card's curve.
displacement (mm) of the top face and force (N) on it, of a
cube of edge size (mm). True strain ln(1 + u / L), true
stress F (L + u) / (A L) (constant volume, plasticity dominant),
plastic strain eps - sigma / E; compared with
Mat024.stress at rate (None: static curve) above 0.2 %
plastic strain.
verify_single_element
¶
verify_single_element(
run_dir: str | Path,
mat: Mat024,
unit_system: str = "mm-ms-kg",
*,
size: float = 1.0,
rate: float | None = None,
spcforc: AsciiOutput | None = None,
nodout: AsciiOutput | None = None,
) -> SingleElementCheck
Read spcforc and nodout of a single_element_deck run in
run_dir (or pass them) and compare with the card
(compare_tension). The reaction force is the z total of
spcforc, the displacement node 5's z displacement in nodout.
library
¶
Summary table and a material library with provenance.
card_summary: one row per*MAT_024card (density, E, SIGY, stress at chosen strains, rate model, FAIL, provenance), as dicts for CSV and as a Markdown table (summary_markdown).MaterialLibrary: a folder of cards stored as JSON in engineering units with their full provenance (tests, fits, who and when).save/load/names/export(to a.kinclude in any unit system). Plain JSON files: diff them, keep them in git.
MaterialLibrary
¶
A folder of *MAT_024 materials as JSON files with provenance.
Each material is <name>.json holding the card in engineering
units (kg/m³, MPa, 1/s), its curve or table, the provenance given
to Mat024, and when and with which crashmetrics version it was
saved.
save
¶
save(
mat: Mat024,
name: str | None = None,
*,
overwrite: bool = False,
date: date | None = None,
note: str = "",
) -> Path
Store a card; name defaults to the title (or mat<MID>).
Refuses to replace an existing entry unless overwrite.
summary
¶
card_summary of every stored card, with a name column.
export
¶
Write a stored card as an include file (Mat024.write).
card_summary
¶
card_summary(
cards: Sequence[Mat024],
*,
strains: Sequence[float] = (0.05, 0.2, 0.5, 1.0),
) -> list[dict[str, object]]
One row per card: MID, title, density (kg/m³), E (GPa), SIGY and
the static stress at strains (MPa), rate model, FAIL and the
provenance entries (prov.<key>).
summary_markdown
¶
Markdown table of card_summary rows (provenance columns left out).