ExamplesMeep Examples

Ring Resonator (Cylindrical)

Calculate ring resonator modes using cylindrical coordinates with angular dependence

Ring Resonator in Cylindrical Coordinates

This example calculates 2D ring-resonator modes using cylindrical coordinates, where modes have angular dependence exp(imφ) for integer m.

Overview

Cylindrical ring resonators are fundamental structures for:

  • Whispering gallery mode (WGM) resonators: Ultra-high Q cavities
  • Integrated photonics: On-chip filters and sensors
  • Optical gyroscopes: Rotation sensing
  • Nonlinear optics: Enhanced light-matter interaction

Using cylindrical coordinates exploits the rotational symmetry for efficient simulation.

Simulation Parameters

ParameterDefault ValueDescription
resolution20Pixels per μm
n3.4Waveguide refractive index
w1Waveguide width
r1Inner radius of ring
pad4Padding to PML
dpml32PML thickness
m3Angular mode number
fcen0.15Center frequency
df0.1Frequency width

Physical Setup

The ring resonator structure:

  1. Ring waveguide: High-index (n=3.4) annular waveguide
  2. Angular modes: exp(imφ) dependence, where m is an integer
  3. Cylindrical simulation: Uses Meep's dimensions=mp.CYLINDRICAL
  4. Point source: Ez-polarized excitation

The angular mode number m determines the number of wavelengths that fit around the ring circumference. Higher m gives higher-order modes.

Python Code

"""
Ring Resonator in Cylindrical Coordinates with OptixLog Integration

Calculates 2D ring-resonator modes using cylindrical coordinates
with angular dependence exp(imφ).

Based on the Meep tutorial: ring-cyl.py
"""

import os
import argparse
import optixlog
import meep as mp
import matplotlib
matplotlib.use("agg")
import matplotlib.pyplot as plt
import numpy as np

api_key = os.getenv("OPTIX_API_KEY", "")
api_url = os.getenv("OPTIX_API_URL", "https://optixlog.com")
project_name = os.getenv("OPTIX_PROJECT", "MeepExamples")


def main(args):
    """Main simulation function for cylindrical ring resonator."""
    
    if not optixlog.is_master_process():
        return
    
    try:
        client = optixlog.init(
            api_key=api_key,
            api_url=api_url,
            project=project_name,
            run_name=f"ring_cyl_m{args.m}",
            config={
                "simulation_type": "ring_resonator",
                "angular_mode": args.m
            },
            create_project_if_not_exists=True
        )
        
        # Simulation parameters
        n = 3.4       # index of waveguide
        w = 1         # width of waveguide
        r = 1         # inner radius of ring
        pad = 4       # padding
        dpml = 32     # PML thickness
        resolution = 20
        
        m = args.m
        fcen = args.fcen
        df = args.df
        
        client.log(
            step=0,
            resolution=resolution,
            waveguide_index=n,
            waveguide_width=w,
            inner_radius=r,
            angular_mode_m=m,
            center_frequency=fcen,
        )
        
        # Cell setup
        sr = r + w + pad + dpml
        cell = mp.Vector3(sr, 0, 0)
        
        geometry = [
            mp.Block(
                center=mp.Vector3(r + (w / 2)),
                size=mp.Vector3(w, mp.inf, mp.inf),
                material=mp.Medium(index=n),
            )
        ]
        
        pml_layers = [mp.PML(dpml)]
        
        sources = [
            mp.Source(
                src=mp.GaussianSource(fcen, fwidth=df),
                component=mp.Ez,
                center=mp.Vector3(r + 0.1),
            )
        ]
        
        sim = mp.Simulation(
            cell_size=cell,
            geometry=geometry,
            boundary_layers=pml_layers,
            resolution=resolution,
            sources=sources,
            dimensions=mp.CYLINDRICAL,
            m=m,
        )
        
        # Run with Harminv
        harminv = mp.Harminv(mp.Ez, mp.Vector3(r + 0.1), fcen, df)
        
        sim.run(
            mp.after_sources(harminv),
            until_after_sources=200,
        )
        
        modes = harminv.modes
        client.log(step=1, num_modes_found=len(modes))
        
        for i, mode in enumerate(modes):
            client.log(
                step=2 + i,
                mode_number=i + 1,
                frequency=float(mode.freq),
                quality_factor=float(mode.Q) if mode.Q > 0 else 0,
            )
        
    except Exception as e:
        print(f"Simulation Error: {e}")


if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("-fcen", type=float, default=0.15)
    parser.add_argument("-df", type=float, default=0.1)
    parser.add_argument("-m", type=int, default=3)
    args = parser.parse_args()
    main(args)

How to Run

# Set your OptixLog API key
export OPTIX_API_KEY="your_api_key_here"

# Run with default angular mode m=3
python ring-cyl.py

# Different angular modes
python ring-cyl.py -m 5
python ring-cyl.py -m 10

# Custom frequency range
python ring-cyl.py -fcen 0.2 -df 0.15

Results and Analysis

Resonant Modes

Harminv identifies modes characterized by:

  • Frequency: Resonance frequency in units of c/a
  • Quality factor (Q): Energy confinement measure
  • Angular mode (m): Number of azimuthal wavelengths

Mode Spacing

For a ring of radius R and index n:

  • Free spectral range: FSR ≈ c/(2πnR)
  • Mode frequencies: f_m ≈ mc/(2πnR)

Field Profiles

The radial field profile shows:

  • Mode confinement: Field localized in waveguide
  • Evanescent tails: Decay outside waveguide
  • Radial nodes: For higher radial-order modes

OptixLog Metrics

  • angular_mode_m: The m parameter for exp(imφ)
  • frequency: Mode resonance frequency
  • quality_factor: Q factor
  • max_field_amplitude: Peak field strength

Higher angular modes (larger m) have higher frequencies. Use m to select specific resonances within the frequency band.

Physical Insights

For large m values:

  • Light circulates via total internal reflection
  • Very high Q factors achievable
  • Mode volume scales with ring circumference

Bending Loss

The Q factor depends on:

  • Ring radius: Larger radius → lower bending loss
  • Index contrast: Higher contrast → better confinement
  • Angular mode: Higher m → mode pushed outward

On this page