Skip to content

Simulation Templates

Simulation templates for chip design simulations using GDSFactory+.

Documentation

Reusable app origins live in origin_simulation_templates/<simulator>/<template>/, beside the standalone tutorial notebooks in simulation_templates/. The eight first-draft origins cover zapFDTD, Meep, MEOW, Femwell and SAX, with embedded metadata and explicit inline user inputs.

See origin organization and DataLab delivery and the input/metadata contract. Each analysis has one canonical origin; source-specific notebooks are generated rather than committed as tutorial entries. Shared authoring implementations live under scripts/, outside the published notebook collections. The project kernel is Python 3.12 with the .venv notebook kernel convention.

make docs caches executed Femwell notebook Markdown and images in .cache/femwell-notebooks. Re-running it restores unchanged notebooks instead of repeating their finite-element solves. Notebook edits or installed-package version changes invalidate the affected entries automatically.

Quantum RF pages use validated, locally executed snapshots from notebook_snapshots/. This keeps their plots and numerical results in the published documentation without requiring the specialized QPDK environment in the docs job. The build rejects a snapshot when its source cells no longer match the corresponding template.

Tag a cell hide-input to publish its output without leading with its code. scripts/fold_code.py folds those cells into a collapsed "Show code" block, so the page opens on the plot or table and the code is one click away rather than hidden. Cell outputs are never folded.

Choosing a PDK

The Meep 3D template explicitly imports and activates the selected project PDK in its Config cell. The app supplies the installed PDK module when creating the notebook.

The standalone GDSFactory FDTD examples load components from the active PDK. The 3D grating-coupler example activates the generic PDK to match its built-in elliptical grating and layer stack. Select the active PDK with the PDK environment variable, which gdsfactory reads into CONF.pdk:

export PDK=gdsfactory.gpdk

The docs build sets this in CI. Point it at another installed PDK module to run the templates against that PDK instead.

The 3D GDSFactory FDTD templates require gsim>=0.8.0. gsim 0.7.0 has no Domain(padding=...) and fails with padding: Extra inputs are not permitted. To update a project environment, run uv add "gsim>=0.8.0" and restart the notebook kernel.

The repository's dev and templates extras use gsim>=0.9.0, keeping docs execution and native compatibility tests on the same released API. Static metadata and origin ZIP checks do not require gsim. This is separate from an origin's optional package requirements: each origin declares its own runtime constraints. Binding schemas and source adapters do not have version fields.

Cloud result cache

The cloud templates call sim.run(check_cache=True). Before submitting, gsim hashes the simulation inputs it is about to upload and asks the cloud whether a completed job with byte-identical inputs already exists; if so its results are reused instead of re-running the solver. Change anything that affects the inputs — geometry, materials, mesh, solver settings — and the hash changes, so the simulation runs for real.

The lookup never fails a run: a network or server error degrades to a normal submit. Drop check_cache=True to always force a fresh solve.

Template Categories

  • Modesolver: FEM mode solving, waveguide sweeps, GVD, propagation loss
  • Heater: Doped phase shifters, metal heater efficiency
  • FDTD: GDSFactory FDTD (gsim.fdtd, 3D at 50–60 nm), Meep, Tidy3D, Ansys Lumerical S-parameters, BEAMZ (local, no cloud submission)
  • HFSS: Driven capacitor, eigenmode resonator, Q2D CPW impedance
  • Quantum RF: Transmon design, circuit simulation, Monte Carlo fabrication tolerance
  • Circuit: Frequency domain, time domain, active models
  • SPICE: Operating point, DC sweep, AC, transient, noise, sensitivity