1.5 BlasterSim inputs in general

BlasterSim uses Fortran namelist format input files. Namelist files are broken into groups and variables. A group starts with the & symbol, then the name of the group, and contains one or more variables which themselves are the actual input data. A group ends with the / symbol. For example, in the example namelist input file below, see that group1 group contains the variables a, b, and c. a is an integer, b is a floating point number (decimal number), and c is a string (which must be quoted). A namelist file can contain multiple groups. The example below has two groups, group1 and group2. Comments can be added with the ! symbol. Comments can take up an entire line as in the group1 namelist below, or be placed at the end of a line as in the group2 namelist below.

&group1
a = 0
b = -1.01
c = "string1"
! comment
/
&group2
x = 1
y = 2.05 ! comment
z = "string2"
/

For more details of the namelist format, refer to the Intel Fortran Compiler documentation [4].

BlasterSim input files are plain text files that can be opened in any text editor including Notepad in Windows.

BlasterSim does not care what the file extension is as long as the contents of the input file are valid. You can use .txt if that’s more convenient for you. Using .nml as the file extension will give you code highlighting in some text editors, however, which can make the file more readable. Namelist code highlighting is available in Notepad++.

BlasterSim uses metric units in its input files and internally. Support for other unit systems is not planned due to the complexity of supporting multiple unit systems. Scientific notation can be used to appropriately scale inputs. For example, instead of 13 mm being written as 0.013, the user can write 13.0e-3. When possible, I try to pick metric units that are convenient for each variable so that scaling is unnecessary. This is not possible for lengths as BlasterSim is intended to work for a range of gas gun systems, from small pellet guns all the way through potato cannons. Given the wide range of scales, for lengths the unit of m was selected, and the e notation previously mentioned can be used so that the user can select the appropriate scale.

Because the namelist file format is part of the Fortran standard, the reading of the namelist files is a built-in feature of a Fortran compiler and not something that BlasterSim has complete control over. Some error messages from bad namelist input files may be unclear, but are unfortunately beyond the control of BlasterSim. BlasterSim releases use the gfortran compiler, which has the following confusing error messages:

  • BlasterSim will think that your input file is empty and return the error “ERROR: Empty input file?” if the input file does not contain a new line character after the final / in a namelist group. This is a bug in gfortran in my view. When BlasterSim prints this error message, it will include a suggestion to add an empty line after the / to see if that will help, so the user doesn’t have to dig through the docs.

  • Sometimes you might get an error message like “Bad real number in item 5 of list input”. Note that this says item 5, not line 5 of the input file. It is referring to the 5th variable declaration. In the example namelist input file in this section, this would correspond to the y variable, and the user is going to have to fix something with the number format in y.