Units#

OpenSees/đťś’ara does not assume or enforce any unit system internally. All model inputs (coordinates, mass, forces, stiffness, etc.) are numeric values, and the user must take care to maintain consistency in the unit system used.

The xara.units submodule contains predefined constants that can help with keeping track of units.

xara.units.create_units(system=None, length=None, force=None, mass=None) → Units#

Create a Units object for the specified unit system or custom length, force, and mass units.

Parameters:
system: str

The unit system to use (e.g., “mks”, “cgs”, “fps”).

length: str

The length unit (e.g., “meter”, “centimeter”).

force: str

The force unit (e.g., “newton”, “dyne”).

mass: str

The mass unit (e.g., “kilogram”, “gram”).

Returns:

A Units object configured for the specified system or custom units.

Return type:

Units

class xara.units.Units(base: UnitSystem)#

Length

meter

Length unit in the SI system.

inch

Length unit defined as 0.0254 of a meter.

foot

Length unit defined as 0.3048 of a meter.

yard

Length unit defined as 0.9144 of a meter.

Force

newton

Force unit in the SI system defined as the force required to accelerate a mass of one kilogram at a rate of one meter per second squared.

pound_force

Force unit defined as the force exerted by gravity on a mass of one pound.

kilopound

Force unit defined as 1000 pounds-force.

Stress

pascal

Stress/Pressure unit defined as one newton per square meter.

gigapascal

Stress/Pressure unit defined as \(10^9\) pascals.

megapascal

Pressure unit defined as \(10^6\) pascals.

psi

Stress/Pressure unit defined as one pound-force per square inch.

psf

Stress/Pressure unit defined as one pound-force per square foot.

ksi

Stress/Pressure unit defined as 1000 pounds-force per square inch.

ksf

Stress/Pressure unit defined as 1000 pounds-force per square foot.

Mass

kilogram

Basic SI unit of mass.

pound_mass

International avoirdupois pound, defined as 0.45359237 kilograms.

slug

Acceleration

gravity

Acceleration due to gravity defined as 9.80665 meters per second squared.

centimeter_per_second_squared

Acceleration unit defined as 0.01 meters per second squared.

Mass Density

A unit of density is obtained by dividing a unit of mass by a unit of volume.

kilogram_per_cubic_meter

Density unit defined as one kilogram per cubic meter.

It is often convenient to calculate these manually as a ratio of mass on length cubed, eg,

rho = 2643.0 * kg / (meter ** 3)

In the US customary system, density is often available as a unit weight. In this case, an appropriate mass density is obtained by dividing by the acceleration due to gravity,

rho = 150.0 * pcf / gravity

Weight Density

pcf

Weight unit defined as one pound-force per cubic foot.

Area

square_meter

Area unit defined as a square with sides of 1 meter.

square_inch

Area unit defined as a square with sides of 1 inch.

square_foot

Area unit defined as a square with sides of 1 foot.

square_yard

Area unit defined as a square with sides of 1 yard.

Systems#

The idiom for importing constants from a system takes the form:

from xara.units.<system> import <symbols>...

where <system> is one of the implemented systems. For example, to import the symbols inch, kip, N and Pa from the us system,

from xara.units.us import inch, kip, N, Pa

Occasionally it is convenient to import all symbols using a star-import

from xara.units.us import *

Note, however, that this is generally considered bad programming style.

Examples#