Examples¶
A curated, in-progress gallery — a working tour through the apeGmsh API by example. Every notebook follows the same modernised template:
- Build geometry / mesh / FEM with apeGmsh.
- Drive OpenSees with vanilla
openseespycalls. - Declare apeGmsh recorders by physical-group / label name.
- Wrap the analysis in
spec.capture(...)orspec.emit_recorders(...)— the two strategies are split across the gallery so you see both in action. - Read results back via
Results.from_native(...)/Results.from_recorders(...), verify against closed-form references, and plot in-notebook from the slabs.
Looking for the full repo? 60+ examples live under apeGmsh/examples on GitHub. The 8 below are the curated subset rendered inline in the docs.
Strategy at a glance. Each card calls out which results-acquisition strategy that notebook uses —
spec.capturefor the apeGmsh-native HDF5 path with broadest coverage,spec.emit_recordersfor live classic OpenSees recorders. SameResultsAPI on the read side regardless.
Getting started¶
-
Strategy:
spec.captureThe smallest viable apeGmsh ↔ openseespy ↔ Results loop. A unit plate in plane stress under uniaxial tension, verified against $u_x = \sigma L / E$ to machine precision. Covers the full pipeline in ~26 cells: geometry → mesh → vanilla
ops.*model → recorder declaration → capture → read back → in-notebook plot. -
Strategy:
spec.emit_recordersThe other results-acquisition strategy. Same
begin_stage/end_stagelifecycle ascapture, but classic recorder.outfiles on disk thatResults.from_recorders(stage_id=...)reads back. Verified against Euler-Bernoulli $\delta = -PL^3/(3EI)$ plus the deflected-shape cubic.
Building richer models¶
-
Strategy:
spec.captureMulti-element frame with two element groups of different cross-section (columns + rigid beam) driven from named physical groups. The first example where the FEM is more correct than the classical drift formula — the residual ~0.75% is inherent (axial deformation + joint kinematics).
-
Strategy:
spec.capture(small)The two naming namespaces and how both flow through to
Results. Declare recorders in both namespaces (pg=andlabel=), cross-check that the read side gives identical answers either way. Demonstrates thetarget=precedence order (label → PG → part). -
Strategy:
spec.emit_recordersBuild a column once as a
Part, instantiate three times viag.parts.add(part, label=..., translate=...). Declare one recorder per part label, read each part's slab independently — part labels survive end-to-end as first-class selectors. -
Strategy:
spec.captureTwo beams meeting at a shared point with non-matching meshes, joined via
g.constraints.equal_dof. The notebook verifies the constraint contract directly throughResults—u_masterandu_slaveat the junction are equal to round-off. Tip deflection matches the single-cantilever closed form.
Analysis types¶
-
Strategy:
spec.capture(capture_modes)Eigenvalue analysis —
cap.capture_modes(N)writes one stage per mode withkind="mode". Read back viaresults.modes, withmode_index,eigenvalue,frequency_hz,period_sexposed as scoped properties. First three bending modes verified against Euler-Bernoulli to <0.3% error. Modal is capture-only — the classic recorder path can't driveops.eigen(). -
Strategy:
spec.captureThe first multi-step nonlinear notebook — a Steel01 bar pushed to 4× yield via
DisplacementControl. The recorder fires at every converged step; the capacity curve drops out of twoResults.nodes.get(...)calls without any manualnodeDisp/nodeReactionaccumulation. Three closed-form checks (slope, plateau, yield onset) all match to round-off.
Common shape across every notebook¶
1. Imports + parameters
2. Geometry ← apeGmsh
3. Physical groups + labels
4. Mesh
5. Build OpenSees model ← VANILLA openseespy (ops.*)
6. Declare recorders ← apeGmsh
7. Run analysis ← spec.capture(...) or spec.emit_recorders(...)
8. Read results back ← Results
9. Verify + plot ← matplotlib from slabs
10. Optional viewer ← results.viewer(blocking=False)
The "vanilla openseespy except for recorders" rule is visible in
section 5 (raw ops.* calls — nodes, elements, materials, fix,
load) vs section 6 onward (apeGmsh recorders, capture, Results,
viewer). The model setup stays close to OpenSees idioms; the
results pipeline is where apeGmsh adds value.
What's not in the gallery (yet)¶
The repo's examples/ directory has many more — buckling, contact
springs, tunnel meshes, lateral-torsional buckling, embedded rebars,
soil-structure interaction, etc. Browse them on
GitHub
or examples/EOS Examples/
for the structured course material (numbered 01–22+).
If you'd like a particular example promoted to the gallery — better narrative, screenshots, prose — open an issue with the notebook filename and a one-line "why this one matters."