Skip to content

Spot weld failure

Module: crashmetrics.spotweld (NumPy only). Synthetic runs with failing welds come from crashmetrics.synthetic.

A load path only works while its connections hold. When a flange unzips, the section opens and the part stops carrying load, so weld failure is often the reason behind a part that "absorbed less energy". LS-DYNA writes the force of every spot weld to swforc; this module answers:

  1. Which welds failed, when, and in what order?
  2. Did a line of welds unzip (many failures within a short time)?
  3. Which welds hold but are close to their limit?
  4. Against a baseline: which welds fail only now, or earlier?
Step Functions
Read swforc of a run folder load_welds, WeldRun
Name the welds (swforc has no titles) groups_by_id, or your own name → IDs
Failure criterion and utilisation WeldLimits
Every weld: peak forces, forces before failure, utilisation weld_summary, WeldSummary.failed, .critical, .groups, .table
Failures over time, sequence, first failure per group, bursts failure_history
Baseline against variant compare_welds
All of it as Markdown weld_report

Forces are in kN and times in ms, whatever the model units (unit_system=, default mm-ms-kg).

Reading a run

from crashmetrics.spotweld import load_welds

run = load_welds("runs/baseline")                  # folder with swforc
run = load_welds("job12/job12.swforc", unit_system="mm-s-t")
run.failed                                         # IDs by failure time
run.axial, run.shear, run.failure_time             # (time, weld) kN; ms per weld

A weld counts as failed from the first state LS-DYNA prints failure for it (or the printed failure time, if earlier). All connection types in the file are read: spot weld beams and solids, constraint welds, generalized welds.

Naming the welds

swforc has no titles, so groups are given as name → weld IDs:

groups = {"B-pillar flange": range(36094001, 36094031), "Sill": [4601, 4602, 4610]}

from crashmetrics.spotweld import groups_by_id
groups = groups_by_id(run, 1000, {120: "Front rail LH", 121: "Front rail RH"})

groups_by_id uses the numbering: welds with the same ID // divisor form a group, named from your mapping or "120xxx". A weld in several groups counts in the first.

Limits and utilisation

from crashmetrics.spotweld import WeldLimits

limits = WeldLimits(axial=9.0, shear=12.0)                 # kN, all welds
limits = {"default": WeldLimits(9.0, 12.0),                # or per group
          "Front rail LH": WeldLimits(11.0, 14.0)}
(axial / axial limit)^n + (shear / shear limit)^m ≥ 1      n = m = 2 by default

This is the force criterion of *CONSTRAINED_SPOTWELD. Only axial tension counts (compression=True to count both).

Utilisation is the share of the failing load reached: 0.8 means both forces could still grow by 25 % (1 / 0.8) before the criterion is met. For n = m it is the failure function to the power 1/n; otherwise it is solved numerically.

Without limits there is no utilisation, unless the file prints its own failure measure between 0 and 1 (some weld materials), which is then used.

Limits are yours

The limits are not in swforc. Take them from the weld card or the material data of your model. Welds with a stress- or damage-based failure (*MAT_SPOTWELD options) are still read and their failures found, but the force criterion here is then only a comparison.

Every weld

from crashmetrics.spotweld import weld_summary

summary = weld_summary(run, limits=limits, groups=groups)
print(summary.table())
summary.failed                 # failed welds, first failure first
summary.critical(0.8)          # hold, but at 80 % or more of their limit
summary.groups()               # welds, failed, first failure, highest utilisation

Each weld has its peak axial and shear force, the forces at the last state before failure, its peak utilisation and when it occurred.

A weld that failed well below its limit (example 32: at 31 % of the design load) points to the weld definition (strength, diameter, a wrong card), not to the load.

Failures over time

from crashmetrics.spotweld import failure_history

history = failure_history(run, groups=groups)
print(history.summary())
history.count                  # failed welds at each time
history.sequence               # (ms, weld ID, group) in order
history.first                  # group -> (ms, weld ID) of its first failure
history.bursts                 # unzipping

A burst is 3 or more welds of one group (burst_size=), each failing within 1 ms of the one before (burst_window=). Welds outside every group are treated as one group.

Comparing runs

from crashmetrics.spotweld import compare_welds

comparison = compare_welds(baseline, variant, limits=limits, groups=groups)
print(comparison.summary())
comparison.new_failures        # fail only in the variant
comparison.recovered           # fail only in the baseline
comparison.earlier, comparison.later
comparison.increased           # hold in both, by utilisation increase

Welds are matched by ID. A failure counts as earlier or later when its time moves by more than 0.5 ms (time_tolerance=). Welds in only one run are listed in notes.

weld_report(run, baseline=..., limits=..., groups=...) gives the summary, the failure history and the comparison as one Markdown page.

Pair this with Load paths and energy: compare_runs shows which part lost energy, and compare_welds shows whether its welds are the reason.

Synthetic runs with welds

crashmetrics.synthetic puts lines of spot welds on the flanges of the crash boxes, front rails, rear rails and upper rails (84 welds) and writes swforc next to matsum and secforc:

  • A line carries a share of its load path's force as shear, more on the welds at the front. As the part folds, each weld also gets a peel (axial) force.
  • A weld fails at (axial / Sn)² + (shear / Ss)² ≥ 1. The welds left take part of its load, and the part loses strength as its welds fail.
Variant Welds What the analysis should find
baseline All hold Highest utilisation 85 % (first crash box welds)
weak_welds_front_rail_lh LH front rail flange welds at about a third of their strength All 14 fail, front to rear, from 14.5 ms; a burst of 8 at 39 ms; the LH front rail absorbs 3 kJ less

Example

"""Example 32: spot weld failure in a frontal crash, and against a baseline.

Two runs of the synthetic frontal model (crashmetrics.synthetic, which
writes swforc in the LS-DYNA layout; point load_welds at your own run
folder instead): the baseline, and a variant whose LH front rail flange
welds have about a third of their strength.

1. Baseline: every weld against its limits; the critical welds.
2. Variant: which welds fail, when, in what order; bursts (unzipping).
3. Variant against baseline: new failures per group.
4. What the failed welds did to the structure (load path comparison).
"""

from crashmetrics.loadpath import compare_runs, load_run
from crashmetrics.spotweld import (
    WeldLimits,
    compare_welds,
    failure_history,
    groups_by_id,
    load_welds,
    weld_summary,
)
from crashmetrics.synthetic import frontal_model, simulate

for variant in ("baseline", "weak_welds_front_rail_lh"):
    simulate(frontal_model(variant)).write(f"runs/{variant}")
base = load_welds("runs/baseline")                    # reads runs/baseline/swforc
weak = load_welds("runs/weak_welds_front_rail_lh")

# swforc has no titles: name the welds by their numbering (here the part
# ID is the first three digits of the weld ID).
parts = {110: "Crash box LH", 111: "Crash box RH", 120: "Front rail LH",
         121: "Front rail RH", 130: "Rear rail LH", 131: "Rear rail RH",
         140: "Upper rail LH", 141: "Upper rail RH"}
groups = groups_by_id(base, 1000, parts)
# Design limits of the welds, kN (axial, shear), per group.
limits = {"default": WeldLimits(9.0, 12.0),
          "Front rail LH": WeldLimits(11.0, 14.0),
          "Front rail RH": WeldLimits(11.0, 14.0),
          "Rear rail LH": WeldLimits(9.0, 13.0), "Rear rail RH": WeldLimits(9.0, 13.0),
          "Upper rail LH": WeldLimits(4.5, 6.0), "Upper rail RH": WeldLimits(4.5, 6.0)}

# --- 1. Baseline: all welds hold; which are close? ------------------------------
print(weld_summary(base, limits=limits, groups=groups).table())

# --- 2. Variant: failures over time ---------------------------------------------
print()
summary = weld_summary(weak, limits=limits, groups=groups)
print(summary.table(top=6))
print()
history = failure_history(weak, groups=groups)
print(history.summary())
print("Failed welds over time: " + ", ".join(
    f"{ms} ms: {int(history.count[abs(history.time - ms).argmin()])}"
    for ms in (10, 20, 30, 35, 40, 50)))
first = summary.failed[0]
print(f"Weld {first.weld_id} failed at {first.utilisation * 100:.0f} % of its "
      "design load: look at the weld definition, not at the load")

# --- 3. Against the baseline ----------------------------------------------------
print()
print(compare_welds(base, weak, limits=limits, groups=groups).summary(top=3))

# --- 4. What it did to the structure --------------------------------------------
print()
comparison = compare_runs(load_run("runs/baseline"),
                          load_run("runs/weak_welds_front_rail_lh"),
                          exclude="Body*", rate=False)
print(comparison.summary(top=3))

Output:

Spot welds, baseline: 84 welds, 0 failed

| Group | Welds | Failed | First failure ms | Highest utilisation |
| --- | --- | --- | --- | --- |
| Crash box LH | 8 | 0 | - | 85 % |
| Crash box RH | 8 | 0 | - | 85 % |
| Front rail LH | 14 | 0 | - | 74 % |
| Front rail RH | 14 | 0 | - | 74 % |
| Rear rail LH | 10 | 0 | - | 59 % |
| Rear rail RH | 10 | 0 | - | 59 % |
| Upper rail LH | 10 | 0 | - | 66 % |
| Upper rail RH | 10 | 0 | - | 66 % |

| Critical weld (holds) | Group | Utilisation | At ms | Peak axial | Peak shear |
| --- | --- | --- | --- | --- | --- |
| 110001 | Crash box LH | 85 % | 42.5 | 3.94 | 8.75 |
| 111001 | Crash box RH | 85 % | 42.5 | 3.94 | 8.75 |

Spot welds, weak_welds_front_rail_lh: 84 welds, 14 failed

| Group | Welds | Failed | First failure ms | Highest utilisation |
| --- | --- | --- | --- | --- |
| Crash box LH | 8 | 0 | - | 85 % |
| Crash box RH | 8 | 0 | - | 85 % |
| Front rail LH | 14 | 14 | 14.5 | 36 % |
| Front rail RH | 14 | 0 | - | 74 % |
| Rear rail LH | 10 | 0 | - | 59 % |
| Rear rail RH | 10 | 0 | - | 59 % |
| Upper rail LH | 10 | 0 | - | 66 % |
| Upper rail RH | 10 | 0 | - | 66 % |

| Failed weld | Group | At ms | Axial kN before | Shear kN before | Peak axial | Peak shear |
| --- | --- | --- | --- | --- | --- | --- |
| 120001 | Front rail LH | 14.5 | 0 | 4.40 | 0 | 4.40 |
| 120002 | Front rail LH | 24.5 | 1.66 | 4.32 | 1.66 | 4.62 |
| 120003 | Front rail LH | 25.0 | 1.75 | 4.39 | 1.75 | 4.45 |
| 120004 | Front rail LH | 30.5 | 2.24 | 4.04 | 2.24 | 4.30 |
| 120005 | Front rail LH | 30.5 | 2.15 | 3.88 | 2.15 | 4.13 |
| 120006 | Front rail LH | 31.5 | 2.34 | 4.05 | 2.34 | 4.05 |
| ... 8 more | | | | | | |

| Critical weld (holds) | Group | Utilisation | At ms | Peak axial | Peak shear |
| --- | --- | --- | --- | --- | --- |
| 110001 | Crash box LH | 85 % | 41.5 | 3.94 | 8.75 |
| 111001 | Crash box RH | 85 % | 41.5 | 3.94 | 8.75 |

Weld failures, weak_welds_front_rail_lh: 14, first at 14.5 ms (weld 120001, Front rail LH)
  Front rail LH: 14 failed, first weld 120001 at 14.5 ms
  burst: 3 welds of Front rail LH between 30.5 and 31.5 ms
  burst: 8 welds of Front rail LH between 39.0 and 39.5 ms
Failed welds over time: 10 ms: 0, 20 ms: 1, 30 ms: 3, 35 ms: 6, 40 ms: 14, 50 ms: 14
Weld 120001 failed at 31 % of its design load: look at the weld definition, not at the load

weak_welds_front_rail_lh against baseline: failed welds 0 -> 14 (+14); 14 new, 0 no longer fail, 0 earlier, 0 later
Groups that changed:
  Front rail LH: 0 -> 14 of 14 welds failed
New failures, first first:
  weld 120001 (Front rail LH) at 14.5 ms (74 % of its limit in baseline)
  weld 120002 (Front rail LH) at 24.5 ms (71 % of its limit in baseline)
  weld 120003 (Front rail LH) at 25.0 ms (69 % of its limit in baseline)
  ... 11 more

weak_welds_front_rail_lh against baseline: absorbed energy 176.5 -> 176.3 kJ (-0.120)
Parts that explain most of the change:
  Front rail LH (120): 32.65 -> 29.63 kJ (-3.03, 51 % of all change)
  Rear rail LH (130): 2.02 -> 2.97 kJ (+0.948, 16 % of all change)
  Rear rail RH (131): 2.02 -> 2.97 kJ (+0.948, 16 % of all change)
Sections, most changed first:
  Rear rail LH (15): peak 264.1 -> 265.4 kN, impulse -4.1 %
  Front rail LH (13): peak 272.6 -> 273.9 kN, impulse -4.0 %
  Crash box LH (11): peak 273.4 -> 274.7 kN, impulse -4.0 %

Tested with

  • Synthetic runs, whose failure times are known: the file gives each failure at the first output state after the true time.
  • A real full-width frontal crash from a public repository (no licence, so checked locally only and not included): 394 connections of three types, 32 failed; 30 of them at the same output state, reported as one burst.
  • A real bolted joint (spot weld beam, R13; no licence, local only): one weld, no failure.