fpt and WinFPT Reference Manual - Command-line Commands

CHECK UNITS

Syntax:

[DO NOT] CHECK UNITS

fpt Version

This command is implemented experimentally in version 3.6-b of fpt and later.

Function

fpt automatically determines the physical units of all scalar real and complex variables. It reports any inconsistencies in units detected during the analysis. A table of the different units identified and the relationships between them may be generated by the SHOW UNITS command. The report generated by CHECK UNITS is limited to the inconsistencies detected.

fpt infers units from the use of variables in algebraic expressions. It first analyses the use of every REAL or COMPLEX variable to determine which uses are independent of one another and are therefore not required to have the same units. The independent usages are termed "lives". Please see the command SHOW LIVES for a description of this analysis. The physical units and dimensions are then analysed as follows:

• If two variable lives are connected by assignment, addition, subtraction or relational operators they must have the same units.
• If two variable lives are connected by multiplication, division or exponentiation operators, a relationship is inferred between the units associated with the lives.
• The arguments and reslts of many intrinsic functions have predeterined units. For example, the argument to SIND has units of degrees of arc and the result is dimensionless.
• Pattern matching is used to identify equivalence between units. If two different units are found to equivalent to the same algebraic combination of other unts, the two units are recognised as equivalent.

All inconsistencies between units could be resolved by the assumption that all units are dimensionless. fpt therefore assumes that no real or complex variables represent dimensionless quantities unless they have been declared to be dimensionless by the user, in a UNITS command, or they have been used in intrinsic functions in such a way that they must be dimensionless.

Notation:

The notation for the reported units is as follows:

1. If the units are determined from the use of intrinsic functions they are reported as the unit name, for example, dimensionless, degrees_arc or seconds.
2. If the units have been specified by UNITS statements in fsp files or in the code, they are reported by the name specified in the UNITS statement.
3. Units for which no description is available are reported as, for example, units(gamma,5), where gamma is the name of the variable, and 5 is the life number. If the variable has only a single life, the life number is omitted, as in units(gamma). If a variable name is ambiguous because the name is used in two or more routines, the name is written, for example, as /coeffs/gamma or as dragsub\gamma where /coeffs/ is the name of the COMMON block containing gamma or dragsub is the name of the sub-program in which it occurs.

Format of the Report

Inconsistencies in units are detected during the analysis of algebraic expressions. When an inconsistency is detected, fpt reports an audit trail of the successive units substitutions made in analysing the expression. An inconsistency implies either the use of an undeclared dimensionless quantity, or an error in the code. The audit trail should assist in identifying the problem.

Where to Use this Command

 Operating system command line Yes Configuration file, config.fsp Yes Specification (fsp) files, *.fsp Yes Interactively, to FPT> prompt Yes Interactive command files Yes Embedded in the Fortran code Yes

Default

No check is made by default.

Example

A section of a report is shown below:

------------------------------------------------------------- WARNING Number 3253 Severity 1 (Worst 1) Count 48 File: e:\projects\fpt\fpttests\uh60a\original_source\bench.f C4Q=1.0-C1Q-C2Q-C3Q ^ Inconsistency detected in units and dimensions -------------------------------------------------------------- Units of the objects -------------------- C1Q Units(C2Q) C2Q Units(C2Q) C3Q Units(EZWNTQ) Successive substitutions in analysing units ------------------------------------------- Initial units of sub-expression: <Undetermined> - Units(C2Q) - Units(C2Q) - Units(EZWNTQ) Units(C2Q) + Units(C2Q) + Units(EZWNTQ) Units(C2Q) + Units(EZWNTQ) These units are inconsistent