Menu

Home

Wen Qi Zhang
Attachments
fftwtest.cpp (2315 bytes)
nse.png (101058 bytes)

Welcome to Nonlinear Pulse Propagation Solver's wiki page!


Introduction

Nonlinear Schrödinger equation (NSE) is a fundamental equation in nonlinear optics that describes the propagation of a pulse through a dispersive and nonlinear medium. Nonlinear Pulse Propagation Solver (NPP) is a program, written in C/C++, that solves NSE in an arbitrary waveguide. It has a user friendly interface, which allows a user to enter the pulse and waveguide parameters and execute simulations. The program can be invoked within MATLAB and any other scripting language. It can export the results in different formats including ASCII text “.txt” and MATLAB “.mat” format. The program can also utilize the power of GPU via CUDA. With a modern gaming card “NVidia GTX TITAN”, a speed increase of a factor of 100 times can be achieved. This makes NPP a powerful tool especially for simulating long waveguides.

Installation

(1) Download the program archive according to your platform.
(2) Extract the files and put them into a directory.
(3) Modify "setenv.bat" (Windows) or "npp" (Linux/Mac). Change the path setting corresponding to your system.
(4) Run the program via "run.bat" (Windows) or "npp" (Linux/Mac).
(5) (OPTIONAL) In order to use the plugins feature of the program, you'll need a compiler installed on your system. You can install MinGW/MinGW64 on windows or gnu compiler collection (GCC) on Linux or xcode on Mac. On Windows, you'll also need to setup the path to your compiler in "setenv.bat".

Quick Start

Once you have your program installed. You can run a quick test simply but click Start button. The program preloaded a set of parameter to run a supercontinuum (SC) generation simulation. You can change the Propagation Length to a larger number to see the development of the SC generation.

There's a range of config files in the examples directory. You can also load these examples to see how the program works.

Equations

This is the NSE this program solves

[[img src=nse.png alt=NSE width=500]]

where A(z,t) is the pulse in time domain, α is the absorption coefficient, β_k is the Taylor series of the propagation constant, γ is the nonlinear coefficient, τ_shock is the optical shock time, R(T)=(1-fr)·δ(T)+fr·hr(T) in which hr(T) is the Raman response function.

This NSE is unitless, which means you have the freedom to choose your preferred unit system as long as its consist throughout the program.

About Fast Fourier Transform (FFT)

FT Window Size (N) is the first thing you need to consider when you step up your problem. However, for starters, it maybe unclear how to determine this size. Here is a simple guide to help your find out this number.

Say you have a simple input pulse, for instance, a hyperbolic secant pulse. You probably need 10 sampling points across the main body of this pulse (amplitude above 1/e) in order to accurately describe it. You also know, the tails of the pulse doesn't go to 0 exactly. Therefore you need more points to include the details of the pulse tails. Usually 10 times of points shall be adequate. So, we need 100 points in all? Not that simple. You need to accurately describe your pulse not only in time, but also in frequency domain. Furthermore, you also need to consider the evolution of the pulse in both time and frequency domains such that, during simulations, the pulse doesn't reach any of the boundaries of the time and frequency windows.

Let's look at an example. If the input pulse is a 1 ps (T0) secant pulse, its width in frequency is about 0.315 THz. In FFT, the frequency resolution (df) is determined by the inverse of the FT Time Window (T), the total time across the window that contains your pulse. If we take 10 times the size of T0 as T then df=0.1 THz. We only have 3 points across our input pulse in frequency, which is not very good. In this case, we need to increase FT Window Size and the value in FT Time Window correspondingly. For simulations of supercontinuum generation, you can work out the FT Window Size backward from your expected final spectral span using the relation: the total frequency span F=Ndf=N/T. If your continuum can span from 400 nm to 4 μm and your pump wavelength is 1064 nm, your frequency window should be bounded by the largest frequency difference between your span and pump, e.g., 299792458·(1/400e-9-1/1064e-9)=467.7 THz is bigger than 299792458·(1/1064e-9-1/4e-6)=206.8 THz, so F should be 2·467.7=935.4 THz and N=9355*.

One last thing to mention about FFT is, it is fast for computer to calculate FFT if the FT Window Size is power of 2. So for our last example N=2^14=16384 is the closest choice. Of course, most of the time, you will want to have a bigger windows then 2^14 to avoid FFT windowing effect. But since you already know the basics of FFT, you can play with the parameters yourself now.

About multi-threading

The fastest way to run the program is to use your CUDA supported graphic card by ticking the CUDA checkbox or add -cuda in command line. You will need CUDA Compute Capability of at least 1.3. If you do not have a CUDA supported card, you can still speed up your calculation through enabling CPU multi-threading by setting Num Of Threads larger than 1. However, set a large number of threads does not necessarily mean a fast speed. Download and compile this code to test FFT speed on your machine. For most of the time on my machine, 2 threads are the best choice.


Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.