Batchfield

From CUDOS
Jump to: navigation, search

Batchfield, or 'bfld' in short, is an executable part of the CUDOS MOF Utilities. It enables batch processing of bcf/fbb files to convert Fourier Bessel coefficients into field data, field plots and extracts field data such as the effective area. It is in essence a command line version of Winfield. Batchfield was not part of the original CMU distribution.

Using Batchfield

Batchfield is run by typing in a command line

bfld -l bfldparameterfile.txt

where 'bfldparameterfile.txt' is a parameter file containing instructions for the program.

Output

mode_table.dat file

Each time batchfield is run it creates (or replaces, but does not append) a file invariably called 'mode_table.dat'. When running batchfield multiple times in the same folder it is thus essential to rename mode_table.dat files from previous runs to avoid overwriting and loss of data. To avoid accidental loss of data, the keyword overwrite=.false. can be used.

The file contains a table with (in additiona to one header line) as many lines as input bcf/fbb files were used. Each line has 21 columns of numbers, followed by the # symbol and the originial mode (bcf or fbb) file name used for that line and a list of graphic output files generated. The head contains the name of variables found in each column.

  • Column 1: lambda (wavelength of the bcf/fbb file)
  • Column 2: pitch (minimum distance between two cylinders, zero if only one cylinder)
  • Column 3: diameter of first defined cylinder in position file
  • Column 4: modeclassnumber: class of symmetry of mode in bcf file (1 if no symmetry or c_inf_v)
  • Column 5: real part of neff
  • Column 6: imaginary part of neff
  • Column 7: effective modal radius, normalized to pitch
  • Column 8: effective mode area, normalized to pitch
  • Column 9: effective modal radius
  • Column 10: effective mode area
  • Column 11: effective radius of Bloch transform
  • Column 12: effective width of Bloch transform
  • Column 13: B0E/B1E where B_nH is the bessel coefficient of order n for the electric field of the first cylinder defined in the position file
  • Column 14: B0H/B1H where B_nH is the bessel coefficient of order n for the magnetic field of the first cylinder defined in the position file
  • Column 15: sum of all wijngaard test values for the electric field, outside buondaries of cylinders (if wijngaard resolution is not set to 0)
  • Column 16: Imaginary part of neff as calculated through Poynting vector integration of the fields (From Eq.10 and 11 in B. Kuhlmey et J. Opt Soc. Am B, vol 19,2331-2340, 2002) - the value can only be accurate if the window over which fields are calculated covers the entire waveguide, and resolution is high enough.
  • Column 17: Real part of neff as calculated through field integrals (A. Snyder and J. Love, Optical Waveguide Theory, Eq. 31-23)- the value can only be accurate if the window over which fields are calculated covers the entire waveguide, and resolution is high enough.
  • Column 18: Group index as calculated through field integrals (A. Snyder and J. Love, Optical Waveguide Theory, Eq. 31-30)- the value can only be accurate if the window over which fields are calculated covers the entire waveguide, and resolution is high enough.
  • Column 19: Waveguide group index as calculated through field integrals (A. Snyder and J. Love, Optical Waveguide Theory, Eq. 31-31)- the value can only be accurate if the window over which fields are calculated covers the entire waveguide, and resolution is high enough.
  • Column 20 and 21: overlap integral noverlapint,roverlapint as defined in the next section. The value can only be accurate if the window over which fields are calculated covers the entire waveguide (including evanescent tail), and resolution is high enough to resolve the region over which the overlap is to be calculated.

Parameter file format and structure

Parameter files for batchfield are standard text files that can be edited by any text editor. They take a similar format to parameter files for fibre.exe, but keywords are different. There are three parts to the parameter file:

  1. Definition of global parameters;
  2. Definition of the file output (which field components are to be written in which format etc);
  3. A list of all the files to be treated.

The software will go through the list of all the bcf or fbb files listed at the end of the file and write the required fields to separate files in the required format(s). It will also summarize in one single file called 'mode_table.dat' all the informatino processed, with one line per file treated containing wavelength, effective area and many more important quantities (see 'mode_table.dat' section below).

Definition of global parameters

The first part of every parameter file for batchfield contains definitions of parameters used to calculate all fields in all files, for example

resolution=100
bloch resolution=15
wijngaard resolution=-100
...

Keywords in this section include:

resolution (integer)
defines the number of points along the x and y axis for which the fields should be computed for each file (identical to resolution in Winfield) (optional, default value 75). High resolution (eg 200) are required if data for the effective rea or integrated losses are required with any accuracy, but large values lead to long processing times.
bloch resolution (integer)
number of points for the bloch transform (optional, default value 75). If no Bloch transform is written this parameter has no effect.
wijngaard resolution (integer)
number of points for the Wijngaard test. If a negative value is given, the Wijngaard test is skipped at the cladding/jacket boundary (optional, default value -100). If this parameter is set to zero the Wijngaard test is skipped.
width (real)
width of the region on which the field plots are required (-1 for automatic width setting based on the cladding radius, which corresponds to the default value when opening a file in winfield) (optional, default value -1).
zoom(real)
(from version 2.1.1.0) Corresponds to the zoom function in Winfield. When no field window width is defined, the viewport will be defined to be from -jacket_radius/zoom factor to +jacket_radius/zoom factor in both x and y directions. zoom factor<1 thus zooms out, zoom factor>1 zooms in. If the region over which fields are calculated is defined by any other means (using width, start_x etc) zoom has no effect.
overwrite (logical: .true. of .false.)
if set to .true., overwrites the mode_table file without causing an error. (optional, default value .true.)
genuine threshold (real)
because of the way symmetries are implemented, 'fibre' can sometimes find spurious solutions to the field equation which do not satisfy the symmetry condition of a class of modes and are thus not real solutions. These modes are generally (but not always) associated with high loss. Identifying these modes is easy in winfield as their field plots have no symmetry. Batchfield can calculate whether a mode satisfies the symmetry conditions of the class of modes the field is meant to be in, and reject spurious modes. This is done by calculating a quantity which is zero if symmetries are perfectly satisfied, and 1 if they are not satisfied at all. However, the degree to which symmetries are satisfied depends on the accuracy of the solutions found. 'genuine threshold' is a parameter that roughly defines how accurately symmetries have to be satisfied for the mode not to be rejected. Values to for genuine threshold should typically be small for small structures with few rings (say 1e-10 or even less), a bit larger for structures with large number of rings (eg 1e-3), and very large (>1) to ignore symmetry checking altogether (which is is useful for C_infinity_v simulations, and for simulations with multiple inclusions not having same order parameters: in both cases the symmetry test does not always work). (optional, default value 1e-8)
start_x (real)
start_y (real)
stop_x (real)
stop_y (real)
These are optional but either all or none should be defined. Together, they replace the width keyword and define the window of coordinates (from (start_x,start_y) to (stop_x, stop_y)) over which the field should be calculated.
lossradius (real)
losspoints (integer)
these optional parameters define the radius and number of points over which to calculate losses using the integration of the Poynting vector components (same as using loss calculation in Winfield). If losspoints=0 losses are not calculated using this method (a default value of -1 is reported instead). Ir lossradius=0 the integration region is set automatically (recommended). Default values are lossradius=0 and losspoints=0 (loss not calculated).
beam prop color scale (text)

This keyword defines the color scale to be used in conjunction with RSoft beam prop files. default is pbgposneg2.scl.

overlap index (complex)
overlap radius (real)

defines the regions to calculate the overlap with

  1. a region defined by the distance from the origin
  2. a region defined by a refractive index.

Two integrals are calculated, called noverlapint and roverlapint and are the last two numerical values on each line of mode_table.dat. If these keywords are undefined, both integrals will be zero. They are defined as:

Noverlapintnew.png

Roverlapint.png

Defining output fields, files and formats

Following the definition of global parameters is a list of blocks defining which field is to be written, in what format and with which name. Each block looks something like this:

field=E
norm=all
frmt=pbm
component=z
part=abs
name=lin_ez.ppm

The first line defines which field to write (here the electric field). The subsequent lines define the normalization to use, the file format (here a portable bitmap image is to be written), the field component (z component), the part (absolute value) and how to name the file. In the example above, for each bcf file in the list that passes the symmetry test a file containing a field plot of abs(E_z) in portable bitmap image format will be generated.

The parameter file can contain any number of such blocks, and each bloch will define an additional output file per bcf/fbb file in the list.

The keywords in this block and their possible values are:

field=E|H|S|Bloch|preview|index|coordinates|all
E,H, S writes the electric, magnetic and Poynting S fields respectively. bloch writes the Bloch transform. preview adds the precomputed fields (all components) to the .fbb file (this requires the fourier bessel file to be a fbb file, not compatible with bcf files; note that this can generate huge files if resolution is not small). index writes the refractive index distribution and coordinates generates matrices of x and y coordinates for easy plotting in external plotting software.

field=all (no further lines rqeuired in the block) writes all components of E and K (H normalized by the vacuum impedance) into a single file that can be easily imported into matlab; this is the same format as all fields in winfield. See how to Export fields.


part=real|imag|phase|abs|logabs
uses the real or imaginary part, the phase, the magnitude or the log of the magnitude of the field component respectively.
component=x|y|z|r|theta|norm
writes the specified x,y,z,r,theta component or the norm of the field respectively.
draw cylinders
if specified, draws the contour of the cylinders
norm=all|none|matrix|cladding
normalizes the output values to
  • all : max value is 1
  • none : field normalized so that the carried power along z is one
  • matrix: max value in the region inside the cladding (ie matrix+cylinders) is 1
  • cladding: max value in the region inside the jacket (ie matrix+cylinders+cladding) is 1 note that if you need several components and their relative magnitudes, you'll have to use 'none' since for all others the relative magnitude between components is lost.
format=xyz|matrix|pbm|beam prop
output format: either list of xyz values (xyz), text matrix of values (matrix), portable bitmap (pbm) or RSoft Beamprop compatible .m00/.p00 files (beam prop) note that the draw cylinder option works only with pbm, and that the part keyword has no effect with the beam prop format (which writes the full complex values)
name=text
adds text to the file name radix (defined by the input file without its extension) for the output file. (not sure it works with beam prop format ?). this keyword is optional, but if you don't use it you run the risk of overwriting existing files if you ask two different components/part/norm for the same field.

List of files

After as many combination of the above keywords as required are specified, the list of files is introduced by keyword 'list' followed immediately on the next lien by the list of files you want to process (after the list keyword, no blank lines are allowed). eg

list
file1.bcf
file2.fbb
file3.bcf