gplugins.gmeep.write_sparameters_meep_mpi

gplugins.gmeep.write_sparameters_meep_mpi#

gplugins.gmeep.write_sparameters_meep_mpi(component: ComponentSpec, layer_stack: LayerStack | None = None, cores: int = 4, filepath: str | Path | None = None, dirpath: str | Path | None = None, temp_dir: Path = PosixPath('/tmp/gdsfactory/temp'), temp_file_str: str = 'write_sparameters_meep_mpi', live_output: bool = False, overwrite: bool = False, wait_to_finish: bool = True, **kwargs) Path[source]#

Write Sparameters using multiple cores and MPI and returns Sparameters filepath.

Simulates each time using a different input port (by default, all of them) unless you specify port_symmetries:

checks stderror and kills MPI job if there is any stderror message

port_symmetries = {“o1”:
{

“s11”: [“s22”,”s33”,”s44”], “s21”: [“s21”,”s34”,”s43”], “s31”: [“s13”,”s24”,”s42”], “s41”: [“s14”,”s23”,”s32”],

}

}

Parameters:
  • component – gdsfactory Component.

  • cores – number of processors.

  • filepath – to store pandas Dataframe with Sparameters in CSV format. Defaults to dirpath/component_.csv.

  • dirpath – directory to store sparameters in CSV. Defaults to active Pdk.sparameters_path.

  • layer_stack – contains layer to thickness, zmin and material. Defaults to active pdk.layer_stack.

  • temp_dir – temporary directory to hold simulation files.

  • temp_file_str – names of temporary files in temp_dir.

  • live_output – stream output of mpirun command to file and print to console (meep verbosity still needs to be set separately).

  • overwrite – overwrites stored simulation results.

  • wait_to_finish – if True makes the function call blocking.

Keyword Arguments:
  • resolution – in pixels/um (30: for coarse, 100: for fine).

  • port_symmetries – Dict to specify port symmetries, to save number of simulations.

  • dirpath – directory to store Sparameters.

  • port_margin – margin on each side of the port.

  • port_monitor_offset – offset between monitor GDS port and monitor MEEP port.

  • port_source_offset – offset between source GDS port and source MEEP port.

  • filepath – to store pandas Dataframe with Sparameters in CSV format.

  • animate – saves a MP4 images of the simulation for inspection, and also outputs during computation. The name of the file is the source index.

  • lazy_parallelism – toggles the flag “meep.divide_parallel_processes” to perform the simulations with different sources in parallel.

  • dispersive – use dispersive models for materials (requires higher resolution).

  • xmargin – left and right distance from component to PML.

  • xmargin_left – west distance from component to PML.

  • xmargin_right – east distance from component to PML.

  • ymargin – top and bottom distance from component to PML.

  • ymargin_top – north distance from component to PML.

  • ymargin_bot – south distance from component to PML.

  • extend_ports_length – to extend ports beyond the PML.

  • zmargin_top – thickness for cladding above core.

  • zmargin_bot – thickness for cladding below core.

  • tpml – PML thickness (um).

  • clad_material – material for cladding.

  • is_3d – if True runs in 3D.

  • wavelength_start – wavelength min (um).

  • wavelength_stop – wavelength max (um).

  • wavelength_points – wavelength steps.

  • dfcen – delta frequency.

  • port_source_name – input port name.

  • port_margin – margin on each side of the port.

  • distance_source_to_monitors – in (um) source goes before.

  • port_source_offset – offset between source GDS port and source MEEP port.

  • port_monitor_offset – offset between monitor GDS port and monitor MEEP port.

Returns:

filepath for sparameters CSV (wavelengths, s11a, o1@0,o2@0, …)

where a is the angle in radians and m the module.