Skip to content

Commit

Permalink
upgraded to UnitSystems v0.3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
chakravala committed May 27, 2022
1 parent 3bd29a0 commit e2b87e3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ Unit conversion documentation is at https://geophysics.crucialflow.com/dev/conve

**Derived Unit conversions:**

Mechanics: `angle`, `solidangle`, `time`, `length`, `area`, `volume`, `wavenumber`, `angularwavenumber`, `fuelefficiency`, `numberdensity`, `frequency`, `angularfrequency`, `frequencydrift`, `speed`, `acceleration`, `jerk`, `snap`, `crackle`, `pop`, `volumeflow`,
Mechanics: `angle`, `solidangle`, `time`, `angulartime`, `length`, `angularlength`, `area`, `angulararea`, `volume`, `wavenumber`, `angularwavenumber`, `fuelefficiency`, `numberdensity`, `frequency`, `angularfrequency`, `frequencydrift`, `stagnance`, `speed`, `acceleration`, `jerk`, `snap`, `crackle`, `pop`, `volumeflow`, `etendue`, `photonintensity`, `photonirradiance`, `photonradiance`,
`inertia`, `mass`, `massflow`, `lineardensity`, `areadensity`, `density`, `specificweight`, `specificvolume`, `force`, `specificforce`, `gravityforce`, `pressure`, `compressibility`, `viscosity`, `diffusivity`, `rotationalinertia`, `impulse`, `momentum`, `angularmomentum`, `yank`, `energy`, `specificenergy`, `action`, `fluence`, `power`, `powerdensity`, `irradiance`, `radiance`, `radiantintensity`, `spectralflux`, `spectralexposure`, `soundexposure`, `impedance`, `specificimpedance`, `admittance`, `compliance`, `inertance`;
Electromagnetics: `charge`, `chargedensity`, `linearchargedensity`, `exposure`, `mobility`, `current`, `currentdensity`, `resistance`, `conductance`, `resistivity`, `conductivity`, `capacitance`, `inductance`, `reluctance`, `permeance`, `permittivity`, `permeability`, `susceptibility`, `specificsusceptibility`, `demagnetizingfactor`, `vectorpotential`, `electricpotential`, `magneticpotential`, `electricfield`, `magneticfield`, `electricflux`, `magneticflux`, `electricfluxdensity`, `magneticfluxdensity`, `electricdipolemoment`, `magneticdipolemoment`, `electricpolarizability`, `magneticpolarizability`, `magneticmoment`, `specificmagnetization`, `polestrength`;
Electromagnetics: `charge`, `chargedensity`, `linearchargedensity`, `exposure`, `mobility`, `current`, `currentdensity`, `resistance`, `conductance`, `resistivity`, `conductivity`, `capacitance`, `inductance`, `reluctance`, `permeance`, `permittivity`, `permeability`, `susceptibility`, `specificsusceptibility`, `demagnetizingfactor`, `vectorpotential`, `electricpotential`, `magneticpotential`, `electricfield`, `magneticfield`, `electricflux`, `magneticflux`, `electricdisplacement`, `magneticfluxdensity`, `electricdipolemoment`, `magneticdipolemoment`, `electricpolarizability`, `magneticpolarizability`, `magneticmoment`, `specificmagnetization`, `polestrength`;
Thermodynamics: `temperature`, `entropy`, `specificentropy`, `volumeheatcapacity`, `thermalconductivity`, `thermalconductance`, `thermalresistivity`, `thermalresistance`, `thermalexpansion`, `lapserate`,
`molarmass`, `molality`, `mole`, `molarity`, `molarvolume`, `molarentropy`, `molarenergy`, `molarconductivity`, `molarsusceptibility`, `catalysis`, `specificity`,
`molarmass`, `molality`, `mole`, `molarity`, `molarvolume`, `molarentropy`, `molarenergy`, `molarconductivity`, `molarsusceptibility`, `catalysis`, `specificity`, `diffusionflux`,
`luminousflux`, `luminousintensity`, `luminance`, `illuminance`, `luminousenergy`, `luminousexposure`, `luminousefficacy`.

**Generalized dimensionless `Coupling`:**
Expand Down
22 changes: 13 additions & 9 deletions src/MeasureSystems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,16 @@ function cache(M::Measurement{Float64})
return Measure{N}()
end
Base.show(io::IO,M::Measure{N}) where N = show(io,measure(M))
Base.one(::Measure) = 𝟏
Base.zero(::Measure) = 𝟏-𝟏

# unit systems

const usingSimilitude = UnitSystems.similitude()
const usingSimilitude = true #UnitSystems.similitude()

if !usingSimilitude
import UnitSystems: two, three, five, eleven, nineteen, fourtythree
import UnitSystems: golden, eulergamma, tau
@pure mass(U::UnitSystem,S::UnitSystem) = electronmass(U,S)
@pure electronmass(𝘩,R∞) = αinv^2*R∞*2𝘩/𝘤
@pure electronmass(𝘩,R∞,C::Coupling) = inv(finestructure(C))^2*R∞*2𝘩/𝘤
Expand Down Expand Up @@ -71,26 +75,26 @@ for unit ∈ Convert
@eval @pure @inline $unit(U::UnitSystem) = $unit(Natural,U)
end
end
@pure turn(U::UnitSystem) = twopi(U)/angle(U)
@pure turn(U::UnitSystem) = tau(U)/angle(U)
@pure solidangle(U::UnitSystem,S::UnitSystem) = unit(angle(U,S)^2)
@pure spat(U::UnitSystem) = two(U)*turn(U)/angle(U)*unit(turn(U)/normal(turn(U)))
end
for unit (Systems...,Dimensionless...,Constants...,Physics...,Convert...,Derived...)
unit (:length,:time) && @eval export $unit
end

import UnitSystems: twopi, two, three, five, eleven, nineteen, fourtythree

# fundamental constants, αinv = (34259-1/4366.8123)/250 # 137.036 exactly?

if usingSimilitude
export Similitude, 𝟙
export Similitude, 𝟙, Unified
import Similitude
import Similitude: Group,AbelianGroup,LogGroup,ExpGroup,Quantity,Dimension,Quantities,𝟙
import Similitude: Unified, coefprod, promoteint
import Similitude: Group,AbelianGroup,LogGroup,ExpGroup,Quantity,Dimension,Quantities,𝟙,usq
import Similitude: Values,value,vals,basis,valueat,makeint,showgroup,ratio,isq,dims,dimtext
for D (:F,:M,:L,:T,:Q,,:N,:J,:A,:Λ,:C)
for D (:F,:M,:L,:T,:Q,,:N,:J,:A,:R,:C)
@eval const $D = Similitude.$D
end
Similitude.makeint(x::MeasureSystems.Measurements.Measurement) = x
@pure function constant(d::Group,C::Coupling=UnitSystems.Universe,dc=d.c); cs =
UnitSystems.kB^makeint(d.v[1])*
UnitSystems.NA^makeint(d.v[2])*
Expand Down Expand Up @@ -187,11 +191,11 @@ const ΩΛ = measurement("0.6889(56)")
const α = inv(αinv)
const RK,KJ = RK2014,KJ2014
import UnitSystems: g₀,ft,ftUS,lb,atm,ΔνCs,Kcd,NA,kB,𝘩,𝘤,𝘦,τ,inHg,T₀,aⱼ,Ωᵢₜ,Vᵢₜ,kG,au,seven
import UnitSystems: RK1990,KJ1990,𝟏,𝟐,𝟑,𝟓,𝟕,𝟏𝟎,𝟏𝟏,𝟏𝟗,𝟒𝟑,isquantity
import UnitSystems: RK1990,KJ1990,𝟏,𝟐,𝟑,𝟓,𝟕,𝟏𝟏,𝟏𝟗,𝟒𝟑,isquantity
const RK90,KJ90 = RK1990,KJ1990
end

const LD,JD = Constant(384399)*𝟏𝟎^3,Constant(778479)*𝟏𝟎^6
const LD,JD = Constant(384399)*(𝟐*𝟓)^3,Constant(778479)*(𝟐*𝟓)^6
const μE☾ = Constant(measurement("81.300568(3)"))

import UnitSystems: GaussSystem, ElectricSystem, EntropySystem, AstronomicalSystem, unitname, normal
Expand Down

2 comments on commit e2b87e3

@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/61195

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.1.5 -m "<description of version>" e2b87e3a3cc7a0b9c7fedebdbb0c70b7b881d904
git push origin v0.1.5

Please sign in to comment.