Skip to main content

Source

The subsequent code will exemplify the process of incorporating a light source and port within a simulation project.

As of now, the source module accommodates the inclusion of mode source and Gaussian source. Furthermore, our platform extends support for ports into both EME and FDTD simulations.

4.1 Waveform

In FDTD simulations, waveforms are utilized to control the bandwidth of the source pluse. You can simply enter the central wavelength and range into the added waveform, and the bandwidth and shape of the pulse source will be automatically calculated.

The syntax and properties for adding waveform are as follows. This function does not return any data.

add(
name: str,
type: Literal["gaussian_waveform"],
property: dict
)

Set frequency wavelength

ParameterTypeDefaultDescription
range_typestring-Selects "frequency" or "wavelength".
range_limitstring-Selects "min_max" or "center_span".
wavelength_center, frequency_centernumber-The wavelength center and frequency center.
wavelength_span, frequency_spannumber-The wavelength span and frequency span.
wavelength_min, wavelength_maxnumber-The minimum wavelength and maximum wavelength.
frequency_min, frequency_maxnumber-The minimum frequency and maximum frequency.

Set time domain

ParameterTypeDefaultDescription
pulsetypestring-Set the source to standard or broadband.
frequencynumber-The center frequency of the optical carrier.
pulselengthnumber-The duration of the pulse's full width at half maximum power.
offsetnumber-The time it takes for the source to reach its peak amplitude, measured relative to the start of the simulation.
bandwidthnumber-The full width at half maximum frequency of the time-domain pulse.

Example:

The following script adds a gaussian waveform by setting the wavelength to 1.55 um and the wavelength span to 0.1 um. This script assumes that FDTD solver has been added to the simulation environment, and the pj is an instance of the project.

waveform name = "wv1550"
wv = pj.Waveform()
wv.add(name=waveform name, type="gaussian_waveform",
property={"set": "frequency_wavelength", # selections are ["frequency wavelength","time domain"]
"set frequency_wavelength": {
"range_type": "wavelength", # selections are ["frequency","wavelength"]
"range_limit": "center_span", # selections are ["min max","center span"]
"wavelength_center": 1.55,
"wavelength__span": 0.1,
}})

4.2 Mode source

The syntax and properties for adding mode source are as follows. This function does not return any data.

add(
name: str,
type: Literal["mode_source"],
property: dict,
)

General

ParameterTypeDefaultDescription
inject axisstring-Selects the mode source propagation along the x-axis, y-axis or zaxis.
directionstringforwardSelects the forward or backward direction of propagation for the mode source.
amplitudenumber1.0Specifies the peak amplitude of the electric field, with the unit in V/m.
phasenumber0.0Specifies the initial phase of the source, with the unit in degrees.
mode_selectionstring-Selects "fundamental", "fundamental TE", "fundamental TM" or "user select" to inject mode.
mode_indexinteger0Selects the mode number from the list of calculated modes.
searchstringmax_indexSelects "max index" or "near n" to search modes.
nnumber1.0Searchs modes near the specified effective index.
number_of_trial_modesinteger20Records the maximum number of modes in the mode list.
waveformobject-Selects the waveform ID from source pulse waveform list.

Geometry

ParameterTypeDefaultDescription
x, y, znumber-The center position of the mode source.
x span, y span, z spannumber-X span, Y span, Z span of the mode source.
x min, x maxnumber-X min, X max position of the mode source.
y min, y maxnumber-Y min, Y max position of the mode source.
z min, z maxnumber-Z min, Z max position of the mode source.

Boundary conditions

Select the override default boundary conditions to True, and each boundary condition can be set separately. The optional boundary conditions include "PEC", "PMC", "PML", "symmetric" or "anti symmetric".

If the fraction of magnetic field intensity in PML is greater than the specified threshold, the mode is discarded.

Example:

The following script adds a mode source in FDTD simulation, sets the position and dimension of the light source, as well as the mode profile and waveform. This script assumes that FDTD solver has been added to the simulation environment, and the pj is an instance of the project.

wv_id = wv["waveform_name"]     # Selects the waveform ID from source pulse waveform list.
src = pj.Source()
src.add(name="source", type="mode_source", property={
"general": {"amplitude": 1, "phase": 0, "rotations": {"theta": 0, "phi": 0, "rotation_offset": 0},
"mode_selection": "fundamental", "waveform": {"waveform_id": wv_id},
"inject_axis": "x axis", "direction": "forward"},
"geometry": {"x": 0, "x span": 0, "y": 0, "y span": 3, "z": 0, "z span": 3},
"modal_analysis": {"mode_removal": {"threshold": 0.01}}})

4.3 Gaussian source

The syntax and properties for adding gaussian source are as follows. This function does not return any data.

add(
name: str,
type: Literial["gaussian source"],
property: dict,
)

General

ParameterTypeDefaultDescription
inject_axisstring-Selects the mode source propagation along the x-axis, y-axis or zaxis.
directionstringforwardSelects the forward or backward direction of propagation for the mode source.
amplitudenumber1.0Specifies the peak amplitude of the electric field, with the unit in V/m.
phasenumber0.0Specifies the initial phase of the source, with the unit in degrees.
waveformobject-Selects the waveform ID from source pulse waveform list.
angle_thetanumber0The angle between the propagation direction and the injection axis of source, with the unit in degrees.
angle_phinumber0In a right-hand coordinate system, the angle of propagation is rotated around the injection axis of the source.
polarization_anglenumber0The polarization angle defines the orientation of the injected electric field. A polarization angle of zero degrees indicates P-polarized radiation, while an angle of 90 degrees indicates S-polarized radiation.

beam_settings:
Beam_parameters: Selects "waist_size_and_position" or "beam_size_and_divergence" to set the beam parameters. Waist_radius and distance_from_caist are valid when beam_parameters is set to waist_steze_1and_position. Similarly, beam_radius and divergence_angle are valid when beam_marameters is selected as beam_size_and_divergence.
waist radius: 1/e field (1/e2 power) radius of the beam for a Gaussian beam.
distance from waist: The distance between the injection plane and the beam waist. A positive distance indicates a diverging beam, while a negative distance indicates a converging beam. beam radius: 1/e field (1/e2 power) radius of the beam for a Gaussian beam.
divergence angle: The radiation divergence angle measured in the far field. A positive angle indicates a diverging beam, while a negative angle indicates a converging beam.

Geometry

ParameterTypeDefaultDescription
x, y, znumber-The center position of the gaussian source.
x span, y span, z spannumber-X span, Y span, Z span of the gaussian source.
x min, x maxnumber-X min, X max position of the gaussian source.
y min, y maxnumber-Y min, Y max position of the gaussian source.
z min, z maxnumber-Z min, Z max position of the gaussian source.

Example:

The following script adds a gaussian source in FDTD, sets the position and dimension of the light source, as well as the mode profile and waveform. This script assumes that FDTD solver has been added to the simulation environment, and the pj is an instance of the project.

wv_id = wv["waveform_name"]     # Selects the waveform ID from source pulse waveform list.
so = pj.Source()
so.add(name="source", type="gaussian_source", axis="z_backward",
property={"general": {"angle_theta": 0, "angle phi": 0, "polarization_angle": 0, "waveform": {"waveform_id": wv_id},
"beam_settings": {"calculation method": "use_scalar_approximation",
"beam_parameters": "waist_size_and_position",
"waist_radius": 5.2, "distance_from_waist": 1.5}},
"geometry": {"x": 4, "x span": 20, "y": 0, "y span": 20, "z": 1.5, "z span": 0}})

4.3 FDTD port

Incorporate a port into the current FDTD simulation project.

add(
name: str,
type: Literal["fdtd port"],
property: dict
)

Geometry

ParameterTypeDefaultDescription
x, y, znumber-The center position of the FDTD port.
x span, y span, z spannumber-X span, Y span, Z span of the FDTD port.
x min, x maxnumber-X min, X max position of the FDTD port.
y min, y maxnumber-Y min, Y max position of the FDTD port.
z min, z maxnumber-Z min, Z max position of the FDTD port.

Boundary conditions

Select the override default boundary conditions to True, and each boundary condition can be set separately. The optional boundary conditions include "PEC", "PMC", "PML", "symmetric" or "anti symmetric".

If the fraction of magnetic field intensity in PML is greater than the specified threshold, the mode is discarded.

Example:

The following script adds a port in FDTD simulation, sets the position and dimension of the light source, as well as the mode profile and waveform. This script assumes that FDTD solver has been added to the simulation environment, and the pj is an instance of the project.

wv_id = wv["waveform_name"]     # Selects the waveform ID from source pulse waveform list.
pt = pj.Port(property={"waveform_id": wv_id, "source port": "port_left"})
pt.add(name="port_left", type="fdtd_port",
property={"geometry": {"x": 0, "x span": 0, "y": 0,
"y span": 3, "z": 0, "z span": 3},
"modal_properties": {"general": {"inject axis": "x_axis", "direction": "forward",
"mode_selection": "fundamental"}}})

4.4 EME port

The syntax and properties for adding mode source are as follows. This function does not return any data.

add(
name: str,
type: Literal["eme_port"],
property: dict,
)

Geometry

ParameterTypeDefaultDescription
port locationstring-Set the location of EME port, selections are "left" and "right".
use full simulation spanbooleanTrueSet whether the port uses the full simulation area, selections are "True" and "False".
x, y, znumber-The center position of the EME port.
x span, y span, z spannumber-Xspan, Y span, Z span of the EME port.
x min, x maxnumber-X min, X max position of the EME port.
y min, y maxnumber-Y min, Y max position of the EME port.
z min, z maxnumber-Z min, Z max position of the EME port.

EME port

ParameterTypeDefaultDescription
mode selectionstringSelects "fundamental", "fundamental TE", "fundamental TM" or "user select" to inject mode.
mode indexinteger0Selects the mode number from the list of calculated modes.
searchstringmax indexSelects "max index" or "near n" to search modes.
nnumber1.0Searchs modes near the specified effective index.
number of trial modesinteger20Records the maximum number of modes in the mode list.

Boundary conditions

Select the override default boundary conditions to True, and each boundary condition can be set separately. The optional boundary conditions include "PEC", "PMC", "PML", "symmetric" or "anti symmetric".

If the fraction of magnetic field intensity in PML is greater than the specified threshold, the mode is discarded.

Example: The following script adds ports in EME simulation, selects the mode of "port1" as the source, and sets the calculation fundamental mode and the size is the span of the full simulation area. This script assumes that EME solver has been added to the simulation environment, and the pj is an instance of the project.

pjp = pj.Port(property={"source_port": "port1"})
pjp.add(name="port1", type="eme_port",
property={"geometry": {"port_location": "left", "use_full_simulation span": True},
"eme_port": {"general": {"mode_selection": "user_select", "mode_index": 0, "number_of_trial_modes": 20}}})
pjp.add(name="port2", type="eme_port",
property={"geometry": {"port_location": "right", "use_full_simulation_span": True},
"eme_port": {"general": {"mode_selection": "user_select", "mode_index": 0, "number_of_trial_modes": 20}}})

5 Optical Generation

To calculate optical current in simulations, users need to import optical generation rate data with coordinate information. There are three methods for leading optical generation in simulation:

Users can select "import_data" in the "DataSpace" section and set up property of source.

add_ddm_settings(pj, run_options)

ds = pj.DataSpace()

ds.import_data(name="gen", type="generation", property={
"path": gen_rate_file
})

src = pj.Source()
src.add(name="gen", type="optical_generation", property={
"general": {"generation_data": ds["gen"], "source_fraction": 0.001},
"transient": {"envelop": "uniform"}
})

Name: Users can read and edit the name of this generation rate, which defaults to the name of the imported file.

path--Here it's not empty, meaning that the file at the path will be imported to the DDM solver source_fraction--Set the scaling factor for the light power. The imported optical generation rate will be multiplied by this factor first, and then be used to solve the carrier transport

Transient: Choosing "Uniform" requires users to define "Amplitude" and "Time Delay”. Amplitude: Set the maximum amplitude of the mode source. Time Delay: Define the delay time before opening the source. For Pulse, users should define parameters such as High Amplitude, Low Amplitude, Time Delay, Rising Edge, Falling Edge,Pulse Width and Period. Pulse:

  • High Amplitude: Amplitude of pulse after on shutter.
  • Low Amplitude: Amplitude of pulse after off shutter.
  • Time Delay: Time Delay, Rising Edge, Falling Edge, Pulse Width, and Period: Specify timing and duration parameters. The period's duration should be large.