File size: 12,079 Bytes
38bfc88
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
---

license: mit
library_name: scikit-learn
pipeline_tag: tabular-regression
tags:
- gaussian-process
- surrogate-model
- finite-element-analysis
- structural-mechanics
- engineering-design
- uncertainty-quantification
datasets:
- jackstev/simplesim-bracket-fea
---


# SimpleSim bracket surrogates

Fast stand-ins for a finite-element solver. Given the dimensions of a steel bracket, they predict its peak von Mises stress and maximum deflection with a calibrated 90% band, in milliseconds instead of the one to three minutes a CalculiX solve takes. [SimpleSim](https://github.com/jackstev-edu/SimpleSim) uses them to shortlist designs before an engine checks the finalists.

We trained these models ourselves on our own simulation data. The language model in SimpleSim's chat (OpenAI `gpt-6-luna`) is an off-the-shelf component and is not described here.

- **Try it:** download the app and double-click its launcher, [start here](https://github.com/jackstev-edu/SimpleSim#start-here-run-the-app)
- **Training data:** [jackstev/simplesim-bracket-fea](https://huggingface.co/datasets/jackstev/simplesim-bracket-fea)
- **Code:** [github.com/jackstev-edu/SimpleSim](https://github.com/jackstev-edu/SimpleSim), `src/models/`
- **Notebook:** [load, train, evaluate, predict](https://colab.research.google.com/github/jackstev-edu/SimpleSim/blob/main/notebooks/simplesim_surrogates.ipynb)

## The models

| Model | Families | How it works | Files here |
| --- | --- | --- | --- |
| **GP on a power-law mean** (`gp_powerlaw_*`) | plain L-bracket `l_bracket_v0`, gusseted L-bracket `l_bracket_gusset_v1` | log(stress) and log(deflection) are fitted as straight lines in the log of the inputs. A Gaussian process (Matern 5/2, one length scale per input, white noise) then learns what the line misses. scikit-learn `GaussianProcessRegressor`. | `gp/gp_<family>.pkl` |
| **Power law** (`power_law_*`) | v0, v1 and ten bracket templates T01 to T10 | the straight-line fit alone, with a constant band from 5-fold held-out residuals. Needs only NumPy. | `power_law/<family>.json`, `power_law/template_fits.json` |

Inputs are the family's dimensions in mm (5 for v0, 8 for v1, 6 to 9 for a template) and Poisson's ratio. Outputs are at the training load and stiffness (500 N, E = 200,000 MPa). Because the analysis is linear elastic, the code scales stress with the load and deflection with load over stiffness exactly, so no model learns that. Mass is closed form from the geometry and is not predicted.

What runs in the app: the GP for v0 and v1 when scikit-learn is installed, and the power law for the ten templates and as the fallback.

## Training

| | v0 | v1 | each template |
| --- | --- | --- | --- |
| Rows | 200 | 2,048 | 80 |
| Sampling | Latin hypercube | scrambled Sobol | 60 Latin hypercube, 20 paired variants |
| Evaluation fit | 144 train, 16 calibration, 40 test | 1,474 train, 164 calibration, 410 test | 64 train, 16 validation |

Every label is a CalculiX solve of a CadQuery solid meshed with Gmsh. See the dataset card for the mesh rules and quality checks.

- **Split:** seeded (seed 0), 20% test, then 10% of the rest for calibration. The templates use the dataset's own split by design family.
- **GP fit:** kernel hyperparameters by marginal likelihood, 3 optimizer restarts on v0 and 1 on v1. A v1 fit took 500 s here on a 4-core laptop with other jobs running, and v0 about 12 s.
- **Calibration:** each 90% band is rescaled so 90% of held-out rows fall inside it. v1 uses its 164 calibration rows. v0's 16 rows are too few for a 90% quantile, so v0 uses 5-fold out-of-fold residuals of its 160 non-test rows.
- **Shipped fit:** the GP in `gp/` and in the app is refit on all rows of its family and keeps the band scales found above. The numbers below describe the training-split fit, so the shipped model has seen the test rows and should not be re-scored on them.
- **Environment:** Python 3.12, scikit-learn 1.9.1, NumPy 2.5.5, pandas 3.1.1 (`requirements-demo.txt`).

## Evaluation

All numbers below were produced on 2026-12-03 by running the repository's evaluation code in a clean environment with the pinned versions: `python -m src.models.benchmark --family <key>` and `python -m src.models.multifamily --benchmark --gp`. Error is the absolute percent error on held-out rows, on the original scale. Coverage is the share of held-out rows inside the 90% band, before and after calibration.

**Gusseted L-bracket v1, 410 test rows**

| Model | Stress median | Stress p95 | Deflection median | Deflection p95 | Coverage, stress | Coverage, deflection |
| --- | --- | --- | --- | --- | --- | --- |
| median baseline | 39.03% | 105.90% | 55.54% | 234.59% | | |
| power law | 3.48% | 9.82% | 4.18% | 15.62% | 90% to 89% | 90% to 90% |
| **GP** | **1.87%** | **5.22%** | **0.02%** | **0.09%** | 90% to 90% | 98% to 94% |

**Plain L-bracket v0, 40 test rows** (coverage moves in 2.5% steps)

| Model | Stress median | Stress p95 | Deflection median | Deflection p95 | Coverage, stress | Coverage, deflection |
| --- | --- | --- | --- | --- | --- | --- |
| median baseline | 36.88% | 100.11% | 58.14% | 284.85% | | |
| power law | 1.01% | 4.15% | 0.60% | 1.57% | 88% to 88% | 95% to 95% |
| GP | 1.01% | 3.08% | 0.02% | 0.08% | 80% to 82% | 98% to 80% |

**Ten templates, validation rows** (16 per template; median / p90)

| Model | Trained on | Stress | Deflection | Stress on unseen T07 | Deflection on unseen T07 |
| --- | --- | --- | --- | --- | --- |
| power law, T01 double hole | 64 | 3.0% / 3.8% | 0.65% / 1.29% | | |
| power law, T02 single slot | 64 | 0.8% / 2.7% | 0.82% / 1.21% | | |
| power law, T03 twin slot | 64 | 1.8% / 4.0% | 0.66% / 1.31% | | |
| power law, T04 rounded window | 64 | 4.2% / 6.3% | 0.78% / 1.65% | | |
| power law, T05 side notches | 64 | 2.2% / 6.2% | 1.05% / 2.35% | | |
| power law, T06 tapered | 64 | 1.6% / 3.3% | 0.83% / 1.87% | | |
| power law, T08 twin gusset | 64 | 2.0% / 4.0% | 2.23% / 7.87% | | |
| power law, T09 perforated gusset | 64 | 1.6% / 3.9% | 1.58% / 3.12% | | |
| power law, T10 offset planform | 64 | 0.4% / 1.5% | 0.58% / 1.97% | | |
| shared ridge on 20 CAD descriptors (comparison) | 736 | 8.4% / 20.6% | 2.49% / 9.80% | 20.2% / 29.5% | 3.41% / 10.72% |
| shared GP on 20 CAD descriptors (comparison) | 736 | 7.0% / 17.6% | 1.21% / 4.19% | 21.0% / 28.5% | 2.69% / 4.63% |

T07 (stepped) is the dataset's held-out family. The per-template power laws cannot score a family they never saw, so T07 has no validation row of its own. Its shipped fit uses its 80 rows like the others. The shared GP row moves by a few tenths of a percent between scikit-learn versions because its optimizer stops at its iteration limit.

## Error analysis

- **Stress is the hard target, deflection is easy.** Deflection is a smooth global quantity and the GP fits it to 0.02%. Peak stress sits at a local feature. On v1 the GP's fitted white-noise level for stress is about 2.6% in log space, so roughly 2% of the stress error is noise in the labels themselves (the peak is on the 2 mm junction fillet, where the production mesh was within 1.5% of the finest). No model on these inputs will get far below the GP's 1.9%.
- **The power law is limited by its form, not by data.** On v0 its stress median is 1.09% at 50 training rows and 1.01% at 144. The GP's deflection error keeps falling with data over the same range (0.14% at 50 rows, 0.02% at 144).
- **Poisson's ratio matters for deflection only.** Without it the GP's deflection median rises from 0.02% to 0.42% on v1 and from 0.02% to 0.55% on v0. Stress barely moves (1.91% against 1.87% on v1).
- **The v0 GP band is too narrow.** After calibration it covers 82% (stress) and 80% (deflection) of the 40 test rows, three and four rows short of 90%. For that reason the dependency-free default for v0 is the power law, whose coverage is 88% and 95%.
- **Shape descriptors do not carry stress across families.** A single model on 20 CAD descriptors reaches 7 to 8% median stress error on families it trained on and about 20% on the unseen T07, because the peak stress sits at a slot end, a notch mouth or a rib junction that the descriptors do not locate. Each template's own dimensions fix that feature, which is why the per-template fits ship.
- **Loosest fits:** T04 rounded window on stress (4.2% median, 6.3% p90) and T08 twin gusset on deflection (7.87% p90).
- **Per-slice errors and the five worst test designs** for the v1 GP are computed in section 4 of the notebook.

## Intended use

Shortlisting designs of these twelve bracket families so that a solver has to check only a few. SimpleSim judges a design at the pessimistic end of the 90% band, so the band matters as much as the median. Suitable for teaching, early design exploration and demos.

Not intended for signing off a design, for parts outside the twelve families, or for any decision where a wrong stress value could cause harm. A shortlisted design needs a real solver run and an engineer's review.

## Limits

- **Extrapolation.** Outside the sampled ranges the models extrapolate. The app flags such designs (`in_training_range`). The GP's band widens there, and the power law's does not.
- **One load case.** Back face fixed, 500 N along -Y on the free end, static, linear elastic. Other load magnitudes and moduli are scaled exactly. Other load directions, contact, plasticity, buckling and fatigue are not covered.
- **Stress above yield is not physical.** The models reproduce linear-elastic stress, including values above the 250 MPa yield strength.
- **v0 stress leans optimistic for small fillets.** The v0 labels come from a uniform mesh that under-reads peak stress by up to 16% for fillets under about 4 mm. No correction is applied.
- **Template bands are not benchmarked.** They are 5-fold sigmas on 80 rows without a calibration slice.
- **The app's default finalist check is not independent.** It uses the fitted power law, which comes from the same CalculiX runs. The result says so. A CalculiX or ANSYS check needs local installs.
- **No physical validation.** Nothing here has been compared with a test or a second solver.
- **Small evaluation sets.** 40 test rows for v0 and 16 validation rows per template, so those percentages are coarse.

## Use

The power-law files are plain JSON: `log(y) = coef[0] + sum(coef[i] * log(input[i]))`, with `sigma` and `band_scale` giving the band in log space.

```python

import json, numpy as np

from huggingface_hub import hf_hub_download



fit = json.load(open(hf_hub_download("jackstev/simplesim-bracket-surrogates", "power_law/l_bracket_gusset_v1.json")))

x = [6.0, 90.0, 40.0, 8.0, 4.0, 60.0, 5.0, 20.0, 0.30]            # in the order of fit["inputs"]

log_stress = fit["coef"]["max_stress_mpa"][0] + np.dot(fit["coef"]["max_stress_mpa"][1:], np.log(x))

half = 1.645 * fit["sigma"]["max_stress_mpa"] * fit["band_scale"]["max_stress_mpa"]

print(np.exp(log_stress), np.exp(log_stress - half), np.exp(log_stress + half))   # MPa at 500 N

```

The GP files are Python pickles of `src.models.gp.GPPredictor`. Load them only with the repository on the path and scikit-learn 1.9.1, and only if you trust this source, since unpickling runs code. The simpler route is to let the code retrain: `trained_gp("l_bracket_gusset_v1")` rebuilds the same model from the dataset in a few minutes and caches it.

```python

from src.models.gp import trained_gp                 # inside a clone of the GitHub repo

gp = trained_gp("l_bracket_gusset_v1")

med, band = gp.predict_arrays([x], force_n=500.0, e_mpa=200_000.0)

```

`evaluation/` holds the benchmark records behind the project's own notes in [docs/models.md](https://github.com/jackstev-edu/SimpleSim/blob/main/docs/models.md), which also compares an AutoGluon model that we did not ship.

## License and credit

MIT. SimpleSim team (Jin Can, Yunus Polatoglu, Arin Rothschild, Jack Stevens), Carnegie Mellon University, course 24-679, Fall 2026.