Skip to content

Commit

Permalink
implemented generalized UnitSystem conversions
Browse files Browse the repository at this point in the history
  • Loading branch information
chakravala committed Dec 12, 2020
1 parent 483316f commit 080a370
Show file tree
Hide file tree
Showing 8 changed files with 2,496 additions and 288 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "UnitSystems"
uuid = "3a241a3c-2137-41aa-af5e-1388e404ca09"
authors = ["Michael Reed"]
version = "0.1.1"
version = "0.2.0"

[compat]
julia = "1"
Expand Down
47 changes: 38 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,57 @@
# UnitSystems.jl

*Physical unit system constants (Metric, English, Natural, etc...)*
*Physical unit systems (Metric, English, Natural, etc...)*

[![DOI](https://zenodo.org/badge/317419353.svg)](https://zenodo.org/badge/latestdoi/317419353)
[![Build Status](https://travis-ci.org/chakravala/UnitSystems.jl.svg?branch=master)](https://travis-ci.org/chakravala/UnitSystems.jl)
[![Build status](https://ci.appveyor.com/api/projects/status/r4gmftclfm30ik9n?svg=true)](https://ci.appveyor.com/project/chakravala/unitsystems-jl)
[![Coverage Status](https://coveralls.io/repos/chakravala/UnitSystems.jl/badge.svg?branch=master&service=github)](https://coveralls.io/github/chakravala/UnitSystems.jl?branch=master)
[![codecov.io](https://codecov.io/github/chakravala/UnitSystems.jl/coverage.svg?branch=master)](https://codecov.io/github/chakravala/UnitSystems.jl?branch=master)

Specifications for dimensional units are in the [UnitSystems.jl](https://github.com/chakravala/UnitSystems.jl) and [UnitfulSystems.jl](httsp://github.com/chakravala/UnitfulSystems.jl) repositories.
The two packages are designed so that they can be interchanged if compatibility with [Unitful.jl](https://github.com/PainterQubits/Unitful.jl) is desired or not.
However, the `UnitfulSystems` package has fewer `UnitSystem` specifications available than the `UnitSystems` package due to limitations in combination with the `Unitful` package.
Specifically, `Metric`, `SI2019`, `CODATA`, `Conventional`, `MTS`, `EMU2019`, `English`, and `EnglishUS` can have `Unitful` values; while `Gauss`, `LorentzHeaviside`, `Thomson`, `EMU`, `ESU`, `ESU2019`, `IAU`, `FFF`, `Planck`, `PlanckGauss`, `Stoney`, `Hartree`, `Rydberg`, `Schrodinger`, `Electronic`, `Natural`, `NaturalGauss`, `QCD`, `QCDGauss`, and `QCDoriginal` are plain valued.

```Julia
pkg> add UnitSystems # or UnitfulSystems

julia> using UnitSystems
```

A `UnitSystem` is a consistent set of dimensional values selected to accomodate a particular use case or standardization.
In total, five fundamental constants `kB,ħ,𝘤,μ₀,mₑ` are used to specify a specific unit system. These are the constants of `boltzmann`, `planckreduced`, `lightspeed`, `permeability`, and `electronmass`.
Different choices of natural units or physical measurements result in a variety of unit systems optimized for many purposes.
It is possible to convert derived physical quantities from any `UnitSystem` specification into any other using accurate values.
In total, five fundamental constants `kB,ħ,𝘤,μ₀,mₑ` are used to specify a specific unit system.
These are the constants of `boltzmann`, `planckreduced`, `lightspeed`, `permeability`, and `electronmass`.
Different choices of natural units or physical measurements result in a variety of unit systems for many purposes.

Main documentation is at https://geophysics.crucialflow.com/dev/units

Another important additional definition is the `molarmass` constant `Mᵤ`, which is automatically selected based on the choice of `boltzmann` constant (but can also be customized if necessary).
Historically, older electromagnetic unit systems also relied on a `rationalization` constant `λ` and a `lorentz` force proportionality constant `αL`.
In most unit systems these extra constants have a value of `1` unless otherwise specified.

```Julia
UnitSystem{kB,ħ,𝘤,μ₀,mₑ}
UnitSystem{kB,ħ,𝘤,μ₀,mₑ,λ,αL}
```

Standardized for engineering based on fundamental constants: `kB` Boltzmann's constant, `ħ` reduced Planck's constant, `𝘤` speed of light, `μ₀` vacuum permeability, and `mₑ` electron rest mass.
Fundamental constants of physics are: `kB` Boltzmann's constant, `ħ` reduced Planck's constant, `𝘤` speed of light, `μ₀` vacuum permeability, `mₑ` electron rest mass, `λ` Gauss rationalization, and `αL` Lorentz's constant.
Primarily the `Metric` SI unit system is used in addition to the historic `English` engineering unit system.
These constants induce derived values for `avogadro`, `boltzmann`, `universal`, `planck`, `planckreduced`, `lightspeed`, `planckmass`, `atomicmass`, `protonmass`, `electronmass`, `newton`, `einstein`, `permeability`, `permittivity`, `coulomb`, and
additional constants `stefan`, `radiationintensity`, `impedance`, `charge`, `magneton`, `conductance`, `faraday`, `magneticflux`, `josephson`, `klitzing`, `hartree`, `rydberg`, `bohr`, `bohrreduced`, and `molarmass`.
additional constants `molarmass`, `hyperfine`, `luminousefficacy`, `stefan`, `radiationintensity`, `ampere`, `lorentz`, `biotsavart`, `rationalization`, `impedance`, `charge`, `magneton`, `conductance`, `faraday`, `magneticflux`, `josephson`, `klitzing`, `hartree`, `rydberg`, `bohr`, and `bohrreduced`.

Main documentation is at https://geophysics.crucialflow.com/dev/units
Physics constant documentation is at https://geophysics.crucialflow.com/dev/constants

Additional reference `UnitSystem` variants: `EMU`, `ESU`, `Gauss`, `LorentzHeaviside`, `MTS`, `SI2019`, `CODATA`, `Conventional`, `IAU`, `EnglishUS`; and natural atomic units based on gravitational coupling `αG` and the fine structure `1/αinv` constant (`Planck`, `PlanckGauss`, `Stoney`, `Hartree`, `Rydberg`, `Schrodinger`, `Electronic`, `Natural`, `NaturalGauss`, `QCD`, `QCDGauss`, and `QCDoriginal`).

Unt conversion documentation is at https://geophysics.crucialflow.com/dev/convert

Additional reference `UnitSystem` variants `CGS`, `CGS2019`, `SI2019`, `CODATA`, `Conventional`, `IAU`; along with several natural atomic units based on the fine structure constant `1/αinv` and the gravitational coupling constant `αG` (`Planck`, `PlanckGauss`, `Stoney`, `Hartree`, `Rydberg`, `Schrodinger`, `Electronic`, `Natural`, `NaturalGauss`, `QCD`, `QCDGauss`, and `QCDoriginal`).
**Unit conversions:**
Kinematic: `time`, `length`, `area`, `volume`, `wavenumber`, `fuelefficiency`, `frequency`, `frequencydrift`, `speed`, `acceleration`, `jerk`, `snap`, and `volumeflow`;
Mechanical: `mass`, `energy`, `power`, `force`, `pressure`, `momentum`, `angularmomentum`, `yank`, `areadensity`, `density`, `specificvolume`, `action`, `specificenergy`, `stiffness`, `irradiance`, `diffusivity`, `viscosity`, `lineardensity`, `massflow`, `radiantflux`, `powerdensity`, `compressibility`, `fluence`, and `rotationalinertia`;
Electromagnetic: `charge`, `current`, `voltage`, `capacitance`, `impedance`, `conductance`, `magneticflux`, `magneticinduction`, `inductance`, `electricinduction`, `chargedensity`, `currentdensity`, `conductivity`, `permittivity`, `permeability`, `electricfield`, `magneticfield`, `exposure`, `resistivity`, `linearchargedensity`, `magneticdipolemoment`, `mobility`, `reluctance`, `vectorpotential`, `magneticmoment`, `rigidity`, `susceptibility`, `electricflux`, and `electricdipolemoment`;
Thermodynamic: `temperature`, `entropy`, `specificentropy`, `thermalconductivity`, `thermalconductance`, `thermalresistance`, `thermalexpansion`, and `lapserate`;
Molar: `molarmass`, `molality`, `mole`, `molarity`, `molarvolume`, `molarentropy`, `molarenergy`, `molarconductivity`, `catalysis`, and `specificity`;
Photometric: `luminousflux`, `luminance`, `luminousenergy`, `luminousexposure`, and `luminousefficacy`.

Other similar packages include [PhysicalConstants.jl](https://github.com/JuliaPhysics/PhysicalConstants.jl), [MathPhysicalConstants.jl](https://github.com/LaGuer/MathPhysicalConstants.jl), [Unitful.jl](https://github.com/PainterQubits/Unitful.jl.git), [UnitfulUS](https://github.com/PainterQubits/UnitfulUS.jl), [UnitfulAstro](https://github.com/JuliaAstro/UnitfulAstro.jl), [UnitfulAtomic](https://github.com/sostock/UnitfulAtomic.jl), [NaturallyUnitful](https://github.com/MasonProtter/NaturallyUnitful.jl), and [UnitfulMoles](https://github.com/rafaqz/UnitfulMoles.jl).
Other similar packages include [PhysicalConstants.jl](https://github.com/JuliaPhysics/PhysicalConstants.jl), [MathPhysicalConstants.jl](https://github.com/LaGuer/MathPhysicalConstants.jl), [Unitful.jl](https://github.com/PainterQubits/Unitful.jl.git), [UnitfulSystems.jl](https://github.com/chakravala/UnitfulSystems.jl), [UnitfulUS.jl](https://github.com/PainterQubits/UnitfulUS.jl), [UnitfulAstro.jl](https://github.com/JuliaAstro/UnitfulAstro.jl), [UnitfulAtomic.jl](https://github.com/sostock/UnitfulAtomic.jl), [NaturallyUnitful.jl](https://github.com/MasonProtter/NaturallyUnitful.jl), and [UnitfulMoles.jl](https://github.com/rafaqz/UnitfulMoles.jl).
Loading

2 comments on commit 080a370

@chakravala
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/26261

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.2.0 -m "<description of version>" 080a370f7d904753975fead116b8e5b4e7f40b13
git push origin v0.2.0

Please sign in to comment.