The contexts package#
Summary#
DEVICE finite-element IDE guideline topics. |
|
FDTD-specific guideline topics. |
|
Product-agnostic Lumerical workflow guidance ( |
|
Dictionary-based |
|
INTERCONNECT-specific guideline topics. |
|
Material-selection guidance shared by FDTD and MODE ( |
|
MODE-specific guideline topics. |
|
Shared photonic-integrated-circuit guidance for optical solvers. |
|
S-parameter matrix sweep guidance shared by FDTD and MODE ( |
|
Product-agnostic sweep guidance ( |
|
Material-library creation and database discovery for DEVICE finite-element solvers. |
|
Simulation-region setup shared by HEAT, CHARGE, FEEM, DGTD, and peers. |
|
Finite-element IDE workflow shared by HEAT, CHARGE, FEEM, and DGTD. |
|
FDTD boundary conditions: PML profiles, symmetric/anti-symmetric, periodic, Bloch. |
|
FDTD far-field and grating projection: farfield2d/3d, farfieldexact, NA filtering. |
|
FDTD mesh accuracy, conformal mesh, mesh overrides, auto-shutoff, divergence. |
|
FDTD monitor catalog + field-extraction patterns (override-global, reduce-before-print). |
|
FDTD run + results: solver args, run-once + |
|
FDTD source-type catalog: plane wave, Gaussian, dipole, TFSF, import, BFAST. |
|
Global source/monitor settings and the port-vs-mode-source decision. |
|
FDTD-specific build/setup workflow: stages, PML extension, disambiguation defaults. |
|
Worked end-to-end FDTD example: straight silicon waveguide with TE ports. |
|
Product-agnostic execution model, snippet structure, chunking, do-not rules. |
|
Dictionary-based |
|
INTERCONNECT-specific lumapi command reference by category. |
|
INTERCONNECT simulation config: root element, time/freq domain, result extraction. |
|
INTERCONNECT-specific build/setup workflow: stages, element management, simulation config. |
|
Built-in versus custom materials, anisotropic input. Applies to FDTD and MODE. |
|
MODE EME build/setup and analysis workflow. |
|
MODE FDE solve/result extraction guidance. |
|
MODE FDE build/setup workflow for straight and bent-waveguide tasks. |
|
MODE varFDTD build/setup workflow. |
|
Shared PIC simulation hygiene for FDTD, MODE, and FEEM optical tasks. |
|
S-parameter matrix sweep recipe and Y-branch example for FDTD and MODE. |
|
Product-agnostic nested sweep workflow based on |
|
Product-agnostic sweep lifecycle: addsweep/setsweep/runsweep/getsweepresult. |
Fetch authoritative Lumerical scripting guidelines (markdown) for one topic. |
Description#
Curated Lumerical scripting guidance returned by get_guidelines_for.
This package powers a single MCP tool, get_guidelines_for(), that the
LLM is expected to call BEFORE generating any Lumerical Python (lumapi)
code. It returns authoritative markdown for a chosen topic so the model
does not have to rely on whatever priors it picked up at training time.
Topic taxonomy:
workflow– product-agnostic execution model, snippet structure, chunking, parameter management, and the do-not-assume / do-not-invent rules. Applies to every Lumerical product. Lives inansys.lumerical.mcp.contexts.general.sweeps– product-agnostic lifecycle of analysis tasks created withaddsweep(parameter sweep, optimization, Monte Carlo, S-parameter, corner sweep). Applies to FDTD, MODE, and INTERCONNECT. Lives inansys.lumerical.mcp.contexts.sweeps.pic– shared guided-wave photonic simulation hygiene for optical elements: PML extension of continuing guided structures, mode-solver / port span padding, and avoiding accidental substrate-mode selection. Applies to FDTD, MODE, and FEEM. Lives inansys.lumerical.mcp.contexts.pic.nested_sweeps– product-agnostic hierarchical sweep guidance: build the inner sweep first, wrap it withinsertsweep, then run the outer parent sweep for all parameter combinations. Lives inansys.lumerical.mcp.contexts.sweeps.materialsandgeometry– shared between FDTD and MODE (and, forgeometry, DEVICE), since those products share the same material database and layout-object lumapi calls. Live inansys.lumerical.mcp.contexts.materialsandansys.lumerical.mcp.contexts.geometry.s_parameter_sweep– shared FDTD and MODE recipe for theaddsweep(3)S-parameter matrix sweep, with a Y-branch worked example. Lives inansys.lumerical.mcp.contexts.s_parameter_sweep.fdtd_workflow,fdtd_workflow_example,fdtd_sources_monitors,fdtd_run_and_results,fdtd_boundary_conditions,fdtd_mesh_and_convergence,fdtd_source_types,fdtd_monitors_and_field_extraction,fdtd_far_field_and_grating– FDTD-specific topics split into a build/setup half (fdtd_workflow+fdtd_workflow_example+fdtd_sources_monitors), a run/results half (fdtd_run_and_results), and four deep-dive topics on boundary conditions, mesh/convergence, non-port source types, monitors and field extraction, and far-field/grating projections, all owned byansys.lumerical.mcp.contexts.fdtd.interconnect_workflowandinterconnect_commands– INTERCONNECT-specific topics covering build/setup workflow and command reference, both owned byansys.lumerical.mcp.contexts.interconnect.device_workflow,device_materials, anddevice_simulation_region– finite-element IDE (DEVICE) topics covering the shared HEAT / CHARGE / FEEM / DGTD build/run workflow, model-material creation, and simulation-region setup. Owned byansys.lumerical.mcp.contexts.device.mode_fde_workflow,mode_fde_results, andmode_eme_workflowandmode_varfdtd_workflow– MODE-specific topics covering FDE setup, FDE solve/results, EME setup/analysis workflow, and varFDTD setup/run guidance, all owned byansys.lumerical.mcp.contexts.mode.The system prompt (
ansys.lumerical.mcp.prompts) is itself product-agnostic and does not need to change for new product topics.
Module detail#
- contexts.get_guidelines_for(content: GuidelinesContent) str#
Fetch authoritative Lumerical scripting guidelines (markdown) for one topic.
Call this tool BEFORE writing any Lumerical Python (lumapi) code, once per topic you need. Always fetch
"workflow"first (the product-agnostic execution model and do-not-assume rules), then add the product-specific topics that match the task.- Parameters:
- content
str Topic to retrieve. One of:
"workflow"– product-agnostic execution model: chunkedexecute_python_codesnippets against the persistent subprocess, the seeded_lum_get/_lum_print_jsonhelpers, per-productcalling conventions, and the do-not-assume / do-not-invent / do-not-re-run rules. Applies to FDTD, MODE, DEVICE, INTERCONNECT..run() "sweeps"– product-agnosticaddsweeplifecycle (parameter sweep, optimization, Monte Carlo, S-parameter, corner sweep), the dict-as-struct payload convention foraddsweepparameter/addsweepresult, thedeletesweepidempotent-rebuild pattern, and result extraction viagetsweepresult. Applies to FDTD, MODE, INTERCONNECT."pic"– shared photonic simulation hygiene for optical elements: extending continuing guided structures through PML, giving ports / mode-solver windows enough wavelength-scale padding around the confined mode, and avoiding accidental substrate-mode selection. Applies to FDTD, MODE, and FEEM."nested_sweeps"– product-agnostic hierarchical sweep workflow: build the inner sweep first, wrap it withinsertsweep, configure the outer sweep, then run the outer parent sweep to evaluate all parameter combinations."materials"– built-in vs. custom material selection, theaddmaterial()/setmaterial()handle pattern, and anisotropic material input (diagonal + grid-attribute general anisotropy). Shared by FDTD and MODE."geometry"– dictionary-basedaddrect/addXsyntax for Lumerical layout objects and the"x span"(not"x_span") property-naming convention. Shared by FDTD, MODE, and DEVICE."fdtd_workflow"– FDTD-specific build/setup stages, disambiguation defaults (3D, PML on all open boundaries, SI units, built-in materials), and the PML boundary-extension rule. Pair with"fdtd_run_and_results"for the run/results half."fdtd_workflow_example"– full worked example (straight silicon waveguide with TE port S-parameter extraction): pre-flight default-confirmation checklist followed by Steps 1-8 with the exactexecute_python_codesnippet for each chunk."fdtd_sources_monitors"–setglobalsource/setglobalmonitorusage (and the no-dict-syntax exception); preferaddport()overaddmode()for S-parameter extraction; port direction convention."fdtd_run_and_results"– FDTD-specificrun()arguments (solver / resource / GPU / Ansys Cloud Burst), therun()-once +switchtolayoutrule, the dataset-is-a-dict contract forgetresult, mandatory_lum_print_jsoninspection before indexing, the per-port S vs. full S-matrix distinction, and thefdtd.eval("escape hatch.;") "fdtd_boundary_conditions"– BC decision guide and the four FDTD BC families: PML profiles (standard / stabilized / steep angle / custom), symmetric and anti-symmetric, periodic, and Bloch (plus when to switch to the BFAST plane-wave source for broadband angled incidence)."fdtd_mesh_and_convergence"–"mesh accuracy"semantics (ppw vs. integer 1-8), conformal-mesh refinement variants,addmeshoverrides for thin features and metals,simulation time/ auto-shutoff interplay, and divergence diagnostics via the FDTD solverSTATUSresult."fdtd_source_types"– non-port source catalog with a decision tree:addplane/ BFAST plane-wave,addgaussian,adddipole,addtfsf, andaddimportedsource; gotchas (TFSF interface crossings, broadband-angle injection, dipole homogeneous validation)."fdtd_monitors_and_field_extraction"– monitor type decision table (DFT power / profile / time / movie / index / mode-expansion),"override global monitor settings"pattern, mode-expansion analysis, and thereduce-before-printpattern that keeps 3D fields from blowing through the_lum_print_jsontruncation guard."fdtd_far_field_and_grating"– turning near-field monitor data intofarfield2d/farfield3d/farfieldexactprojections, grating-order analysis (gratingn1/gratingn2/grating/gratingangle/gratingpolar), and NA / cone filtering viafarfield3dintegrate."s_parameter_sweep"– full N x N S-matrix extraction viaaddsweep(3)/runsweep/getsweepresult("s-parameter sweep", "S matrix"), with a Y-branch worked example (auto symmetry) and Touchstone / INTERCONNECT export. Shared by FDTD and MODE; fetch whenever the user asks for the full S-matrix of a multi-port device."mode_fde_workflow"– MODE FDE-specific build/setup workflow: safeaddfde()+setnamed()configuration, bent-waveguide keys, active-property caveats, and sweep-safe reuse of clean pre-run setup files."mode_fde_results"– MODE FDE solve/result guidance: when to usefindmodes(), commongetdata()fields such asneff/loss/TE polarization fraction/ng, and robust TE/TM classification across sweeps."mode_eme_workflow"– MODE EME-specific build/setup and analysis workflow: cell-group setup, matrix-stylegroup spans/cellspayloads, layout-vs-analysis mode rules,emepropagate()/emesweep(), port hygiene, and user-S-matrix interpretation."mode_varfdtd_workflow"– MODE varFDTD-specific build/setup workflow: when to use the 2.5D propagator, effective-index setup, bandwidth choices, supported source / monitor classes, and validation of generated effective materials."interconnect_workflow"– INTERCONNECT-specific build/setup workflow: chunked stages for library validation, element addition and naming, port discovery, connections, property discovery, and save/run sequencing. Fetch for any INTERCONNECT photonic circuit task."interconnect_simulation"– INTERCONNECT root element simulation configuration ("simulation input"mode selector, time-domain property sets, ONA frequency-domain workflow) andgetresultdiscovery pattern for analyzers. Fetch alongside"interconnect_workflow"for any simulation setup or result extraction task."interconnect_commands"– INTERCONNECT-specific lumapi command reference: element library, design kits, measurements, scripted elements, optimization, and export commands. Fetch when you need the exact command name or signature for an INTERCONNECT operation."device_workflow"– finite-element IDE (DEVICE) workflow shared by HEAT, CHARGE, FEEM, and DGTD: chunked stages for model-material creation, geometry, solver addition, simulation- region linkage, boundary conditions (children of the solver’sboundary conditionsobject), monitors (children of the solver object), run, and result collection from both monitors and the solver object itself."device_materials"– model-material creation viaaddmodelmaterial/addmaterialproperties, property families (EM / CT / HT), selection hygiene after eachaddmaterialpropertiescall, and database discovery. Shared by HEAT, CHARGE, FEEM, and DGTD."device_simulation_region"– simulation-region ownership model (region is separate from the solver object), per-face boundary types (Open / Closed / Shell), background material, and linking the region to a solver viasetnamed(solver, "simulation region", region_name). Shared by HEAT, CHARGE, FEEM, and DGTD.
- content
- contexts.GuidelinesContent#