J3/04-215
Date: 2004-01-14
To: J3
From: Walt Brainerd
Subject: Support for physical dimensions and units
Date:
2003-12-10 at 11:28:10
Request number:
Pub-108
Name:
Grant Petty
E_mail:
gpetty@aos.wisc.edu
=====================================================
Number:
Title: support for physical dimensions and units
Submitted by: J3
Status: For Consideration
References:
Basic Functionality: As either a standard module or language extension, provide the ability
to track and manipulate physical dimensions (e.g. length,
time, mass, charge) and units (meters, miles, furlongs, etc.).
Flag as run-time errors physically invalid operations.
Rationale: Fortran is most widely used in the physical and engineering sciences.
It is not uncommon to have to deal with conversions between dissimilar
systems of units (SI, cgs, English, etc.). Historically, these conversions
always had to be undertaken by the programmer. Errors in conversion are
scientific codes, and they are hard to catch. Among other things
Fortran allows one to add a length to a mass, even though this
is forbidden from a physical point of view. With a physical dimensions/units
extension, it is possible to catch this as a run-time error,
not unlike division by zero. This will greatly reduce the occurrence
of computational errors due to incorrect coding of physical
formulas.
Estimated Impact: It has already been implemented as an external module for
F90. It has been very useful in my research group. It will
be of great interest to other scientific and engineering
programmers.
It could have prevented the crash into Mars of a
$250 million NASA space probe. The crash occurred because
incompatible units were being used by the engineers and
NASA flight control personal.
There is no known downside to adding the functionality, since
it can be ignored if not needed and has no impact on Fortran
code that does not exploit the module features.
Detailed Specification:
Please see my summary, including source code, a journal paper, and simple example programs,
at http://meso.aos.wisc.edu/~gpetty/physunits.html
History: Submitted as Pub-108