Skip to content

Introduction ​

FURY (Fortran Units (environment) for Reliable phYsical math) is a pure Fortran library for physical computations that check their units of measure. A FURY quantity is a number together with its unit: the operators of the language work on quantities as on numbers, and FURY checks and propagates the units at every step.

f90
distance = 100._R8P * metre
time     = 9.58_R8P * second
speed    = distance / time
$ bolt
distance : 100.00 m
time     :   9.58 s
speed    : 10.438 m.s-1 [length.time-1]

The quotient of a length by a time is a speed: its unit m.s-1 and its dimensions length.time-1 are derived by FURY, not written by hand. Add a length to that speed, assign it to a time, convert it to kilograms, and the program stops with an error that says what is wrong.

Why ​

On 23 September 1999 the Mars Climate Orbiter was lost entering the Martian atmosphere. The investigation board found the root cause in a ground software file, SM_FORCES, that produced the impulses of the thrusters in pound-force seconds, where the navigation software expected newton seconds: every correction of the trajectory was underestimated by a factor of 4.45. The two numbers were plausible, the programs ran, and nothing checked the units.

FURY makes that check part of the arithmetic. The same mistake, written with FURY:

f90
program mco
!< The Mars Climate Orbiter mishap: an impulse in pound-force seconds summed to one in newton seconds.
use fury
implicit none
type(uom64)   :: newton, pound_force, second
type(qreal64) :: impulse_ground, impulse_spacecraft, total

newton      = uom64('kg [mass].m [length].s-2 [time-2] (N[force]) {newton}')
pound_force = uom64('lbf< = 4.4482216152605 * N> [force] {pound_force}')
second      = uom64('s [time] {second}')

impulse_spacecraft = 10._R8P * (newton * second)       ! the spacecraft expected newton seconds
impulse_ground     = 10._R8P * (pound_force * second)  ! the ground software produced pound-force seconds

print '(A)', 'spacecraft: '//impulse_spacecraft%stringify(format='(F5.1)', with_dimensions=.true.)
print '(A)', 'ground    : '//impulse_ground%stringify(format='(F5.1)', with_dimensions=.true.)
total = impulse_spacecraft + impulse_ground
print '(A)', 'total     : '//total%stringify(format='(F5.1)')
endprogram mco
$ mco
spacecraft:  10.0 kg.m.s-1 [mass.length.time-1]
ground    :  10.0 lbf.s [force.time]
error: cannot add "+10.0 kg.m.s-1 [mass.length.time-1]" and "+10.0 lbf.s [force.time]"
[exit status 1]

The program does not produce a wrong trajectory: it stops at the sum, with a non-zero exit status that a script or a batch system sees. The Background page tells more about the question behind FURY.

The concepts ​

ConceptTypeWhat it is
Unit of measureuom64a product of reference units, kg.m.s-2, each with its symbol, aliases and dimensions
Quantityqreal64a real magnitude and its unit: 9.81 m.s-2
Units systemsystem_si64a catalogue of units, prefixes and constants queried by name: SI%unit('newton')
Converteruom_convertera formula of your own for conversions that are not a factor and an offset

Every type comes in three real kinds, suffixed 32, 64 and 128 (see Precision).

Reading this documentation ​

The pages read in order, and each one links to the next:

  1. Installation: get FURY into your project.
  2. The tutorial: nine short chapters, from a first quantity to a units system of your own.
  3. The cookbook: short recipes, one for each "how do I ...?".
  4. The reference, from the feature map on: the unit grammar, every type, every error.

The API documents the source itself. Upgrading from an older release? See Upgrading.

Every code sample of this documentation is part of a program that is compiled and run to produce the outputs shown (see docs/examples).

Authors ​

FURY is dedicated to W. Van Snyder. Contributions are welcome — see the Contributing page.

Copyrights ​

FURY is distributed under a multi-licensing system:

Use caseLicense
FOSS projectsGPL v3
Closed source / commercialBSD 2-Clause
Closed source / commercialBSD 3-Clause
Closed source / commercialMIT

Released under GPL v3, BSD 2-Clause, BSD 3-Clause or MIT, at your choice.