In cva.f90 and BlasterSim’s core simulation procedures otherwise, all variables are in SI units. However, the inputs and outputs may be in other units.
Some code comments contain bibliographic keys referring to the BlasterSim documentation’s BibTeX database. The BibTeX database is located at docs/blastersim.bib, and the associated keys can be found there.
Some code comments may refer to handwritten notes. I intend to slowly clean up and add these notes to this documentation.
Constants (parameters in Fortran terminology) are denoted by capitalizing the variable name. Note that this is different from convention used for intensive and extensive quantities in the typeset math in this documentation as discussed in § 2.1.1. Because each variable in BlasterSim’s source code is given a unit (see § 3.1.4), whether a quantity is extensive or intensive can be determined from the units for that quantity, if unclear.
The control volume index for the barrel is I_BARREL, which is set to . This convention allows BlasterSim to easily know which control volume is the barrel.
The control volume index for the “source” (which control volume the propelling gas originates from, whether plunger tube or pressure chamber) is I_SOURCE, which is set to .
integer variables named rc are used for return codes. 0 or negative return codes indicate success, with 0 being normal success and negative numbers having a special context-dependent meaning. The parameter SUCCESS_RC is set to 0 and used to improve readability. Positive return codes indicate failure.
The subroutine run is the main simulation loop in BlasterSim. run takes an initial state and runs the simulation until a termination criteria is met. The derived type run_status_type is returned by run. run_status_type contains a return code rc and a time t If rc is not SUCCESS_RC, then run_status_type optionally can set arrays i_cv and data to contain information about particular control volumes to make error and warning messages more meaningful.
In io.f90, variable names ending with _u use the Fortran types that check the units described in § 3.1.4. The _u suffix avoids name conflicts with the variables used in the namelists, which are Fortran reals.
All control volumes in BlasterSim are internally represented as drawn in § 2.1.1. This general control volume view has consistent notation for all control volumes. A consequence of this is that plunger velocities will be negative as the plunger volume decreases, not positive as some might expect. Projectile velocities are positive as the projectile moves towards the barrel exit, as expected.
In cva.f90, in the cv_type derived type, there is a member variable named i_cv_mirror For control volumes with a projectile/plunger, i_cv_mirror is set to the control volume index for the control volume on the other side of the projectile/plunger. For constant volume chambers where there is no projectile/plunger, set i_cv_mirror to zero to disable the mirror control volume feature.
In blastersim.f90, when errors occur, terminate BlasterSim with exit code EX_USAGE when the problem is probably caused by user input, and terminate BlasterSim with exit code EX_SOFTWARE when the problem is probably caused by a bug in BlasterSim. This distinction will help when doing fuzz testing of BlasterSim so that the fuzz tester can distinguish between bugs and bad inputs.
In the documentation, put no more than one sentence per line of LaTeX code. Breaking up a sentence into clauses may be useful in some contexts as well, and breaking up a mathematical expression into multiple LaTeX lines is also often useful. In LaTeX, a new line does not create a new paragraph if the next line has text. An empty line creates a paragraph. This helps identify changes easier with some diff programs, allows adding comments on a per-sentence basis in LaTeX, and can ease identifying where LaTeX compilation errors are.