Typing in long commands with lots of arguments in a shell is not very practical. Also we want to have a look at the out put from the program which is a time trace and we want to calculate e.g. the optical spectrum.
This can be done (and automated) using a number of tools. I have used MATLAB or it's open source variant Octave for this initially but have now switched to Python for viewing and analyzing the data. Octave and Python are freely available. For Python I used the Anaconda distribution from Continuum Analytics. This distribution installs a nice editing and development surrounding (named Spyder) and all relevant extensions.
An example of how you can run PHIsim using Python is discussed using an example in this file named py_run_PHIsimv3_WS.py (also the example Single SOA) of Python script. In this script functions are used that are defined in py_PHIsimv3_tools_WS.py . The example is only one way of doing this, you can develop completely different scripts, and organize everything in a more advanced way.
In the file py_run_PHIsimv3_WS.py file there are first the required libraries imported.
The working directory in the variable new_work_dir, the directory where all the input files are and where the output files will be generated. So you will have to fill in the value you want to use.
Then you have to set the name of the input file with the device description in the variable: device_input_file. This is set in the example to 'device_input_SOA_only.txt'
The next variable contains the name of the parameter input file: sim_parameter_file. This is set to PHIsimv3_pars_InGaAsP_ridge.txt . In this parameter file are a few numbers that need to be set frequently such as the number of steps in the simulation, the number of wavelengths in one segment, which information (if at all) should be stored in files for videos or PHIsim_view. These numbers are near the end of the file.
Then there is the variable PHIcarrierout 'PHIsimout_car.txt' which is not used in this example.
The variable nr_data_in indicates for how many time steps in the simulation input signals are provided. Note that there always need to be some input, even if they are only zeros. Also note that the time step changes with the length of the segments. Therefore the interpretation of the input file depends on the parameter that set the lenght of the segments.
The variable startch indicates from which timestep in the output the optical spectra are calculated. The first startch steps are ignored for the calculation of the spectra.
Then in the code the working directory is changed to new_work_dir. Some parameters are read from the parameter file using a function in the PHIsimv3_tools_WS module. The arrays for the signal input file are defined and filled with a single optical pulse going from left to right.
Then the input signal file data are plotted (Figure 11) and the circuit is plotted (optional, depends on parameter) and the simulation is run using the function runsimulation from the py_PHIsimv3_tools_WS.py library). So this function calls the PHIsim_input and PHIsim_v3 programs.
The function plot_output is called to calculate and generate a number of plots. This function has option for windowing of the time trace for calculating the spectrum and an option to calculate the power spectral density of the frequency fluctuations. Currently the vertical axis on the spectra are in arbitrary units.
Explanation of the different plots:
Input signals for the simulation (Figure 11)
Photon and carrier density for all segments at the end of the simulation (Figure 1)
Output power as a function of time (Figure 2)
Instantaneous frequency as a function of time (Figure 3)
Filtered signal as a function of time (in steps) (Figure 10)
Spectrum signal Left to Right output in log scale (Figure 4)
Spectrum signal Right to Left output in log scale (Figure 5)
Spectrum signal Left to Right output in linear scale (Figure 6)
Spectrum signal Right to Left output in linear scale (Figure 7)
The function py_look_at_data_v3.py can be used to replot the time traces and recalculate the spectra so you don't have to run the simulation again.
Typically one will want to modify the these examples and the PHIsim_tools module to achieve what you want to do with the simulations.
TO BE FINALIZED
change the input file to produce a video
using animation
introducing PHI_simview