Skip to content

fiber_xposition cannot centre the fibre on the grating because the waveguide feed block buries early teeth #754

Description

@Alisama20

Repo/version: gplugins 2.0.1 on gdsfactory 9.34.2

What happened: In gplugins.gmeep.get_simulation_grating_fiber, grating teeth are placed starting at x = grating_start = -fiber_xposition. The fibre is fixed at x=0 and the parameter is documented to "keep it centered and offset the grating". But the waveguide feed block appended after the teeth loop always spans x in [-sxy, 0], regardless of grating_start. Later Meep geometry overwrites earlier geometry where they overlap, so every tooth at x < 0 is silently buried under solid, un-etched waveguide.

Steps to reproduce:

from gplugins.gmeep import write_sparameters_grating

sp = write_sparameters_grating(
    period=0.6689,
    fill_factor=0.5,
    n_periods=25,
    fiber_angle_deg=8.0,
    fiber_xposition=8.4,  # value needed to centre this grating under the fibre
)

Then probe the dielectric at the centre of each grating gap with sim.get_epsilon_point.

Expected: Increasing fiber_xposition should slide the grating under the fixed fibre without destroying teeth; all 25 gaps should expose cladding.

Actual: The more fiber_xposition is used for its intended purpose, the more teeth are erased:

fiber_xposition gaps exposed (of 25)
0.0 25
1.0 (the library default) 24
3.0 21
6.0 17
8.4 (needed to centre this grating under the fibre) 13

Fixing this single block recovered +0.868 dB coupling efficiency (31.8 % -> 38.9 %) at the fibre's default position, before even sweeping fiber_xposition to actually centre it.

Suggested fix: PR incoming. Replace the waveguide block so it spans from the left PML edge to grating_start instead of to the hardcoded 0:

center=mp.Vector3((grating_start - sxy) / 2, ...),
size=mp.Vector3(grating_start + sxy, etch_depth),

This is a strict generalisation of the existing code and reduces to it exactly when fiber_xposition=0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions