Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CODATA 2018 values of physics constants #268

Merged
merged 1 commit into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions examples/codata2018_consistency.nbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# https://physics.nist.gov/cgi-bin/cuu/Category?view=html&Frequently+used+constants.x=55&Frequently+used+constants.y=9

assert_eq(m_u, 1.660_539_066_60e-27 kg)
assert_eq(N_A, 6.022_140_76e23 mol^-1)
assert_eq(k_B, 1.380_649e-23 J/K)
assert_eq(conductance_quantum, 7.748_091_729e-5 S, 1e-14 S)
assert_eq(electron_mass, 9.109_383_7015e-31 kg)
assert_eq(1 eV, 1.602_176_634e-19 J)
assert_eq(electron_charge, 1.602_176_634e-19 C)
assert_eq(faraday_constant, 96_485.332_12 C mol^-1, 1e-5 C mol^-1)
assert_eq(α, 7.297_352_5693e-3, 1e-13)
assert_eq(josephson_constant, 483_597.848_4e9 Hz V^-1, 1e5 Hz V^-1)
assert_eq(magnetic_flux_quantum, 2.067_833_848e-15 Wb, 1e-24 Wb)
assert_eq(gas_constant, 8.314_462_618 J mol^-1 K^-1, 1e-9 J mol^-1 K^-1)
assert_eq(G, 6.674_30e-11 m^3 kg^-1 s^-2)
assert_eq(planck_constant, 6.626_070_15e-34 J Hz^-1)
assert_eq(proton_mass, 1.672_621_923_69e-27 kg)
assert_eq(stefan_boltzmann_constant, 5.670_374_419e-8 W m^-2 K^-4, 1e-17 W m^-2 K^-4)
assert_eq(eps0, 8.854_187_8128e-12 F m^-1, 1e-24 F m^-1)
assert_eq(mu0, 1.256_637_062_12e-6 N A^-2)
assert_eq(von_klitzing_constant, 25_812.807_45 Ω, 1e-5 Ω)
58 changes: 42 additions & 16 deletions numbat/modules/physics/constants.nbt
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ let speed_of_light: Velocity = 299_792_458 m / s
@name("Newtonian constant of gravitation")
@url("https://en.wikipedia.org/wiki/Gravitational_constant")
@aliases(G)
let gravitational_constant: Force × Length^2 / Mass^2 = 6.67430e-11 m³ / (kg s²)
let gravitational_constant: Force × Length^2 / Mass^2 = 6.674_30e-11 m³ / (kg s²)

@name("Standard acceleration of gravity on earth")
@url("https://en.wikipedia.org/wiki/Gravity_of_Earth")
@aliases(g0)
let gravity: Acceleration = 9.80665 m / s²
let gravity: Acceleration = 9.806_65 m / s²

@name("Planck constant")
@url("https://en.wikipedia.org/wiki/Planck_constant")
@aliases(ℎ)
let planck_constant: Action = 6.62607015e-34 J / Hz
let planck_constant: Action = 6.626_070_15e-34 J / Hz

@name("Reduced Planck constant")
@url("https://en.wikipedia.org/wiki/Planck_constant#Reduced_Planck_constant_%E2%84%8F")
Expand All @@ -28,59 +28,59 @@ let ℏ: AngularMomentum = planck_constant / 2π

@name("Electron mass")
@url("https://en.wikipedia.org/wiki/Electron_mass")
let electron_mass: Mass = 9.1093837015e-31 kg
let electron_mass: Mass = 9.109_383_701_5e-31 kg

@name("Elementary charge")
@url("https://en.wikipedia.org/wiki/Elementary_charge")
@aliases(electron_charge)
let elementary_charge: ElectricCharge = 1.602176634e-19 C
let elementary_charge: ElectricCharge = 1.602_176_634e-19 C

@name("Vacuum permeability / magnetic constant")
@url("https://en.wikipedia.org/wiki/Vacuum_permeability")
@aliases(µ0,mu0)
let magnetic_constant: MagneticPermeability = 1.25663706212e-6 N / A²
let magnetic_constant: MagneticPermeability = 1.256_637_062_12e-6 N / A²

@name("Vacuum electric permittivity / electric constant")
@url("https://en.wikiversity.org/wiki/Electric_constant")
@url("https://en.wikipedia.org/wiki/Vacuum_permittivity")
@aliases(ε0,eps0)
let electric_constant: ElectricPermittivity = 8.8541878128e-12 F / m
let electric_constant: ElectricPermittivity = 1 / (µ0 c²) -> F/m

@name("Bohr magneton")
@aliases(µ_B)
@url("https://en.wikipedia.org/wiki/Bohr_magneton")
let bohr_magneton: Energy / MagneticFluxDensity = 9.2740100783e-24 J / T
let bohr_magneton: Energy / MagneticFluxDensity = electron_charge ℏ / 2 electron_mass -> J/T

@name("Fine structure constant")
@url("https://en.wikipedia.org/wiki/Fine-structure_constant")
@aliases(α, alpha)
let fine_structure_constant: Scalar = 7.2973525693e-3
let fine_structure_constant: Scalar = electron_charge^2 / (2 eps0 ℎ c)

@name("Proton mass")
@url("https://en.wikipedia.org/wiki/Proton")
let proton_mass: Mass = 1.67262192369e-27 kg
let proton_mass: Mass = 1.672_621_923_69e-27 kg

@name("Neutron mass")
@url("https://en.wikipedia.org/wiki/Neutron")
let neutron_mass: Mass = 1.67492749804e-27 kg
let neutron_mass: Mass = 1.674_927_498_04e-27 kg

@name("Avogadro constant")
@url("https://en.wikipedia.org/wiki/Avogadro_constant")
@aliases(N_A)
let avogadro_constant: 1 / AmountOfSubstance = 6.02214076e23 / mol
let avogadro_constant: 1 / AmountOfSubstance = 6.022_140_76e23 / mol

@name("Boltzmann constant")
@url("https://en.wikipedia.org/wiki/Boltzmann_constant")
@aliases(k_B)
let boltzmann_constant: Energy / Temperature = 1.380649e-23 J / K
let boltzmann_constant: Energy / Temperature = 1.380_649e-23 J / K

@name("Stefan-Boltzmann constant")
@url("https://en.wikipedia.org/wiki/Stefan%E2%80%93Boltzmann_law")
let stefan_boltzmann_constant: Power / (Area × Temperature^4) = 2 π^5 k_B^4 / (15 planck_constant^3 c^2)

@name("Ideal gas constant")
@name("Molar gas constant")
@url("https://en.wikipedia.org/wiki/Gas_constant")
@aliases(R)
let gas_constant: Energy / (AmountOfSubstance × Temperature) = 8.31446261815324 J / (K mol)
let gas_constant: Energy / (AmountOfSubstance × Temperature) = k_B × N_A

@name("Bohr radius")
@url("https://en.wikipedia.org/wiki/Bohr_radius")
Expand All @@ -94,3 +94,29 @@ let rydberg_constant: Wavenumber = (electron_mass electron_charge^4) / (8 ε0^2
@name("Rydberg unit of energy")
@url("https://en.wikipedia.org/wiki/Rydberg_constant")
unit Ry: Energy = ℎ c × rydberg_constant

@name("Atomic Mass constant")
@url("https://en.wikipedia.org/wiki/Atomic_mass_constant")
@aliases(m_u)
let atomic_mass_constant: Mass = 1 dalton -> kg

@name("Conductance quantum")
@url("https://en.wikipedia.org/wiki/Conductance_quantum")
let conductance_quantum: ElectricConductance = 2 * elementary_charge^2 / planck_constant -> S

@name("Faraday constant")
@url("https://en.wikipedia.org/wiki/Faraday_constant")
let faraday_constant: ElectricCharge / AmountOfSubstance = avogadro_constant * elementary_charge

@name("Magnetic Flux Quantum")
@url("https://en.wikipedia.org/wiki/Magnetic_flux_quantum")
let magnetic_flux_quantum: MagneticFlux = planck_constant / (2 * elementary_charge) -> Wb

@name("Josephson Constant")
@url("https://en.wikipedia.org/wiki/Josephson_constant")
let josephson_constant: Frequency / Voltage = 1 / magnetic_flux_quantum -> Hz/V

@name("Von Klitzing Constant")
@url("https://en.wikipedia.org/wiki/Von_Klitzing_constant")
@aliases(R_K)
let von_klitzing_constant: ElectricResistance = planck_constant / (elementary_charge^2) -> Ω
6 changes: 3 additions & 3 deletions numbat/modules/units/si.nbt
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,10 @@ unit tonne: Mass = 10^3 kilogram
@name("Dalton")
@url("https://en.wikipedia.org/wiki/Dalton")
@aliases(daltons, Da: short)
unit dalton: Mass = 1.660539040e-27 kilogram
unit dalton: Mass = 1.660_539_066_60e-27 kilogram

@name("Electronvolt")
@name("Electron volt")
@url("https://en.wikipedia.org/wiki/Electronvolt")
@metric_prefixes
@aliases(electronvolts, eV: short)
unit electronvolt: Energy = 1.602176634e-19 joule
unit electronvolt: Energy = 1.602_176_634e-19 joule