From 95ff39bac042707059df30e5f9c146d1e84dab81 Mon Sep 17 00:00:00 2001 From: Michael Zingale Date: Sat, 28 Sep 2024 12:04:55 -0400 Subject: [PATCH 1/6] add radiation constant and make it and Stefan-Boltzmann derived from fundamental units --- unyt/_physical_ratios.py | 11 +++++++++++ unyt/_unit_lookup_table.py | 5 ++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/unyt/_physical_ratios.py b/unyt/_physical_ratios.py index 339eae88..b6f0d529 100644 --- a/unyt/_physical_ratios.py +++ b/unyt/_physical_ratios.py @@ -132,6 +132,17 @@ btu_per_therm = 1e5 * J_per_BTU btu_per_quad = 1e15 * J_per_BTU rydberg_unit_mks = planck_mks * speed_of_light_m_per_s * rydberg_constant_mks +stefan_boltzmann_W_per_sqm_per_K4 = ( + 2.0 + * np.pi**5 + * boltzmann_constant_J_per_K**4 + / (15.0 * speed_of_light_m_per_s**2 * planck_mks**3) +) +radiation_constant_J_per_m3_per_K4 = ( + 4.0 + * stefan_boltzmann_W_per_sqm_per_K4 + / speed_of_light_m_per_s +) # Solar System masses # Standish, E.M. (1995) "Report of the IAU WGAS Sub-Group on Numerical diff --git a/unyt/_unit_lookup_table.py b/unyt/_unit_lookup_table.py index 6f7e6a58..46ca4c30 100644 --- a/unyt/_unit_lookup_table.py +++ b/unyt/_unit_lookup_table.py @@ -72,6 +72,8 @@ sec_per_year, speed_of_light_m_per_s, standard_gravity_m_per_s2, + stefan_boltzmann_W_per_sqm_per_K4, + radiation_constant_J_per_m3_per_K4, temp_sun_kelvin, uk_fl_oz_per_L, us_fl_oz_per_L, @@ -560,7 +562,8 @@ ), ("h", (planck_mks, "J*s", ["planck_constant"])), ("hbar", (0.5 * planck_mks / np.pi, "J*s", ["reduced_planck_constant"])), - ("σ", (5.670373e-8, "W/m**2/K**4", ["stefan_boltzmann_constant"])), + ("σ", (stefan_boltzmann_W_per_sqm_per_K4, "W/m**2/K**4", ["stefan_boltzmann_constant"])), + ("a", (radiation_constant_J_per_m3_per_K4, "J/m**3/K**4", ["radiation_constant"])), ("Tcmb", (2.726, "K", ["CMB_temperature"])), ( "Msun", From bd2fb57206b991dcbcfe48b0c9a82b0706999eeb Mon Sep 17 00:00:00 2001 From: Michael Zingale Date: Sat, 28 Sep 2024 12:19:18 -0400 Subject: [PATCH 2/6] fix CI --- unyt/equivalencies.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/unyt/equivalencies.py b/unyt/equivalencies.py index ffa24ef9..a8a1e9f3 100644 --- a/unyt/equivalencies.py +++ b/unyt/equivalencies.py @@ -473,9 +473,9 @@ class EffectiveTemperatureEquivalence(Equivalence): effective_temperature: flux <-> temperature >>> from unyt import K, W, m >>> (5000.*K).to_equivalent('W/m**2', 'effective_temperature') - unyt_quantity(35439831.25, 'W/m**2') + unyt_quantity(35439828.89119583, 'W/m**2') >>> (100.*W/m**2).to_equivalent('K', 'effective_temperature') - unyt_quantity(204.92601414, 'K') + unyt_quantity(204.92601755, 'K') """ type_name = "effective_temperature" From 7bfb3a29d1ce2808620d8e1a8d4420a459eedbac Mon Sep 17 00:00:00 2001 From: Michael Zingale Date: Sat, 28 Sep 2024 12:20:57 -0400 Subject: [PATCH 3/6] black --- unyt/_physical_ratios.py | 4 +--- unyt/_unit_lookup_table.py | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/unyt/_physical_ratios.py b/unyt/_physical_ratios.py index b6f0d529..4ceb61a4 100644 --- a/unyt/_physical_ratios.py +++ b/unyt/_physical_ratios.py @@ -139,9 +139,7 @@ / (15.0 * speed_of_light_m_per_s**2 * planck_mks**3) ) radiation_constant_J_per_m3_per_K4 = ( - 4.0 - * stefan_boltzmann_W_per_sqm_per_K4 - / speed_of_light_m_per_s + 4.0 * stefan_boltzmann_W_per_sqm_per_K4 / speed_of_light_m_per_s ) # Solar System masses diff --git a/unyt/_unit_lookup_table.py b/unyt/_unit_lookup_table.py index 46ca4c30..b64f5f73 100644 --- a/unyt/_unit_lookup_table.py +++ b/unyt/_unit_lookup_table.py @@ -562,8 +562,18 @@ ), ("h", (planck_mks, "J*s", ["planck_constant"])), ("hbar", (0.5 * planck_mks / np.pi, "J*s", ["reduced_planck_constant"])), - ("σ", (stefan_boltzmann_W_per_sqm_per_K4, "W/m**2/K**4", ["stefan_boltzmann_constant"])), - ("a", (radiation_constant_J_per_m3_per_K4, "J/m**3/K**4", ["radiation_constant"])), + ( + "σ", + ( + stefan_boltzmann_W_per_sqm_per_K4, + "W/m**2/K**4", + ["stefan_boltzmann_constant"], + ), + ), + ( + "a", + (radiation_constant_J_per_m3_per_K4, "J/m**3/K**4", ["radiation_constant"]), + ), ("Tcmb", (2.726, "K", ["CMB_temperature"])), ( "Msun", From 3c749b48e7ea2deec90a147affab28c27153965a Mon Sep 17 00:00:00 2001 From: Michael Zingale Date: Sat, 28 Sep 2024 12:23:31 -0400 Subject: [PATCH 4/6] ruff --- unyt/_unit_lookup_table.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unyt/_unit_lookup_table.py b/unyt/_unit_lookup_table.py index b64f5f73..6759a701 100644 --- a/unyt/_unit_lookup_table.py +++ b/unyt/_unit_lookup_table.py @@ -64,6 +64,7 @@ planck_mks, planck_temperature_K, planck_time_s, + radiation_constant_J_per_m3_per_K4, rydberg_constant_mks, rydberg_unit_mks, sec_per_day, @@ -73,7 +74,6 @@ speed_of_light_m_per_s, standard_gravity_m_per_s2, stefan_boltzmann_W_per_sqm_per_K4, - radiation_constant_J_per_m3_per_K4, temp_sun_kelvin, uk_fl_oz_per_L, us_fl_oz_per_L, From 748b00bcf20b96bc98643937a9e1fe7d80a098c9 Mon Sep 17 00:00:00 2001 From: Michael Zingale Date: Thu, 3 Oct 2024 09:37:04 -0400 Subject: [PATCH 5/6] update name --- unyt/_unit_lookup_table.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unyt/_unit_lookup_table.py b/unyt/_unit_lookup_table.py index 6d4504fb..e3268209 100644 --- a/unyt/_unit_lookup_table.py +++ b/unyt/_unit_lookup_table.py @@ -576,7 +576,7 @@ ), ( "a", - (radiation_constant_J_per_m3_per_K4, "J/m**3/K**4", ["radiation_constant"]), + (radiation_constant_J_per_m3_per_K4, "J/m**3/K**4", ["radiation_density_constant"]), ), ("Tcmb", (2.726, "K", ["CMB_temperature"])), ( From 1f48d52c240dd8c557a15147c1504069c228b112 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 4 Oct 2024 07:22:01 +0000 Subject: [PATCH 6/6] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- unyt/_unit_lookup_table.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/unyt/_unit_lookup_table.py b/unyt/_unit_lookup_table.py index e3268209..0b05c064 100644 --- a/unyt/_unit_lookup_table.py +++ b/unyt/_unit_lookup_table.py @@ -576,7 +576,11 @@ ), ( "a", - (radiation_constant_J_per_m3_per_K4, "J/m**3/K**4", ["radiation_density_constant"]), + ( + radiation_constant_J_per_m3_per_K4, + "J/m**3/K**4", + ["radiation_density_constant"], + ), ), ("Tcmb", (2.726, "K", ["CMB_temperature"])), (