In 2026, CFD Direct made units a standard feature of Foundation OpenFOAM. The feature allows users to accompany numerical parameters in input files with units, e.g. [ft/s] for feet per second. When the data is read with units, the numerical value is converted into the base unit, i.e. [m/s] (metres per second) for the default SI unit set. The supplied units are generally checked for consistency with the dimensions of the parameter, e.g. length × time–1 in our example.
Dimensions
For as long as anyone can remember OpenFOAM has included the concept of dimensions (it was the second thing Henry Weller wrote when creating FOAM in the early 1990s). By dimensions, we mean dimensional units, which describe the base units of measurement for a property. OpenFOAM traditionally represents dimensional units in I/O using an array of seven exponents, e.g. [0 1 -1 0 0 0 0], which correspond sequentially to mass, length, time, temperature, quantity (e.g. moles), current and luminous intensity. The array shown here thus describes length × time–1. OpenFOAM uses dimensions to ensure all executed mathematical operations are meaningful by checking dimensions are consistent e.g. on the left and right hand side of +, – and = operations.
From Dimensions to Units
A property with a single value, e.g. kinematic viscosity nu, is generally represented by the dimensioned<Type> class in OpenFOAM, which combines a value with a set of dimensions (and a word for its name). Historically a dimensioned value was specified in input files with all its components. For example, as recently as OpenFOAM v9 (2021), the nu parameter in the pitzDaily tutorial case was specified in the input file as follows.
nu [0 2 -1 0 0 0 0] 1e-05;
The inclusion of the dimensions in the example above was unnecessary since the dimensions of nu were specified in the code to be those of kinematic viscosity. In OpenFOAM v10 (2022), the dimensions were removed leaving just the value.
nu 1e-05;
But then in OpenFOAM v12 (2024), it became possible to provide units with input parameters like nu, after its value. The value is then converted into the base units accordingly. For example, kinematic viscosity might be represented by the centistokes unit[cSt] as follows.
nu 10 [cSt];
The foamUnits utility
In OpenFOAM 14, units became a standard feature, following the creation of the foamUnits utility and improvements to global constant in the configDict file. The foamUnits utility was a replacement for the former foamUnits script and provided a quick way for users to list units, their conversion factors and corresponding dimensions. The OpenFOAM v14 User Guide documents units and dimensions in sections 4.2.6: Dimensional units, 4.2.7: Units and unit conversion, 4.3: Global settings and 4.7.7: The foamUnits utility. The use of foamUnits is summarised briefly here.
First, running foamUnits without arguments will list dimensions and units. An example output for the units is shown below.
Fundamental Units: [Cd] [m] [K] [kmol] [A] [rad] [kg] [s] Derived Units: [J] [N] [Pa] [Hz] [V] [W] Scaled Units: [lb] [rot] [mi] [deg] [mol] [min] [ms] [cm] [R] [in] [hr] [lbmol] [g] [%] [mm] [km] [um] [us] [yd] [ft] Derived-Scaled Units: [rpm] [psi] [kcal] [atm] [kPa] [bar] [lbf] [cal] [cSt] [ml] [cP] [pdl] [l] [MPa]
The user can get detailed information about any unit including ones formed by combining units with mathematical operations. For information about miles per hour, the user can enter it as an argument to foamUnits which returns the following output.
> foamUnits "mi/hr" Unit [mi/hr] + Dimensions = [length time^-1] + Standard Unit = [m s^-1] + Conversion Factor = 0.44704
Named dimensions
Units can be used with all input parameters in OpenFOAM 14, including the internal and boundary field entries of a field file. Those files also include the dimensions entry which can now be specified either with the original exponent format or using named dimensions. The latter format is now preferred with all example cases in OpenFOAM 14 using that format. The named dimensions as listed by foamUnits.
Fundamental Dimensions:
[time] [temperature] [length] [moles] [luminousIntensity] [current] [mass]
Derived Dimensions:
[entropy] [heatCapacity] [gasConstant] [massFlux] [specificPower]
[compressibility] [velocity] [dynamicViscosity] [specificEnergy] [density]
[pressure] [charge] [kinematicViscosity] [heatFlux] [area] [force] [rate]
[energyDensity] [specificEntropy] [electricPotential]
[turbulentKineticEnergy] [dynamicDiffusivity] [power] [powerDensity]
[ReynoldsStress] [momentumDensity] [magneticFluxPressure] [turbulentEpsilon]
[kinematicPressure] [momentum] [energy] [kineticEnergy] [volume]
[magneticFluxDensity] [turbulentViscosity] [specificHeatCapacity]
[volumetricFlux] [thermalConductivity] [kineticEnergyDensity]
[turbulentOmega] [chargeDensity] [kinematicStress] [acceleration]
As with units, the user can get more information about a specific dimension by adding it as an argument to foamUnits, e.g.
> foamUnits pressure Dimension [pressure] + Dimensions = [mass length^-1 time^-2] + Exponents = [1 -1 -2 0 0 0 0] + Standard Units = [kg m^-1 s^-2] [Pa] + Other Units = [psi] [atm] [kPa] [bar] [MPa]
Not only does it provide the equivalent exponential and base named dimensions, it also provides base and derived units.
Greater confidence
When we are doing CFD, it is extremely important to be in control of quantities and parameters involved. We need to be certain of the units and dimensions of the parameters we provide and those written as results — something we teach extensively on our Productive CFD courses. Units provide both the flexibility to specify parameters in the units given in the real world problem, but they can also make us aware of the associated dimensions and ensure values we provide are dimensionally consistent. For example, when dealing with kinematic viscosity nu, we are able to check the associated dimensions and units using foamUnits.
> foamUnits kinematicViscosity Dimension [kinematicViscosity] + Dimensions = [length^2 time^-1] + Exponents = [0 2 -1 0 0 0 0] + Standard Unit = [m^2 s^-1] + Other Units = [cSt]
We could then even provide the standard unit with the nu parameter in the input file. While no conversion of the input value would be performed, the units provide us with certainty of the parameter’s dimensions.
nu 1e-5 [m^2 s^-1];
