Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Simulation Guide

Workflow

  1. Draw the device as a gdsfactory component (or import a .gds) with ports, plus a LayerStack assigning thickness and material per layer.

  2. Define materials, frames, sources and monitors.

  3. lumi.mesh(path, c, layer_stack, materials, zmin, zmax) writes 3D meshes into simulation folder path.

  4. lumi.setup(path, ...) writes the simulation problem and solves port modes.

  5. lumi.solve(path) runs FDTD. Runs on Lumi Colab server if LUMI_API is set.

  6. lumi.movie(path) shows the field movie; sol = lumi.load(path) loads results.

See bend for a minimal example.

Conventions

Units & frequency

Material properties

Grid & resolution

Frames

Ports & S-parameters

S21 = sol["monitors"]["o2"]["modes"][0]["+"] / sol["monitors"]["o1"]["modes"][0]["-"]
S11 = sol["monitors"]["o1"]["modes"][0]["+"] / sol["monitors"]["o1"]["modes"][0]["-"]

Inverse design

Optimizes the material layout in design regions to meet S-parameter targets. Not in the free tier. See GC_invd.

  1. Draw the design region on its own layer in the component.

  2. Give that layer the material lumi.placeholder_material(n) in the LayerStack, with the lowest mesh_order so it overrides other layers, and the vertical extent to be patterned.

  3. lumi.design(name, layer, lmin, fill_material, void_material, ...): region patterned with fill_material and void_material at minimum feature size lmin. repdims=[3] extrudes a planar pattern along z; symdims enforces symmetry.

  4. lumi.target(src, dst, target, wl=...): one per objective, eg "o2@0-" to "o1@0+" with target=1 for full transmission. Loss is the weighted sum of target errors; use one target per wavelength for broadband.

  5. lumi.optimizer(iters, stoploss, ...): stops after iters or below stoploss. contrast below 1 allows topology change and rises quadratically to 1 (binary) as loss approaches lowloss, or by iteration 25.

  6. Pass designs, targets, optimizer to setup, then solve runs the optimization.

Outputs in the run folder: history.json (loss per iteration) and designs/<name>/mask.npy (optimized boolean fill mask).

Run folder & files

One folder per simulation, eg runs/bend: