# Input pulse: pulse duration [ps] tFWHM = 0.050 t0 = tFWHM / 2 / np.sqrt(np.log(2)) # for dispersive length calculation # 3rd order soliton conditions ########################################################################### # Dispersive length LD = t0 ** 2 / np.abs(betas[0]) # Non-linear length for 1st order soliton LNL = LD / (1 ** 2) # Input pulse: peak power [W] power = 1 / (LNL * setup.nonlinearity) # Fiber length [m] setup.fiber_length = 10 * LD # Type of pulse: gaussian setup.pulse_model = gnlse.GaussianEnvelope(power, tFWHM) # Loss coefficient [dB/m] loss = 0 # Type of dyspersion operator: build from Taylor expansion setup.dispersion_model = gnlse.DispersionFiberFromTaylor(loss, betas) # Type of Ramman scattering function: None (default) # Selftepening: not accounted setup.self_steepening = False # Simulation ########################################################################### solver = gnlse.gnlse.GNLSE(setup) solution = solver.run() # Visualization
# given below. loss = 0 betas = np.array([ -11.830e-3, 8.1038e-5, -9.5205e-8, 2.0737e-10, -5.3943e-13, 1.3486e-15, -2.5495e-18, 3.0524e-21, -1.7140e-24 ]) setup.dispersion_model = gnlse.DispersionFiberFromTaylor(loss, betas) # Input pulse parameters peak_power = 10000 # W duration = 0.050 # ps # This example extends the original code with additional simulations for pulse_models = [ gnlse.SechEnvelope(peak_power, duration), gnlse.GaussianEnvelope(peak_power, duration), gnlse.LorentzianEnvelope(peak_power, duration) ] count = len(pulse_models) plt.figure(figsize=(14, 8), facecolor='w', edgecolor='k') for i, pulse_model in enumerate(pulse_models): print('%s...' % pulse_model.name) setup.pulse_model = pulse_model solver = gnlse.GNLSE(setup) solution = solver.run() plt.subplot(2, count, i + 1) plt.title(pulse_model.name) gnlse.plot_wavelength_vs_distance(solution, WL_range=[400, 1400])
""" Runs a simple simulation, saves it to disk and loads it back for plotting. """ import os import gnlse if __name__ == '__main__': setup = gnlse.GNLSESetup() setup.resolution = 2**13 setup.time_window = 12.5 # ps setup.z_saves = 200 setup.fiber_length = 0.15 # m setup.wavelength = 835 # nm setup.impulse_model = gnlse.GaussianEnvelope(1, 0.1) solver = gnlse.GNLSE(setup) solution = solver.run() path = 'test.mat' solution.to_file(path) solution = gnlse.Solution() solution.from_file(path) gnlse.quick_plot(solution) os.remove(path)
import numpy as np import matplotlib.pyplot as plt import gnlse if __name__ == '__main__': # time full with half maximum of impulse FWHM = 2 # Time grid [ps] T = np.linspace(-2 * FWHM, 2 * FWHM, 1000 * FWHM) # peak power [W] Pmax = 100 # Amplitude envelope of gaussina impulse A1 = gnlse.GaussianEnvelope(Pmax, FWHM).A(T) # Amplitude envelope of hiperbolic secans impulse A2 = gnlse.SechEnvelope(Pmax, FWHM).A(T) # Amplitude envelope of lorentzian impulse A3 = gnlse.LorentzianEnvelope(Pmax, FWHM).A(T) plt.figure(figsize=(12, 8)) plt.subplot(1, 2, 1) plt.plot(T, A1, label='gauss') plt.plot(T, A2, label='sech') plt.plot(T, A3, label='lorentz') plt.xlabel("Time [ps]") plt.ylabel("Amplitude [sqrt(W)]") plt.legend() plt.subplot(1, 2, 2)