Skip to content

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 openseespy calls.
  • Declare apeGmsh recorders by physical-group / label name.
  • Wrap the analysis in spec.capture(...) or spec.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.capture for the apeGmsh-native HDF5 path with broadest coverage, spec.emit_recorders for live classic OpenSees recorders. Same Results API on the read side regardless.

Getting started

  •   Hello plate


    Strategy: spec.capture

    The 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.

  •   Cantilever beam (2D)


    Strategy: spec.emit_recorders

    The other results-acquisition strategy. Same begin_stage / end_stage lifecycle as capture, but classic recorder .out files on disk that Results.from_recorders(stage_id=...) reads back. Verified against Euler-Bernoulli $\delta = -PL^3/(3EI)$ plus the deflected-shape cubic.

Building richer models

  •   Portal frame (2D)


    Strategy: spec.capture

    Multi-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).

  •   Labels & physical groups


    Strategy: spec.capture (small)

    The two naming namespaces and how both flow through to Results. Declare recorders in both namespaces (pg= and label=), cross-check that the read side gives identical answers either way. Demonstrates the target= precedence order (label → PG → part).

  •   Part assembly


    Strategy: spec.emit_recorders

    Build a column once as a Part, instantiate three times via g.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.

  •   Interface tie


    Strategy: spec.capture

    Two beams meeting at a shared point with non-matching meshes, joined via g.constraints.equal_dof. The notebook verifies the constraint contract directly through Resultsu_master and u_slave at the junction are equal to round-off. Tip deflection matches the single-cantilever closed form.

Analysis types

  •   Modal analysis


    Strategy: spec.capture (capture_modes)

    Eigenvalue analysis — cap.capture_modes(N) writes one stage per mode with kind="mode". Read back via results.modes, with mode_index, eigenvalue, frequency_hz, period_s exposed 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 drive ops.eigen().

  •   Pushover (elastoplastic)


    Strategy: spec.capture

    The 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 two Results.nodes.get(...) calls without any manual nodeDisp / nodeReaction accumulation. 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.

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."