Using physical units in Underworld

Using physical units in Underworld

Published on

Using physical units and how to appropriately scale a model is a top question users ask when beginning with Underworld. The equations Underworld solves are stated in a physically correct form, they remain valid as long as every material constant, geometry, time, etc., are expressed in the same system. There is no explicit concept of units no scaling in Underworld, the choice is entirely left to the user. One can thus decide to use the Meter Kilometer Second system or a dimensionless system, defining the model such that length, density and viscosity of the material are one, etc. Both approaches are correct and allow for more flexibility, but with great power comes great responsibility. The user must ensure the units are consistent.

dimensional_analysis
https://www.explainxkcd.com/wiki/index.php/687:_Dimensional_Analysis

The scaling of the problem, although related to the choice of system units, is a much broader subject. Computers generally have trouble accurately solving for a wide range of numbers. In numerical methods, this issue can result in a matrix with a large Condition number and is difficult to invert(solve) accurately. By using an appropriate scaling, the wide range of numbers can be reduced, thus minimising numerical errors.

From a mathematical point of view, non-dimensionalisation conserves the relationships between parameters. From a numerical point of view, it is often unclear whether the choice of reference value will ensure numerical stability. A rule of thumb is to keep values as close to one as possible. This can become challenging for Earth modeling problems when dealing with non-linear viscosities and values spanning several orders of magnitude.

Another problem arises from the fact that different communities in Earth Science have different backgrounds and usages. A simple example is the number of units we constantly switch between when dealing with space and time: as for when we describe the diffusion of temperature at the grain scale or the cooling of the entire planet.

Here I detail a workflow used to overcome these issues. It is by no mean the only way, but I have found it easy to use and it reduces the risk of error considerably. It is a simple way to solve the problem of unit consistency and scaling.

I have written a small python module which leverages Pint, a python package used to define and manipulate physical units. Pint uses a system of unit registries to define a large set of units and most of their prefixes. A Pint Quantity object is a physical value which has a specific unit attached to itself. Quantity objects can be use in mathematical expressions which also return Quantities in appropriate units.

The example is available here:

Units/Scaling Example

And if you want to explore the convection simulation:

[M. Kronbichler, T. Heister, and W. Bangerth. High accuracy mantle convection simulationthrough modern numerical methods.Geophysics Journal International, 191:12–29, 2012.]

Authors
More posts by Romain Beucher.
Related Posts
Viscoelasticity in Underworld2
Craton Formation and the Onset of Plate Tectonics
Modelling Drips and Delamination with Underworld
Shear Bands with Dilatancy modelled with Underworld
Underworld2 Workshop at CIG 2016 Meeting
Underworld 2
Share
Twitter icon Facebook icon