{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "36a9f2d0",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-10-02T14:46:40.132159Z",
     "iopub.status.busy": "2026-10-02T14:46:40.131908Z",
     "iopub.status.idle": "2026-10-02T14:46:40.140299Z",
     "shell.execute_reply": "2026-10-02T14:46:40.136502Z"
    },
    "papermill": {
     "duration": 0.010984,
     "end_time": "2026-10-02T14:46:40.140892+00:00",
     "exception": false,
     "start_time": "2026-10-02T14:46:40.129908+00:00",
     "status": "completed"
    },
    "tags": [
     "remove-input",
     "remove-output",
     "active-ipynb"
    ]
   },
   "outputs": [],
   "source": [
    "try:\n",
    "    from openmdao.utils.notebook_utils import notebook_mode  # noqa: F401\n",
    "except ImportError:\n",
    "    !python -m pip install openmdao[notebooks]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a9a6bc23",
   "metadata": {
    "papermill": {
     "duration": 0.000836,
     "end_time": "2026-10-02T14:46:40.142901+00:00",
     "exception": false,
     "start_time": "2026-10-02T14:46:40.142065+00:00",
     "status": "completed"
    },
    "tags": []
   },
   "source": [
    "# Units Definitions\n",
    "\n",
    "This is a list of all the units defined by default in the OpenMDAO library.\n",
    "Any entry in the `[base_units]` or `[units]` sections of the library is a known unit.\n",
    "Valid prefixes are given in the `[prefixes]` section of the library.\n",
    "\n",
    "See [Specifying Units for Variables](core_features/working_with_components/units.ipynb) for details on how to specify units on OpenMDAO variables."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "7488c626",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-10-02T14:46:40.145394Z",
     "iopub.status.busy": "2026-10-02T14:46:40.145185Z",
     "iopub.status.idle": "2026-10-02T14:46:40.356966Z",
     "shell.execute_reply": "2026-10-02T14:46:40.356146Z"
    },
    "papermill": {
     "duration": 0.213805,
     "end_time": "2026-10-02T14:46:40.357555+00:00",
     "exception": false,
     "start_time": "2026-10-02T14:46:40.143750+00:00",
     "status": "completed"
    },
    "tags": [
     "remove-input",
     "active-ipynb"
    ]
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "# Default unit library definitions.  Much of this is based on\n",
      "# http://www.bipm.org/utils/common/pdf/si_brochure_8_en.pdf\n",
      "# Look up other standards here:\n",
      "# https://www.nist.gov/pml/special-publication-811/nist-guide-si-appendix-b-conversion-factors/nist-guide-si-appendix-b8\n",
      "\n",
      "# ------------------------------------------------------------------------\n",
      "[prefixes]\n",
      "# ------------------------------------------------------------------------\n",
      "# prefix-string: float-multiplier [, comment]\n",
      "\n",
      "# SI.\n",
      "Y: 1.e24\n",
      "Z: 1.e21\n",
      "E: 1.e18\n",
      "P: 1.e15\n",
      "T: 1.e12\n",
      "G: 1.e9\n",
      "M: 1.e6\n",
      "k: 1.e3\n",
      "h: 1.e2\n",
      "da: 1.e1\n",
      "d: 1.e-1\n",
      "c: 1.e-2\n",
      "m: 1.e-3\n",
      "u: 1.e-6\n",
      "n: 1.e-9\n",
      "p: 1.e-12\n",
      "f: 1.e-15\n",
      "a: 1.e-18\n",
      "z: 1.e-21\n",
      "y: 1.e-24\n",
      "\n",
      "# IEC\n",
      "Ei: 1152921504606846976, (1 << 60)\n",
      "Pi: 1125899906842624,    (1 << 50)\n",
      "Ti: 1099511627776,       (1 << 40)\n",
      "Gi: 1073741824,          (1 << 30)\n",
      "Mi: 1048576,             (1 << 20)\n",
      "Ki: 1024,                (1 << 10)\n",
      "\n",
      "\n",
      "# ------------------------------------------------------------------------\n",
      "[base_units]\n",
      "# ------------------------------------------------------------------------\n",
      "# quantity-name: unit-name\n",
      "\n",
      "# SI.\n",
      "length: m\n",
      "mass: kg\n",
      "time: s\n",
      "current: A\n",
      "temperature: K\n",
      "amount: mol\n",
      "luminous_intensity: cd\n",
      "\n",
      "# Derived SI (Table 3).\n",
      "angle: rad\n",
      "solid_angle: sr\n",
      "\n",
      "# Other.\n",
      "money: USD\n",
      "passengers: pax\n",
      "digital_data: byte\n",
      "\n",
      "# Unitness\n",
      "Unitless: unitless\n",
      "\n",
      "\n",
      "# ------------------------------------------------------------------------\n",
      "[units]\n",
      "# ------------------------------------------------------------------------\n",
      "# unit-name: unit-expression, comment\n",
      "# OR\n",
      "# unit-name: factor, base-unit, offset, comment\n",
      "#\n",
      "# Note that unit names cannot be Python reserved words (such as 'in' for inch).\n",
      "# Unit names are matched before prefix names are checked.\n",
      "# A unit-expression cannot use prefixes (except for 'kg'), however 'pi' is\n",
      "# available as a predefined constant.\n",
      "\n",
      "g: kg/1000, gram\n",
      "\n",
      "# Derived SI (Table 3).\n",
      "Hz: 1/s, hertz\n",
      "N: m*kg/s**2, newton\n",
      "Pa: N/m**2, pascal\n",
      "J: N*m, joule\n",
      "W: J/s, watt\n",
      "C: A*s, coulomb\n",
      "V: W/A, volt\n",
      "F: C/V, farad\n",
      "ohm: V/A, ohm\n",
      "S: A/V, siemens\n",
      "Wb: V*s, weber\n",
      "T: Wb/m**2, tesla\n",
      "H: Wb/A, henry\n",
      "degC: 1, K, 273.15, degree celsius\n",
      "lm: cd*sr, lumen\n",
      "lx: lm/m**2, lux\n",
      "Bq: 1/s, becquerel\n",
      "Gy: J/kg, gray\n",
      "Sv: J/kg, sievert\n",
      "kat: mol/s, katal\n",
      "\n",
      "# Non-SI (Table 6).\n",
      "min: 60*s, minute\n",
      "h: 3600*s, hour\n",
      "d: 86400*s, day\n",
      "deg: (pi/180)*rad, degree\n",
      "arc_minute: deg/60, arc minute\n",
      "arc_second: arc_minute/60, arc second\n",
      "ha: 1e4*m**2, hectare\n",
      "L: 1e-3*m**3, liter\n",
      "t: 1e3*kg, tonne (metric ton)\n",
      "\n",
      "# Non-SI (Table 7).\n",
      "e: 1.60217653e-19*C, elementary charge\n",
      "eV: e*V, electron volt\n",
      "Da: 1.66053886e-27*kg, dalton\n",
      "u: Da, unified atomic mass unit\n",
      "ua: 1.49597870700e11*m, astronomical unit\n",
      "AU: 1.49597870700e11*m, astronomical unit\n",
      "c0: 299792458.*m/s, speed of light in vacuum\n",
      "hbar: 1.05457168e-34*J*s, reduced Planck Constant\n",
      "me: 9.1093826e-31*kg, electron mass\n",
      "a0: 0.5291772108e-10*m, Bohr radius\n",
      "Eh: 4.35974417e-18*J, Hartree energy\n",
      "\n",
      "# Non-SI (Table 8).\n",
      "bar: 1.e5*Pa, pressure\n",
      "Ang: 1.e-10*m, angstrom\n",
      "NM: 1.852e3*m, nautical mile\n",
      "b: 1.e-28*m**2, barn\n",
      "kn: NM/h, knot\n",
      "\n",
      "# Non-SI (Table 9).\n",
      "erg: 1.e-7*J, erg\n",
      "dyn: 1.e-5*N, dyne\n",
      "P: 0.1*Pa*s, poise (dynamic viscosity)\n",
      "St: 1.e-4*m**2/s, stokes (kinematic viscosity)\n",
      "sb: 1.e4*cd/m**2, stilb (luminance)\n",
      "ph: 1.e4*lx, phot (illuminance)\n",
      "# 'Gal' skipped due to likely confusion with volume unit.\n",
      "Mx: 1.e-8*Wb, maxwell (magnetic flux)\n",
      "# 'G' renamed 'gauss' to avoid confusion with acceleration unit.\n",
      "gauss: 1e-4*T, gauss (magnetic flux density)\n",
      "Oe: (1.e3/(4*pi))*A/m, oersted (magnetic field)\n",
      "\n",
      "# Backward compatibility.\n",
      "degK: K, degree Kelvin\n",
      "nmi: NM, nautical mile\n",
      "knot: kn, knot\n",
      "\n",
      "# Other length.\n",
      "inch: 2.54e-2*m, inch\n",
      "ft: 0.3048*m, foot\n",
      "mi: 1.609344e3*m, mile (U.S. statute)\n",
      "ly: c0*365.25*d, light year\n",
      "pc: 648000/pi*AU, parsec\n",
      "# Other mass.\n",
      "oz: 28.349523125*g, ounce\n",
      "lb: 16*oz, pound mass\n",
      "lbm: lb, pound mass\n",
      "ton: 2000*lb, ton (short)\n",
      "slug: 14.5939029*kg, slug\n",
      "\n",
      "# Other time.\n",
      "wk: 7*d, week\n",
      "week: 7*d, week (backward compatibility)\n",
      "a: 365.242199*d, year\n",
      "yr: a, year\n",
      "year: a, year (backward compatibility)\n",
      "mo: yr/12, month\n",
      "month: yr/12, month (backward compatibility)\n",
      "\n",
      "# Other temperature.\n",
      "degR: K*5./9., degree Rankine\n",
      "degF: 1, degR, 459.67, degree Fahrenheit\n",
      "\n",
      "# Other volume.\n",
      "tsp: 4.92892159375e-3*L, teaspoon\n",
      "tbsp: 3*tsp, tablespoon\n",
      "floz: 2*tbsp, fluid ounce\n",
      "cup: 8*floz, cup\n",
      "pt: 16*floz, pint\n",
      "qt: 2*pt, quart\n",
      "galUS: 3.785411*L, gallon (U.S.)\n",
      "galUK: 4.54609*L, gallon (U.K.)\n",
      "\n",
      "# Other miscellaneous.\n",
      "lbf: 4.44822162*N, pound force\n",
      "\n",
      "rev: 2*pi*rad, revolution\n",
      "rpm: 2*pi*rad/min, RPM\n",
      "rps: 2*pi*rad/s, RPS\n",
      "\n",
      "cal: 4.184*J, thermochemical calorie\n",
      "cali: 4.1868*J, international calorie\n",
      "Btu: 1055.05585262*J, British thermal unit\n",
      "MMBtu: 1055.05585262E6*J, one million Btu\n",
      "\n",
      "acre: mi**2/640, acre\n",
      "hp: 745.7*W, horsepower\n",
      "\n",
      "atm: 101325.*Pa, standard atmosphere\n",
      "torr: atm/760, Torr (1 mm of mercury)\n",
      "psi: 6894.75729317*Pa, pounds per square inch\n",
      "psf: psi/144, pounds per square foot\n",
      "inHg32: Pa*3386.389, inches of mercury at 32degF\n",
      "inHg60: Pa*3376.85, inches of mercury at 60degF\n",
      "\n",
      "mu0: 4.e-7*pi*N/A**2, permeability of vacuum\n",
      "eps0: 1/mu0/c0**2, permittivity of vacuum\n",
      "Grav: 6.67259e-11*m**3/kg/s**2, universal gravitational constant\n",
      "Nav: 6.0221367e23/mol, Avagadros number\n",
      "R: 8.31424*J/(mol*K), gas constant\n",
      "V0: 2.24136*m**3/(1000*mol), volume of ideal gas\n",
      "planck: 2*pi*hbar, Planck constant\n",
      "mp: 1.672614e-27*kg, proton rest mass\n",
      "mn: 1.674920e-27*kg, neutron rest mass\n",
      "sigma: 5.66961e-8*W/(m**2*K**-4), Stefan-Boltzmann constant\n",
      "Ken: 1.380649e-23*J, kelvin as energy unit\n",
      "Rinfinity: 1.09737312e7/m, Rydberg constant\n",
      "re: 2.817939e-15*m, classic electron radius\n",
      "lambdac: 2.4263096e-12*m, Compton wavelength of electron\n",
      "lambdap: 1.3214409e-15*m, Compton wavelength of proton\n",
      "lambdan: 1.3196217e-15*m, Compton wavelength of neutron\n",
      "mue: 9.284851e-24*J/T, electron magnetic moment\n",
      "mup: 1.4106203e-26*J/T, proton magnetic moment\n",
      "mub: 9.274096e-24*J/T, bohr magneton\n",
      "mun: 5.050951e-27*J/T, nuclear magneton\n",
      "gammap: 2.6751270e8*rad/(s*T), gyromagnetic ratio of protons in H2O\n",
      "gammapc: 2.6751965e8*rad/(s*T), gyromagnetic ratio of protons in H2O corrected for diamagnetism of H2O\n",
      "phi0: 2.0678538e-15*Wb, magnetic flux quantum\n",
      "hme: 7.273894e-4*J*s/kg, quantum of circulation\n",
      "\n",
      "percent: unitless/100, percentage\n",
      "drag_count: unitless/1e4, drag count\n",
      "\n"
     ]
    }
   ],
   "source": [
    "from openmdao.utils import units\n",
    "import os\n",
    "defs = os.path.join(os.path.dirname(units.__file__), 'unit_library.ini')\n",
    "with open(defs, 'r') as f:\n",
    "    print(f.read())"
   ]
  }
 ],
 "metadata": {
  "celltoolbar": "Tags",
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.13.14"
  },
  "papermill": {
   "default_parameters": {},
   "duration": 1.191811,
   "end_time": "2026-10-02T14:46:40.673256+00:00",
   "environment_variables": {},
   "exception": null,
   "input_path": "/home/runner/work/OpenMDAO/OpenMDAO/openmdao/docs/openmdao_book/features/units.ipynb",
   "output_path": "/home/runner/work/OpenMDAO/OpenMDAO/openmdao/docs/_executed_book/features/units.ipynb",
   "parameters": {},
   "start_time": "2026-10-02T14:46:39.481445+00:00",
   "version": "2.7.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}