Skip to main content

Simulation

Our platform offer support for a variety of simulation modules, encompassing both optical and electrical simulation. These may include FDE, EME, FDTD, OEDevice modules, ensuring an expansive electro-optical simulation capabilities.

Use Simulation() to instance a simulation into the project, and then use add function to add simulation solver. The types of solvers available include 'FDE', 'EME', 'FDTD', 'FDTDSmatrix', 'FDTDSweep', 'EMESweep', and 'FDESweep'.

6.1 FDE

The syntax for adding a finite difference eigenmode (FDE) solver to the project and its properties settings are as follows. When adding a FDE solver, it is assumed that the project has already been added, and the pj is an instance of the project. The add function does not return any data.

simu = pj.Simulation()
simu.add(
name: str,
type: Literal["FDE"],
property: dict
)

General

Choose the 1D or 2D eigenmode solver, with available types including '2d_x_normal','2d_y_normal','2d_z_normal', 'x_y_prop', 'x_z_prop', 'y_x_prop', 'y_z_prop', 'z_x_prop' and 'z_y_prop'.

Background material

Selects a material object from the material database as the background medium for the simulation region.
refractive_index: If not selecting a material, this field can directly set the refractive index of the background medium. The default value is 1.

Geometry

ParameterTypeDefaultDescription
x, y, znumber-The center position of the simulation region.
x_span, y_span, z_spannumber-X span, Y span and Z span of the simulation region.
x_min, x_maxnumber-X min, X max position of the simulation region.
y_min, y_maxnumber-Y min, Y max position of the simulation region.
z_min, z_maxnumber-Z min, Z max position of the simulation region.

Mesh settings

mesh_refinement:
mesh_refinement: Selects 'curve_mesh' or 'staircase' to refine the mesh.

mesh_grading:
grading_factor: The maximum rate at which the mesh size can be changed.

minimum_mesh_step_settings:
min_mesh_step: Specify the minimum mesh size for the entire simulation region, including localmesh region.

global_mesh_uniform_grid:
dx/dy/dz: Specify the maximum grid size along the x, y or z directions throughout the entire simulation region.

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".

Advanced

Dispersion settings: Fractional offset for group delay Remove PML mode settings: Automatically Remove PML Modes Threshold for PML Mode Removal

Example:

The following script adds a FDE solver for the xy plane, sets its dimension and mesh of the simulation area, and run the solver.

simu_name = "FDE_solver"
simu = Project.Simulation()
simu.add(name=simu_name, type="FDE",
property={"general": {"solver_type": "2d_z_normal"},
"geometry": {"x": 0, "x_span": 3, "y": 0, "y_span": 3, "z": 0, "z_span": 0},
"mesh_settings": {"global_mesh_uniform_grid": {"dx": 0.02, "dy": 0.02}}})
simu_res = simu[simu_name].run()

6.2 EME

The syntax for adding an eigenmode expansion (EME) solver to the project and its properties settings are as follows. When adding an EME solver, it is assumed that the project has already been added, and the pj is an instance of the project. The add function does not return any data.

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

General

wavelength: The wavelength in the simulation calculation.
use wavelength sweep: Enabling wavelength sweep will automatically calculate the group refractive index of modes in the simulation and allow setting wavelength sweep parameters.

Background material

background_material: Selects a material object from the material database as the background medium for the simulation region. refractive_index: If not selecting a material, this field can directly set the refractive index of the background medium. The default value is 1.

Geometry

ParameterTypeDefaultDescription
x_minnumber-The minimum x position of the EME simulation region.
y, znumber-The y and z center position of the EME simulation region.
y_span, z_spannumber-The y and z span of the EME simulation region.
y min, y maxnumber-The maximum and minimum y position of the EME simulation region.
z min, z maxnumber-The maximum and minimum z position of the EME simulation region.

EME setup

cell_geometry:
energy conservation: Choose the type of energy conservation for the interface S matrix, which is calculated by the modes on both sides of each adjacent cells interface. The options are 'none', 'passive', or 'conserve energy'.

  • None: Not using energy conservation.
  • Make passive: If the norm of the interface S matrix is less than or equal to 1, do not perform the operation; otherwise, force norm to be equal to 1.
  • conserve energy: force the norm of the interface S-matrix to be 1.It is usually used with periodic devices.

allow_custom_eigensolver_settings: Allow you to set different number of modes to be solved for all cell groups, as well as the properties settings for mode analysis.
number_of_modes_for_all_cell_group: Sets the number of modes to be solved for all cells.
cell_group_definition:

ParameterTypeDefaultDescription
spannumber-Sets the span for each cell group.
cell_numberinteger10Sets number of cells for the cell group.
number_of_modesinteger10In the cell group, sets the required number of modes to be solved for all cells.
scstringnoneSelections are ['none', 'sub_cell']
searchstringmax_indexSelect 'max_index' or 'near_n' to specify the effective refractive index for mode calculation.

display_groups: Enable displaying the span of each cell group using wireframes to separate them.
display_cells: Enable displaying the boundaries of each cell and use wireframes to separate them.

Mesh settings

mesh_refinement:
mesh_refinement: Selects 'curve_mesh' or 'staircase' to refine the mesh.

mesh_grading:
grading_factor: The maximum rate at which the mesh size can be changed.

minimum_mesh_step_settings:
min_mesh_step: Specify the minimum mesh size for the entire simulation region, including localmesh region.

Transverse mesh settings

global_mesh_uniform_grid:
dy/dz: The EME solver propagates along the x-axis, so only the mesh step size of the yz plane needs to be set.

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".

Advanced

Example:

The following script adds an EME solver, sets its geometry, mesh, background material, and cell geometry settings, and run solver. This script assumes that the structure and EME ports have been added to the project environment.

simu_name = "EME_solver"
simu = Project.Simulation()
simu.add(name=simu_name, type="EME",
property={"background_material": "object_defined_dielectric", "refractive_index": 1,
"mesh_settings": {"mesh_factor": 1.2, "mesh_refinement": {"mesh_refinement": "curve_mesh"}},
"transverse_mesh_setting": {"global_mesh_uniform_grid": {"dy": 0.02, "dz": 0.02}}})
"geometry": {"x_min": 0, "y": 0, "y_span": 4, "z": 0, "z_span": 3},
"general": {"wavelength": 1.5, "use_wavelength_sweep": True},
"eme_setup": {"cell_geometry": {"energy_conservation": "make_passive", "allow_custom_eigensolver_settings": True,
"cell_group_definition": [{"span": 2.5, "cell_number": 1, "number_of_modes": 10, "sc": "none"}]}},

simu_res = simu[simu_name].run()

6.3 FDTD

The syntax for adding a finite difference time domain (FDTD) solver to the project and its properties settings are as follows. When adding a FDTD solver, it is assumed that the project has already been added, and the pj is an instance of the project. The add function does not return any data.

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

General

Dimension: Select the dimension of the simulation region, with options of "2d" and "3d".
Using_optical_path_estimate_time: Use optical path length to estimate simulation duration.
Simulation_time: Set the maximum running time of FDTD solver, in fs units.

Background material

background_material: Selects a material object from the material database as the background medium for the simulation region.
refractive_index: If not selecting a material, this field can directly set the refractive index of the background medium. The default value is 1.

Geometry

ParameterTypeDefaultDescription
x, y, znumber-The center position of the simulation region.
x_span, y_span, z_spannumber-X span, Y span and Z span of the simulation region.
x_min, x_maxnumber-X min, X max position of the simulation region.
y_min, y_maxnumber-Y min, Y max position of the simulation region.
z_min, z_maxnumber-Z min, Z max position of the simulation region.

Mesh settings

mesh_type: The types of mesh generation algorithms available for FDTD solver are "auto_non_uniform' and 'uniform'.

mesh_accuracy:
cells_per_wavelength: Using the wavelength in the material to set the mesh size, with cells per wavelength limited to integer >=6.

mesh_step_settings:
dx/dy/dz: Allow setting the grid step size in the x/y/z direction when selecting uniform type mesh.

mesh_refinement:
mesh_refinement: Selects 'curve_mesh' or 'staircase' to refine the mesh.

mesh_grading:
grading: After activation, the growth rate of mesh size can be customized.
grading_factor: The maximum rate at which the mesh size can be changed.

minimum_mesh_step_settings:
min_mesh_step: Specify the minimum mesh size for the entire simulation region, including localmesh region.

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".

advanced_options.

auto_shutoff:
use_early_shutoff: Use the conditions of shutoff to terminate the simulation in advance.
auto_shutoff_min: When the total energy in the simulation region drops to this fraction, the simulation will end.
down_sample_time: Check the early shutoff conditions for each down sample time step.

Example:

The following script adds a FDTD solver, sets its simulation time, background material, geometry, and mesh settings, and run solver. This script assumes the structure, source and monitor have been added to the project environment.

simu_name = "FDTD_solver"
simu = Project.Simulation()
simu.add(name=simu_name, type="FDTD",
property={"general": {"simulation_time": 1000},
"background_material": 'object_defined_dielectric', "refractive_index": 1,
"geometry": {"x": 0, "x_span": 6, "y": 0, "y_span": 3, "z": 0, "z_span": 3 },
"boundary_conditions": {"x_min_bc": "PML", "x_max_bc": "PML", "y_min_bc": "PML", "y_max_bc": "PML", "z_min_bc": "PML", "z_max_bc": "PML",
"pml_settings": {"all_pml": {"layers": 8, "kappa": 2, "sigma": 0.8, "polynomial": 3, "alpha": 0, "alpha_polynomial": 1}}},
"mesh_settings": {"mesh_factor": 1.2, "mesh_type": "auto_non_uniform",
"mesh_accuracy": {"cells_per_wavelength": 10},
"minimum_mesh_step_settings": {"min_mesh_step": 1e-4},
"mesh_refinement": {"mesh_refinement": "curve_mesh"}}})
simu_res = simu[simu_name].run()

6.4 FDESweep

The syntax for adding FDESweep solver to the project and its properties settings are as follows. When adding a FDESweep solver, it is assumed that the FDE solver and FDE analysis have already been added, and the pj is an instance of the project. The add function does not return any data.

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

Simulation name

Specifies the name of the simulation solver used for parameter sweep.

sweep type

Selects the type of parameter sweep settings, with options of "ranges" and "values".

Parameters

Variable: Specifies the global parameter names used in the simulation.
Number_of_points: When using the sweep type of ranges, the number of variable changes in parameter sweep.
Start/Stop: When using the sweep type of ranges, sets the start and stop value of the variable.
Values: When using the sweep type of values, specifies the sweep values by a list.

Result

name: Specifies the name of the parameter sweep result.
result: Specifies the name of the analysis that has been added.
component: Specifies the result component to be extracted.

Example: The following script adds a FDESweep solver to obtain the effective refractive index of FDE analysis results, where the sweep range must be set through global parameters. This script assumes that the FDE solver and FDE analysis have been set up.

simu_name = "FDE_Solver"         # The name of FDE solver
analysis_name = "FDE_Analysis" # The name of FDE analysis
sweep_name = "FDE_Sweep" # The name of FDE sweep
para = pj.GlobalParameter()
width = para.add(name="width", expression=0.5, description='') # The setting of parameter sweep must use global parameters.
simu = pj.Simulation()
simu.add(name=sweep_name, type="FDESweep",
property={"simulation_name": simu_name,
"sweep_type": "ranges",
'parameters': [ {'variable': width, 'number_of_points': 3, 'start': 0.5, 'stop': 0.6} ],
"result": [{"name": "Neff", "result": analysis_name, "component": "mode0/neff"}]})
swp_res = simu["FDESweep"].run()

6.5 EMESweep

The syntax for adding EMESweep solver to the project and its properties settings are as follows. When adding an EMESweep solver, it is assumed that the EME solver and EME analysis have already been added, and the pj is an instance of the project. The add function does not return any data.

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

Simulation name

Specifies the name of the simulation solver used for parameter sweep.

Sweep type

Selects the type of parameter sweep settings, with options of "ranges" and "values".

Parameters

Variable: Specifies the global parameter names used in the simulation.
Number_of_points: When using the sweep type of ranges, the number of variable changes in parameter sweep.
Start/Stop: When using the sweep type of ranges, sets the start and stop value of the variable.
Values: When using the sweep type of values, specifies the sweep values by a list.

Result

name: Specifies the name of the parameter sweep result.
result: Specifies the name of the analysis that has been added.
component: Specifies the result component to be extracted.

Example:

The following script adds an EMESweep solver to obtain the S-Matrix of EME analysis results, where the sweep range must be set through global parameters. This script assumes that the EME solver and EME analysis have been set up.

simu_name = "EME_Solver"         # The name of EME solver
analysis_name = "EME_Analysis" # The name of EME analysis
sweep_name = "EME_Sweep" # The name of EME sweep
para = pj.GlobalParameter()
gap = para.add(name="gap", expression=0.45, description='') # The setting of parameter sweep must use global parameters.
simu = pj.Simulation()
simu.add(name=sweep_name, type="EMESweep",
property={"simulation_name": simu_name,
"sweep_type": "values",
"parameters": [{"variable": gap, "values": [0.45, 0.55, 0.65]}],
"result": [{"name": "SMatrix", "component": "S", "result": "S-Matrix"}]})
swp_res = simu["EMESweep"].run()

6.6 FDTDSweep

The syntax for adding FDTDSweep solver to the project and its properties settings are as follows. When adding a FDTDSweep solver, it is assumed that global parameters, FDTD solver, source and monitor/analysis have already been added, and the pj is an instance of the project. The add function does not return any data.

simu = pj.Simulation()
simu.add(
name: str,
type: Literal["FDTDSweep"],
property: dict
)

Simulation name

Specifies the name of the simulation solver used for parameter sweep.

sweep type

Selects the type of parameter sweep settings, with options of "ranges" and "values".

Parameters

Variable: Specifies the global parameter names used in the simulation.
Number_of_points: When using the sweep type of ranges, the number of variable changes in parameter sweep.
Start/Stop: When using the sweep type of ranges, sets the start and stop value of the variable.
Values: When using the sweep type of values, specifies the sweep values by a list.

Result

name: Specifies the name of the parameter sweep result.
result: Specifies the name of the analysis that has been added.
component: Specifies the result component to be extracted.

Example:

The following script adds a FDTDSweep solver to obtain the results of the power monitor and the mode expansion analysis, where the sweep range must be set through global parameters. This script assumes that the FDTD solver and Mode Expansion analysis have been set up.

simu_name = "FDTD_Solver"        # The name of FDTD solver
monitor_name = "Power_Monitor" # The name of power monitor
analysis_name = "ModeExpansion" # The name of mode expansion analysis
sweep_name = "FDTD_Sweep" # The name of sweep name
res1 = "T" # The name of the sweep result
res2 = "T_forward" # The name of the sweep result
para = pj.GlobalParameter()
gap = para.add(name="gap", expression=0.5, description='') # The setting of parameter sweep must use global parameters.
simu = pj.Simulation()
simu.add(name=sweep_name, type="FDTDsweep", property={
"simulation_name": simu_name,
"parameters": [{"variable": gap, "number_of_points": 3, "start": 0.5, "stop": 0.6 }],
"result": [{"name": res1, "result": monitor_name, "component": "T"},
{"name": res2, "result": analysis_name, "component": "T_forward"}]})
swp_res = simu["FDTDSweep"].run()

6.7 FDTDSmatrix

The syntax for adding FDTDSmatrix solver to the project and its properties settings are as follows. When adding a FDTDSmatrix solver, it is assumed that FDTD solver and FDTD port have already been added, and the pj is an instance of the project. The add function does not return any data.

simu = pj.Simulation()
simu.add(
name: str,
type: "FDTDSmatrix",
property: dict
)

simulation_name The specified FDTD solver name| port active

Simulation name

Specifies the name of the simulation solver used for parameter sweep.

S_matrix_setup

Port: Specifies the name of port in the FDTD simulation region.
Active: Selects the enabled port as the excitation source, and the number of ""Active" port determines the number of simulation sweep.

Example:

The following script add an FDTDSmatrix solver to obtain the S matrix of the FDTD port, and enable the calculated port through "active".

simu_name = "FDTD_solver"     # the name of FDTD solver
sweep_name = "matrix_sweep" # the name of FDTD Smatrix sweep
port1_name = "port1" # the name of port1
port2_name = "port2" # the name of port2
simu = pj.Simulation()
smatrix_res = simu.add(name=sweep_name, type="FDTDSmatrix",
property={"simulation_name": simu_name,
"s_matrix_setup": [{"port": port1_name, "active": True},
{"port": port2_name, "active": True}]})

6.5 DDM

6.5.1 DDM Settings

Incorporate a DDM solver into the current project using the code type='DDM.

add(
self,
*,
name: str,
type: Literal["DDM"],
property: OeDevicePostProcess,
)

Example:

    simu = pj.Simulation()
simu.add(name=simu_name, type="DDM", property={
"background_material": mt["mat_sio2"],
"general": {"solver_mode": "steady_state",
"norm_length": 20,
"temperature_dependence": "isothermal",
"temperature": 298.15,
},
"geometry": {"dimension": "2d_x_normal", "x": 10, "x_span": 0, "y_min": 0, "y_max": 3.7, "z_min": -0.15, "z_max": 1.25},
"mesh_settings": {"mesh_size": 0.06},
"advanced": {"non_linear_solver": "newton",
"linear_solver": "mumps",
"fermi_statistics": "disabled", # or "enabled"
"damping": "potential", # or "none"
"potential_update": 1.0,
"max_iterations": 15,
"relative_tolerance": 1e-5,
"tolerance_relax": 1e5,
"divergence_factor": 1e25
}
})
defaulttypenotes
general.norm_length1.0float
general.solver_modesteady_statestringSelections are ['steady_state', 'transient'].
general.temperature_dependenceIsothermalstringSelections are ['Isothermal'].
general.simulation_temperature300float
general.background_materialstring
advanced.non_linear_solverNewtonstringSelections are ['Newton'].
advanced.linear_solverMUMPSstring
advanced.fermi_statisticsdisabledstringSelections are ['disabled', 'enabled'].
advanced.dampingnonestringSelections are ['none', 'potential'].
advanced.potential_update1.0float
advanced.multi_threadslet_solver_choosestringSelections are ['let_solver_choose', 'set_thread_count'].
advanced.thread_count4integer
advanced.max_iterations15integer
advanced.relative_tolerance1.0e-5float
advanced.tolerance_relax1.0e+5float
advanced.divergence_factor1.0e+25float
advanced.saving on divergencedisabledstringSelections are ['disabled', 'enabled'].
genrate.genrate_pathstring
genrate.source_fractionfloat
genrate.coordinate_unitmstringSelections are ['m', 'cm', 'um', 'nm'].
genrate.field_length_unitmstringSelections are ['m', 'cm', 'um', 'nm'].
geometry.dimension2d_x_normalstringSelections are ['2d_x_normal', '2d_y_normal', '2d_z_normal'].
geometry.xfloat
geometry.x_spanfloat
geometry.x_minfloat
geometry.x_maxfloat
geometry.yfloat
geometry.y_spanfloat
geometry.y_minfloat
geometry.y_maxfloat
geometry.zfloat
geometry.z_spanfloat
geometry.z_minfloat
geometry.z_maxfloat
small_signal_ac.perturbation_amplitude0.001float
small_signal_ac.frequency_spacingsinglestringSelections are ['single', 'linear', 'log'].
small_signal_ac.frequency1.0e+6float
small_signal_ac.start_frequency1.0e+06float
small_signal_ac.stop_frequency1.0e+09float
small_signal_ac.frequency_interval9.9999e+10float
small_signal_ac.num_frequency_points2integer
small_signal_ac.log_start_frequency1.0e+06float
small_signal_ac.log_stop_frequency1.0e+10float
small_signal_ac.log_num_frequency_points2integer

Description:

  • geometry

    • dimension--Set the dimension of the simulation region. Only 2D simulation is supportd currently. When it's set to "2d_x_normal", the simulation is on the yz plane. Similarly for the rest
  • general:

    • norm_length--Set the length in the third dimension, default to be 1
    • solver_mode--Set the simulation mode. Steady state, transient and SSAC simulations are supported
    • temperature--Set the simulation temperature
    • temperature_dependence--Set the type of the temperature dependence. Only "Isothermal" is supported currently
  • small_signal_ac:

    • perturbation_amplitude--Set the voltage amplitude of the small signal

    • frequency_spacing--Set the spacing type of the frequency

      • When it's set to "single", the frequency point is single
      • When it's set to "linear", the frequency points are uniformly sampled
      • When it's set to "log",the frequency points are uniformly sampled base on the logarithm of frequency
    • frequency--Set the value of the single frequency

    • start_frequency--Set the start frequency of linear spacing

    • stop_frequency--Set the stop frequency of linear spacing

    • frequency_interval--Set the frequency interval of linear spacing

    • num_frequency_points--Set the number of frequency points of linear spacing

    • log_start_frequency--Set the start frequency of logarithmic spacing

    • log_stop_frequency--Set the stop frequency of logarithmic spacing

    • log_num_frequency_points--Set the number of frequency points of logarithmic spacing

  • advanced:

    • non_linear_solver--Set the non-linear solver, only Newton method is supported currently
    • linear_solver--Set the linear solver. Options are "MUMPS". MUMPS is direct linear solvers which usually give the exact solution, and supports parallel computation.
    • use_quasi_fermi--Whether to directly solve for the quasi-Fermi potential instead of carrier concentration as unkowns. "enabled" means True, and "disabled" means False
    • damping--Set the nonlinear update damping scheme. "potential" means the damping is based on the potential variation
    • potential_update--Set the threshold potential for potential damping. The large value will reduce the strength of damping effect
    • max_iterations--Set global maximum number of iterations, available when use_global_max_iterations is True
    • relative_tolerance--Set the relative update tolerance
    • tolerance_relax--Set the tolerance relaxation factor for convergence on relative tolerance criteria
    • divergence_factor--Nonlinear solver fault with divergence when each individual function norm exceeds the threshold as its absolute tolerance multiply by this factor

6.5.2 FDTD

6.5.2.1 Setting

Incorporate an FDTD(Finite-Difference Time-Domain) solver into the current project using the code type='FDTD'.

add(
self,
*,
name: str,
type: Literal["FDTD"],
property: FdtdPostProcess,
)

Example:

 simu = pj.Simulation()
simu.add(name=simu_name, type="FDTD",
property={"background_material": mt["mat_sio2"],
"geometry": {"x": x_mean, "x_span": x_span, "y": y_mean, "y_span": y_span, "z": z_mean, "z_span": z_span, },
"general": {"simulation_time": 2000, },
"mesh_settings": {"mesh_factor": 1.2, "mesh_type": "auto_non_uniform",
"mesh_accuracy": {"cells_per_wavelength": 14},
"minimum_mesh_step_settings": {"min_mesh_step": 1e-4},
"mesh_refinement": {"mesh_refinement": "curve_mesh", }},
"boundary_conditions": {"x_min_bc": "PML", "x_max_bc": "PML", "y_min_bc": "PML", "y_max_bc": "PML", "z_min_bc": "PML", "z_max_bc": "PML",
"pml_settings": {"all_pml": {"profile":"standard","layer": 8, "kappa": 2, "sigma": 0.8, "polynomial": 3, "alpha": 0, "alpha_polynomial": 1, }}},
'advanced_options': {'auto_shutoff': {'auto_shutoff_min': 1.00e-4, 'down_sample_time': 200}},
})
# endregion
ParametersDefaultTypeNotes
extra.fdtd_port_group.source_portstringTo extra data of source port from the result of FDTD simulation.
general.dimension3dstringSelections are ['3d'].
general.using_optical_path_estimate_timefalsebool
general.simulation_time1000integerTo set the simulation time for transient simulation.
mesh_settings.mesh_typeauto_non_uniformstringSelections are ['auto_non_uniform', 'uniform'].
mesh_settings.mesh_accuracy.cells_per_wavelength15integerSet the mesh accuracy for region of FDTD simulation.
mesh_settings.mesh_step_settings.dx0.1floatSet the miniimum of spacing between mesh step centers in x direction.
mesh_settings.mesh_step_settings.dy0.1floatSet the miniimum of spacing between mesh step centers in y direction.
mesh_settings.mesh_step_settings.dz0.1floatSet the miniimum of spacing between mesh step centers in z direction.
mesh_settings.minimum_mesh_step_settings.min_mesh_step0.0001floatSet the minimum vale of mesh step.
advanced_options.auto_shutoff.use_early_shutofftrueboolDecide whether to use early shutoff.
advanced_options.auto_shutoff.auto_shutoff_min1.0e-4floatControl the simulation shutoff based on the ratio of energy to the maximum input energy.
advanced_options.auto_shutoff.down_sample_time100floatInspect the auto shutoff conditions every down sample time.
advanced_options.live_slice_filed_display_settings.show_fieldfalseboolDecide whether to gennerate the electric intensity filed image for the results.
advanced_options.live_slice_filed_display_settings.select_field_section2d_z_normalstringSelections are ['2d_y_normal', '2d_z_normal'].
advanced_options.live_slice_filed_display_settings.select_componentexstringSelections are ['ex', 'ey', 'ez'].
advanced_options.live_slice_filed_display_settings.time_interval200floatSet the time interval for displaying image.
advanced_options.live_slice_filed_display_settings.position0floatSet the center position of the field image.
thread_setting.thread4integerDetermine the number of cores required to run the simulation on the local computer.

6.5.2.2 Boundary

The following content comprises code explanations and specific examples of boundary conditions in optical simulation.

ParametersDescription
propertyThe default property of the optical boundary.
pml_same_settingsTo decide whether using the same pml settings on every directions or not.

As demonstrated in the following examples, we also provide support for customizing boundary conditions in different directions.

ParametersDefaultTypeNotes
general_pml.pml_same_settingstrueboolTo decide whether using the same pml settings on every directions or not.
general_pml.pml_profilestandardstringTo provide the options of PML profile.
general_pml.pml_layer-integerSet the number of layers after discretizing the PML region.
general_pml.pml_kappa-floatSet the kappa parameter related to the absorption characteristics of the PML region.
general_pml.pml_sigma-floatSet the sigma parameter related to the absorption characteristics of the PML region.
general_pml.pml_polynomial-integerSet the order of the kappa and the sigma parameters.
general_pml.pml_alpha-floatSet the alpha parameter related to the absorption characteristics of the PML region.
general_pml.pml_alpha_polynomial-integerSet the order of the alpha parameter.
general_pml.pml_min_layers-integerSet the minimum number of layers within a reasonable range for the PML layers.
general_pml.pml_max_layers-integerSet themaximum number of layers within a reasonable range for the PML layers.
geometry.x-floatThe x-coordinate of the center point position of the boundary.
geometry.x_span-floatThe length in x direction of the boundary. Restrained by condition: >0.
geometry.x_min-floatThe minimum x-coordinate endpoint data of the boundary.
geometry.x_max-floatThe maximum x-coordinate endpoint data of the boundary.
geometry.y-floatThe y-coordinate of the center point position of the boundary.
geometry.y_span-floatThe width in y direction of the boundary. Restrained by condition: >0.
geometry.y_min-floatThe minimum y-coordinate endpoint data of the boundary.
geometry.y_max-floatThe maximum y-coordinate endpoint data of the boundary.
geometry.z-floatThe z-coordinate of the center point position of the boundary.
geometry.z_span-floatThe thinckness in z direction of the boundary. Restrained by condition: >0.
geometry.z_min-floatThe z-coordinate of the bottom position of the thickness of the boundary.
geometry.z_max-floatThe z-coordinate of the top position of the thickness of the boundary.
boundary.x_max-stringSet the boundary type in the x+ direction. Selections are ['PML', 'PEC', 'metal', 'PMC', 'periodic'].
boundary.x_min-stringSet the boundary type in the x- direction. Selections are ['PML', 'PEC', 'metal', 'PMC', 'symmetric', 'anti_symmetric', 'periodic'].
boundary.y_max-stringSet the boundary type in the y+ direction. Selections are ['PML', 'PEC', 'metal', 'PMC', 'periodic'].
boundary.y_min-stringSet the boundary type in the y- direction. Selections are ['PML', 'PEC', 'metal', 'PMC', 'symmetric', 'anti_symmetric', 'periodic'].
boundary.z_max-stringSet the boundary type in the z+ direction. Selections are ['PML', 'PEC', 'metal', 'PMC', 'periodic'].
boundary.z_min-stringSet the boundary type in the z- direction. Selections are ['PML', 'PEC', 'metal', 'PMC', 'symmetric', 'anti_symmetric', 'periodic'].

If you need to customize the boundary conditions for simulation requirements, you can also refer to the table below for modifying boundary conditions in different directions.Taking the x coordinate axis as an example, the parameters invocation is the same for the y/z coordinates.

ParametersDefaultTypeNotes
general_pml.pml_same_settingstrueboolTo decide whether using the same pml settings on every directions or not.
general_pml.x_min_bc.pml_profilestandardstringTo provide the options of PML profile in x- direction.
general_pml.x_min_bc.pml_layer-integerSet the number of layers after discretizing the PML region in x- direction.
general_pml.x_min_bc.pml_kappa-floatSet the kappa parameter related to the absorption characteristics of the PML region in x- direction.
general_pml.x_min_bc.pml_sigma-floatSet the sigma parameter related to the absorption characteristics of the PML region in x- direction.
general_pml.x_min_bc.pml_polynomial-integerSet the order of the kappa and the sigma parameters in x- direction.
general_pml.x_min_bc.pml_alpha-floatSet the alpha parameter related to the absorption characteristics of the PML region in x- direction.
general_pml.x_min_bc.pml_alpha_polynomial-integerSet the order of the alpha parameter in x- direction.
general_pml.x_min_bc.pml_min_layers-integerSet the minimum number of layers within a reasonable range for the PML layers in x- direction.
general_pml.x_min_bc.pml_max_layers-integerSet the maximum number of layers within a reasonable range for the PML layers in x- direction.
general_pml.x_max_bc.pml_profilestandardstringTo provide the options of PML profile in x+ direction.
general_pml.x_max_bc.pml_layer-integerSet the number of layers after discretizing the PML region in x+ direction.
general_pml.x_max_bc.pml_kappa-floatSet the kappa parameter related to the absorption characteristics of the PML region in x+ direction.
general_pml.x_max_bc.pml_sigma-floatSet the sigma parameter related to the absorption characteristics of the PML region in x+ direction.
general_pml.x_max_bc.pml_polynomial-integerSet the order of the kappa and the sigma parameters in x+ direction.
general_pml.x_max_bc.pml_alpha-floatSet the alpha parameter related to the absorption characteristics of the PML region in x+ direction.
general_pml.x_max_bc.pml_alpha_polynomial-integerSet the order of the alpha parameter in x+ direction.
general_pml.x_max_bc.pml_min_layers-integerSet the minimum number of layers within a reasonable range for the PML layers in x+ direction.
general_pml.x_max_bc.pml_max_layers-integerSet the maximum number of layers within a reasonable range for the PML layers in x+ direction.

The code provided in this section can be utilized to incorporate boundary and mesh into the current project.

6.5.3 FDE

Integrate an FDE(Finite Difference Eigenmode) solver into the current project using the code type='FDE'.

add(
self,
*,
name: str,
type: Literal["FDE"],
property: AfdePostProcess,
)

Example:

    simu = pj.Simulation()
simu.add(name=simu_name, type="FDE",
property={"background_material": mt["mat_sio2"],
"geometry": {"x": x_mean, "x_span": x_span, "y": y_mean, "y_span": y_span, "z": z_mean, "z_span": z_span, },
"boundary_conditions": {"y_min_bc": "PEC", "y_max_bc": "PEC", "z_min_bc": "PEC", "z_max_bc": "PEC",},
# 'mode_removal': {'threshold': 0.02},
# default is '2d_x_normal' ['2d_x_normal','2d_y_normal','2d_z_normal']
"fractional_offset_for_group_delay": 0.0001,
'general': {'solver_type': '2d_x_normal'},
"mesh_settings": {"mesh_refinement": {"mesh_refinement": "curve_mesh"}, "mesh_factor": 1.2,
"global_mesh_uniform_grid": {"dy": ogrid_global_y, "dz": ogrid_global_z, },
# 'minimum_mesh_step_settings': {'min_mesh_step': 1.0e-4}
}})
# endregion
ParametersDefaultTypeNotes
general.solver_type2d_x_normalstringSelections are ['2d_x_normal', '2d_y_normal', '2d_z_normal', 'x', 'y', 'z'].
mesh_settings.global_mesh_uniform_grid.dx0.02floatThe global mesh step in the x direction.
mesh_settings.global_mesh_uniform_grid.dy0.02floatThe global mesh step in the y direction.
mesh_settings.global_mesh_uniform_grid.dz0.02floatThe global mesh step in the z direction.
mesh_settings.minimum_mesh_step_settings.min_mesh_step0.0001floatSet the minimum vale of mesh step.
thread_setting.thread4integerDetermine the number of cores required to run the simulation on the local computer.
fde_analysis.modal_analysis.mesh_structurefalseboolConfirm whether to generate a refractive index diagram for the structure.
fde_analysis.modal_analysis.calculate_modesfalseboolDetermine whether to calculate the modes.
fde_analysis.modal_analysis.[]far_field_settings.calculatetrueboolDetermine whether to calculate the far field.
fde_analysis.modal_analysis.[]far_field_settings.mode_selectionintegerSelect the mode for which far-field calculation is needed.
fde_analysis.modal_analysis.[]far_field_settings.projection_methodplanarstringSelections are ['planar'].
fde_analysis.modal_analysis.[]far_field_settings.farfield_filter0floatConfigure this parameter to filter near field data for eliminating high frequency ripples in the results. Its value ranging from 0 to 1.
fde_analysis.modal_analysis.[]far_field_settings.material_index1.4floatSet the material refractive index for projection.
fde_analysis.modal_analysis.[]far_field_settings.projection_distance4430.65floatThe distance for far-field projection calculation.
fde_analysis.modal_analysis.[]far_field_settings.points_in_x50floatIn x direction, the number of points in the far field.
fde_analysis.modal_analysis.[]far_field_settings.points_in_y50floatIn y direction, the number of points in the far field.
fde_analysis.modal_analysis.[]far_field_settings.farfield_x0floatIn x direction, the position of far field center point.
fde_analysis.modal_analysis.[]far_field_settings.farfield_x_span26.1834floatIn x direction, the span of far field range.
fde_analysis.modal_analysis.[]far_field_settings.farfield_y0floatIn y direction, the position of far field center point.
fde_analysis.modal_analysis.[]far_field_settings.farfield_y_span18.1231floatIn y direction, the span of far field range.
fde_analysis.modal_analysis.wavelength1.55floatThe mode wavelength for FDE calculation.
fde_analysis.modal_analysis.wavelength_offset0.002floatThe mode wavelength offset for FDE calculation.
fde_analysis.modal_analysis.number_of_trial_modes5integerWhen calculating modes, determine the calculated number of modes around the refractive index.
fde_analysis.modal_analysis.searchmax_indexstringCalculate the mode based on the maximum refractive index or user defined refractive index in the structure. Selections are ['near_n', 'max_index'].
fde_analysis.modal_analysis.n1floatUnder the 'near_n' condition, use this value of refractive index to search the source mode.
fde_analysis.modal_analysis.calculate_group_indexfalseboolDetermine whether to calculate the group refractive index.
fde_analysis.modal_analysis.bent_waveguide.bent_waveguidefalseboolSelect whether to calculate modes in bent waveguides.
fde_analysis.modal_analysis.bent_waveguide.radius0.0floatSet the waveguide radius for bent waveguides.
fde_analysis.modal_analysis.bent_waveguide.orientation0.0floatThe bent direction of the waveguide.
fde_analysis.modal_analysis.bent_waveguide.locationsimulation_centerstringSet the bent center position of bent waveguides. Selections are ['simulation_center'].
fde_analysis.modal_analysis.mode_removal.threshold-floatScreen the FDTD port source according to the energy arriving at the boundary to ensure the accuracy of the calculated transmission FDTD port mode.
fde_analysis.frequency_analysis.frequency_analysisfalseboolDetermine whether to invoke frequency analysis.
fde_analysis.frequency_analysis.start_wavelength-floatSet the start frequency of the frequency analysis.
fde_analysis.frequency_analysis.stop_wavelength-floatSet the stop frequency of the frequency analysis.
fde_analysis.frequency_analysis.number_of_points10integerSet the number of points in the frequency analysis
fde_analysis.frequency_analysis.effective_index1.0floatTo search the mode near this refractive index.
fde_analysis.frequency_analysis.detailed_dispersion_calculationfalseboolDetermine whether to calculate the dispersion of structure.