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
Unitsobject 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:
- class xara.units.Units(base: UnitSystem)#
Length
meterLength unit in the SI system.
inchLength unit defined as 0.0254 of a meter.
footLength unit defined as 0.3048 of a meter.
yardLength unit defined as 0.9144 of a meter.
Force
newtonForce 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_forceForce unit defined as the force exerted by gravity on a mass of one pound.
kilopoundForce unit defined as 1000 pounds-force.
Stress
pascalStress/Pressure unit defined as one newton per square meter.
gigapascalStress/Pressure unit defined as \(10^9\) pascals.
megapascalPressure unit defined as \(10^6\) pascals.
psiStress/Pressure unit defined as one pound-force per square inch.
psfStress/Pressure unit defined as one pound-force per square foot.
ksiStress/Pressure unit defined as 1000 pounds-force per square inch.
ksfStress/Pressure unit defined as 1000 pounds-force per square foot.
Mass
kilogramBasic SI unit of mass.
pound_massInternational avoirdupois pound, defined as 0.45359237 kilograms.
slugAcceleration
gravityAcceleration due to gravity defined as 9.80665 meters per second squared.
centimeter_per_second_squaredAcceleration 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_meterDensity 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
pcfWeight unit defined as one pound-force per cubic foot.
Area
square_meterArea unit defined as a square with sides of 1 meter.
square_inchArea unit defined as a square with sides of 1 inch.
square_footArea unit defined as a square with sides of 1 foot.
square_yardArea 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.