Conversation
vvahidd
marked this pull request as draft
January 21, 2026 19:50
Member
|
Can we move geometry outside of the fdtd subpackage? I think it would be nice if we have a unified geometry base over all simulators (not only fdtd). |
Add MEEP photonic FDTD simulation with cloud execution: - MeepSim fluent API (set_geometry, set_stack, set_wavelength, etc.) - SimConfig JSON + GDS file + runner script for cloud upload - S-parameter result parsing, port extraction, material resolution - 49 tests Extract shared modules from fdtd into gsim.common: - LayeredComponentBase (ported from gplugins) - GeometryModel + Prism dataclass for solver-agnostic 3D geometry - Visualization backends (PyVista, Open3D, Three.js, Matplotlib) Remove gsim.fdtd (Tidy3D wrapper): - Zero tests, zero usage outside itself - All reusable code already extracted to common
- Add meep-sim-*/ pattern to .gitignore (matches palace-sim-*/ convention) - Update notebook output dir from meep-sim to meep-sim-test - Minor ruff auto-fixes in visualization.py and palace/ports.py
…tests - Add SimOverlay/PortOverlay models for rendering sim cell, PML, ports on 2D slices - Add MarginConfig to meep models (pml_thickness, margin_xy, margin_z) - Expand render2d to draw sim cell boundary, PML regions, source/monitor ports - Add plot_2d() to MeepSim with overlay support - Update run_meep.py template to read margin config instead of hardcoded padding - 62 meep-specific tests passing (was 49), 119 total
Add set_z_crop() to crop the layer stack around the photonic core, reducing simulation domain by ~60% for typical SOI stacks. Replace the non-standard run_time_factor/df formula with MEEP's standard until_after_sources for more robust simulation termination. Also fix PDK activation in the cloud runner script and update docs with Docker integration details and typical workflow. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…nd slabs Rename MarginConfig → DomainConfig with split z-margins (margin_z_above/ margin_z_below) and dpml field. set_z_crop() now derives crop window from DomainConfig instead of explicit pad params. Add dielectric background slabs from stack.dielectrics — serialized to JSON and built as mp.Block objects in the runner script (placed first so patterned prisms override). Add DielectricOverlay rendering in plot_2d cross-sections. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add SymmetryEntry + StoppingConfig models, set_symmetry() API, decay-based stopping in runner script, reduce default margins (1.0 → 0.5), reduce default num_freqs (21 → 11), and wire split_chunks_evenly=False through to mp.Simulation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When all layers share the same mesh_order (e.g. UBC PDK defaults to 3), background layers like clad were drawn on top of patterned layers like the waveguide core, hiding the device structure entirely. - Sort draw order by (mesh_order, -polygon_area) so smaller/patterned layers render on top of large fill layers - Add per-layer zorder bump within same mesh_order group - Add area-based alpha: background layers ~0.35, patterned layers ~0.90 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add port_margin (default 2.0um) to DomainConfig so mode monitors extend beyond waveguide width to capture evanescent tails (~70% power was lost with monitor width = waveguide width) - Add explicit eig_kpoint, direction, eig_match_freq to EigenModeSource and kpoint_func to get_eigenmode_coefficients (matches gplugins) - Change default decay_component from Ez to Ey (dominant TE component) - Show direction arrows on all ports in 2D viz, not just sources - Add generate_meep_config.py and test_meep_local.sh for local testing Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…on, and verbose stepping Dense GDS curves (e.g. ebeam_y_1550 with 1292 vertices) make MEEP's subpixel averaging extremely slow. This adds configurable polygon simplification, subpixel tuning, and FDTD progress logging via a new AccuracyConfig model and set_accuracy() fluent API. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add stop_when_dft_decayed mode (monitors all DFT monitors for convergence, built-in min/max time) as the recommended stopping for S-parameter extraction. Fix decay mode to use MEEP's native list-based OR logic [decay_fn, run_after] instead of the broken decay_by=1.0 time cap hack. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
port_margin=2.0 created oversized monitor cross-sections where MPB band 1 was a cladding mode (n_eff≈1.43) instead of the guided TE0 mode (n_eff≈2.44). Reducing to 0.5 (matching gplugins) fixes S-parameter extraction. The runner now saves meep_debug.json with per-port n_eff, kdom, raw coefficients, and power conservation for post-run diagnostics. SParameterResult.from_csv() auto-loads it into the debug_info field. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add DiagnosticsConfig for controlling MEEP runner outputs: geometry cross-section PNGs, field snapshots, raw epsilon, and preview-only mode that skips FDTD for fast geometry validation. SParameterResult gains from_directory() for preview results and show_diagnostics() for Jupyter. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…pping Add save_animation_frame() and compile_animation_mp4() to the runner template, hooked via mp.at_every() step function when save_animation=True. Frames are saved as meep_frame_NNNN.png and stitched into meep_animation.mp4 via ffmpeg with graceful fallback. - Add animation_interval field to DiagnosticsConfig - Wire animation_interval through set_diagnostics() in MeepSim - Detect animation MP4 + frame PNGs in SParameterResult - Add show_animation() for Jupyter video display - Extend test_meep_local.sh to collect MP4 files from Docker Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Decouple source bandwidth and stopping config from wavelength setup. The source fwidth was incorrectly tied to monitor df, causing edge frequencies to be starved of spectral power. Auto fwidth is now max(3*monitor_df, 0.2*fcen), matching gplugins' dfcen=0.2 convention. New API: set_source(bandwidth, port), set_stopping(mode, max_time, threshold) Old kwargs on set_wavelength() and set_source_port() emit DeprecationWarning. Runner template uses fallback chains so old JSON configs still work. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ngth stopping kwargs dft_min_run_time=0 caused false early convergence when DFT monitors saw near-zero fields before the pulse had traversed the device. The new default of 100 time units exceeds typical transit times (device_length * n_group). Also removes the deprecated stopping parameter forwarding from set_wavelength() — callers should use set_stopping() directly. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…esults cells standalone Sync notebook config (bandwidth=0.01, resolution=20, explicit dft_min_run_time=100, save_animation=True) with generate_meep_config.py. Make S-parameter loading/plotting cells self-contained by defining output_dir independently so they can run without the config cells. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…imConfig - Extract _find_highest_n_layer() helper shared by ports.py and base.py - Add _ensure_stack() to DRY up 5 lazy stack resolution sites - Remove deprecated set_source_port() method - Remove old config fallback patterns in runner template - Type SimConfig fields with Pydantic models instead of dict[str, Any] - Convert FDTDConfig fcen/df to @computed_field (included in model_dump) - Add fwidth stored field to SourceConfig, remove to_dict() from all models - Update write_config() to pass model instances directly Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…r height Rework render_animation_frames to use two-pass .npz approach (save raw field data during sim, render with fixed global colorbar after) and fix plot style: figsize (10,8)→(5,4) for larger relative fonts, make_axes_locatable for colorbar matching plot height, dpi 100→150. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Docker's default 64MB /dev/shm is insufficient for UCX shared memory transport with many MPI ranks, causing segfaults during MPI_Init. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
estimate_meep_np() computes MPI process count from voxel grid size (total_voxels // 200k, clamped to [1, 24]). write_config() sets meep_np on SimConfig; entrypoint reads it when MEEP_NP env var is unset and clamps to physical cores at runtime. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…anged) - FDTDConfig → WavelengthConfig (FDTDConfig kept as compat alias) - StoppingConfig: run_after_sources → max_time, decay_by → threshold - verbose_interval moved from set_accuracy() to set_diagnostics() - set_domain() margin param is now keyword-only - set_material() accepts n=/k= short aliases - SimConfig.to_json() uses by_alias=True; JSON output is identical - eps_averaging default changed to False (matches actual usage) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
New API: 6 typed physics objects (Geometry, Material, ModeSource, ModeMonitor, Domain, FDTD) assigned to a Simulation container. Supports field-by-field assignment, float shorthand for materials, typed stopping variants (FixedTime/FieldDecay/DFTDecay), and monitor-driven wavelength config. Translates to existing SimConfig JSON — runner template unchanged. Legacy MeepSim kept for backward compat. Updates notebook and generate script to new API. Consolidates meep-pipeline-overview.md and meep-api-review.md into meep-overview.md. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ModeMonitor objects repeated wavelength/bandwidth/num_freqs on every port but validation enforced they must all match. The runner creates DFT monitors at all ports from config["ports"] regardless — the monitors list was purely client-side boilerplate. Now ModeSource carries the spectral window (bandwidth, num_freqs) and sim.monitors is just a list of port name strings. Source Gaussian fwidth is always auto-computed. JSON contract and runner template unchanged. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Trim notebook from 25 cells to 11 to match palace notebook style. Switch both notebook and generate_meep_config.py to attribute style (sim.solver.resolution = 20) instead of constructor style. Document both styles by name in meep-overview.md. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use logging.getLogger(__name__) in results.py and
logging.getLogger("meep_runner") in the cloud runner template,
matching the convention used by palace and common modules.
Both write_config() and viz (plot_2d/plot_3d) now consume the same BuildResult, eliminating divergence in port extension and cell boundary computation. Also makes run() output_dir optional (auto tempdir).
…ring - Rename nbs/test-meep.ipynb -> nbs/meep_ybranch.ipynb - Add MEEP Y-Branch entry to mkdocs.yml nav - Move meep-overview.md into src/gsim/meep/ - Remove nbs/test_meep_local.sh (obsolete local test script) - Fix concave polygon triangulation in PyVista and Open3D renderers
Replace FixedTime/FieldDecay/DFTDecay classes with scalar fields on FDTD (stopping, max_time, stopping_threshold, etc.) for consistent attribute-style API. Default stopping mode is now dft_decay with max_time=200.
vvahidd
marked this pull request as ready for review
February 16, 2026 21:30
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.