# Dynamic simulation¶

class DynamicSimulation(max_time_steps)

DynamicSimulation is the interface class used for running fiber amplifier simulations with arbitrarily varying input powers. It also supports reflective boundary conditions and thus modeling of simple CW, gain-switched or Q-switched fiber lasers. With constant input powers, the result converges to the steady state simulation result. Setting multiple ion populations is also supported. The class defines the fiber, boundary conditions and optical channels used in the simulation.

__init__(max_time_steps)

Initialize self. See help(type(self)) for accurate signature.

use_python_backend()

Sets the simulation to use the slow Python finite difference solver. Using one of the faster solvers instead is highly recommended.

use_cpp_backend()

Sets the simulation to use the C++ backend if available.

use_pythran_backend()

Sets the simulation to use the pythran backend if available.

use_numba_backend()

Sets the simulation to use the numba backend if available.

get_time_coordinates(fiber, z_nodes, dt='auto')

Returns the time coordinates used in the simulation. Useful for setting time-varying input powers.

Parameters: fiber (Subclass of FiberBase) – The fiber used in the simulation z_nodes (int) – Number of spatial nodes used in the simulation. dt (float) – Time step size. The ‘auto’ option uses realistic time step calculated from the Courant condition based on the speed of light in glass and the spatial step size. Larger (and physically unrealistic) time steps can be used to drastically speed up the convergence of steady state simulations. Time coordinate array numpy float array
add_forward_signal(wl, input_power, wl_bandwidth=0.0, mode_shape_parameters=None, label='', reflection_target='', reflectance=0)

Adds a new forward-propagating signal to the simulation.

Parameters: wl (float) – Wavelength of the signal input_power (float or numpy array) – Input power of the signal at the beginning of the fiber wl_bandwidth (float) – Wavelength bandwidth of the channel. Finite bandwidth means including ASE. mode_shape_parameters (dict) – Defines the mode field shape. Allowed key-value pairs: functional_form -> one of [‘bessel’, ‘gaussian’, ‘tophat’] mode_diameter -> float overlaps -> list of pre-calculated overlaps between the channel and the ion populations label (str) – Optional label for the channel (required to receive reflected power from another channel) reflection_target (str) – Label of the channel receiving reflection from this channel reflectance – Reflectance R [0,1] from this channel to the target channel
add_backward_signal(wl, input_power, wl_bandwidth=0.0, mode_shape_parameters=None, label='', reflection_target='', reflectance=0)

Adds a new backward-propagating signal to the simulation.

Parameters: wl (float) – Wavelength of the signal input_power (float or numpy array) – Input power of the signal at the beginning of the fiber wl_bandwidth (float) – Wavelength bandwidth of the channel. Finite bandwidth means including ASE. mode_shape_parameters (dict) – Defines the mode field shape. Allowed key-value pairs: functional_form -> one of [‘bessel’, ‘gaussian’, ‘tophat’] mode_diameter -> float overlaps -> list of pre-calculated overlaps between the channel and the ion populations label (str) – Optional label for the channel (required to receive reflected power from another channel) reflection_target (str) – Label of the channel receiving reflection from this channel reflectance – Reflectance R [0,1] from this channel to the target channel
add_forward_pump(wl, input_power, wl_bandwidth=0.0, mode_shape_parameters=None, label='', reflection_target='', reflectance=0)

Adds a new forward-propagating pump to the simulation.

Parameters: wl (float) – Wavelength of the signal input_power (float or numpy array) – Input power of the signal at the beginning of the fiber wl_bandwidth (float) – Wavelength bandwidth of the channel. Finite bandwidth means including ASE. mode_shape_parameters (dict) – Defines the mode field shape. Allowed key-value pairs: functional_form -> one of [‘bessel’, ‘gaussian’, ‘tophat’] mode_diameter -> float overlaps -> list of pre-calculated overlaps between the channel and the ion populations label (str) – Optional label for the channel (required to receive reflected power from another channel) reflection_target (str) – Label of the channel receiving reflection from this channel reflectance – Reflectance R [0,1] from this channel to the target channel
add_backward_pump(wl, input_power, wl_bandwidth=0.0, mode_shape_parameters=None, label='', reflection_target='', reflectance=0)

Adds a new backward-propagating pump to the simulation.

Parameters: wl (float) – Wavelength of the signal input_power (float or numpy array) – Input power of the signal at the beginning of the fiber wl_bandwidth (float) – Wavelength bandwidth of the channel. Finite bandwidth means including ASE. mode_shape_parameters (dict) – Defines the mode field shape. Allowed key-value pairs: functional_form -> one of [‘bessel’, ‘gaussian’, ‘tophat’] mode_diameter -> float overlaps -> list of pre-calculated overlaps between the channel and the ion populations label (str) – Optional label for the channel (required to receive reflected power from another channel) reflection_target (str) – Label of the channel receiving reflection from this channel reflectance – Reflectance R [0,1] from this channel to the target channel
add_ase(wl_start, wl_end, n_bins)

Adds amplified spontaneous emission (ASE) channels. Using more channels improves accuracy, but incurs a heavier computational cost to the simulation.

Parameters: wl_start (float) – The shorted wavelength of the ASE band wl_end (float) – The longest wavelength of the ASE band n_bins (positive int) – The number of simulated ASE channels.
run(z_nodes, dt='auto', P=None, N2=None, stop_at_steady_state=False, steady_state_tolerance=0.0001, convergence_checking_interval=10000)

Runs the simulation.

Parameters: z_nodes (int) – Number of spatial nodes used in the simulation. dt (float or str) – Time step size. The ‘auto’ option uses realistic time step calculated from the Courant condition based on the speed of light in glass and the spatial step size. Larger (and physically unrealistic) time steps can be used to drastically speed up the convergence of steady state simulations. P (numpy float array) – Pre-existing powers in the fiber, useful when chaining multiple simulations. N2 (numpy float array) – Pre-existing upper state excitation in the fiber, useful when chaining multiple simulations. stop_at_steady_state (bool) – If this flag parameter is set to True, the simulation stops when the excitation reaches a steady state (does not work if the excitation fluctuates at a specific frequency). steady_state_tolerance (float) – Sets the relative change in excitation that is used to detect the steady state. convergence_checking_interval (positive int) – If aiming for steady state, the simulation checks convergence always after this number of iterations and prints the average excitation. In truly dynamic simulations, only prints the excitation.
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.38105636835098267, "perplexity": 7315.867048567621}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2021-49/segments/1637964363400.19/warc/CC-MAIN-20211207140255-20211207170255-00632.warc.gz"}