diff --git a/docs/source/usage/workflows/ionization.rst b/docs/source/usage/workflows/ionization.rst index a354021560..cf609a0197 100644 --- a/docs/source/usage/workflows/ionization.rst +++ b/docs/source/usage/workflows/ionization.rst @@ -69,13 +69,13 @@ To include charge-state-only simulations in your simulations you must: float_X, 7, // number charge states Nitrogen, // name you may reference this by later, remember to prepend the namespace and append _t! - 14.53413 * UNITCONV_eV_to_AU, - 29.60125 * UNITCONV_eV_to_AU, - 47.4453 * UNITCONV_eV_to_AU, - 77.4735 * UNITCONV_eV_to_AU, - 97.89013 * UNITCONV_eV_to_AU, - 552.06731 * UNITCONV_eV_to_AU, - 667.04609 * UNITCONV_eV_to_AU); + sim.si.conv().eV2auEnergy(14.53413), + sim.si.conv().eV2auEnergy(29.60125), + sim.si.conv().eV2auEnergy(47.4453), + sim.si.conv().eV2auEnergy(77.4735), + sim.si.conv().eV2auEnergy(97.89013), + sim.si.conv().eV2auEnergy(552.06731), + sim.si.conv().eV2auEnergy(667.04609)); }; // namespace picongpu::ionization::energies::AU .. note:: diff --git a/include/picongpu/defines.hpp b/include/picongpu/defines.hpp index d16cfec7b1..8cd449d9f8 100644 --- a/include/picongpu/defines.hpp +++ b/include/picongpu/defines.hpp @@ -40,5 +40,4 @@ namespace picongpu #include "picongpu/param/speciesConstants.param" #include "picongpu/param/simulation.param" #include "picongpu/unitless/simulation.unitless" -#include "picongpu/unitless/physicalConstants.unitless" // clang-format on diff --git a/include/picongpu/param/ionizationEnergies.param b/include/picongpu/param/ionizationEnergies.param index 15bf40a5de..4f0fb04229 100644 --- a/include/picongpu/param/ionizationEnergies.param +++ b/include/picongpu/param/ionizationEnergies.param @@ -39,7 +39,7 @@ namespace picongpu * Please follow these rules for defining ionization energies of atomic species, * unless your chosen ionization model requires a different unit system than `AU::` * - input of values in either atomic units or converting eV or Joule to them - * -> use either UNITCONV_eV_to_AU or SI::ATOMIC_UNIT_ENERGY for that purpose + * -> use either sim.si.conv().eV2auEnergy() or sim.si.conv().joule2auEnergy() for that purpose * - use `float_X` as the preferred data type * * example: @@ -72,211 +72,216 @@ namespace picongpu namespace AU { /* ionization energy for ground state hydrogen in atomic units */ - PMACC_CONST_VECTOR(float_X, 1, Hydrogen, 13.59843 * UNITCONV_eV_to_AU); + PMACC_CONST_VECTOR(float_X, 1, Hydrogen, sim.si.conv().eV2auEnergy(13.59843)); /* ionization energy for ground state deuterium in atomic units */ - PMACC_CONST_VECTOR(float_X, 1, Deuterium, 13.60213 * UNITCONV_eV_to_AU); + PMACC_CONST_VECTOR(float_X, 1, Deuterium, sim.si.conv().eV2auEnergy(13.60213)); /* ionization energy for ground state helium in atomic units */ - PMACC_CONST_VECTOR(float_X, 2, Helium, 24.58739 * UNITCONV_eV_to_AU, 54.41776 * UNITCONV_eV_to_AU); + PMACC_CONST_VECTOR( + float_X, + 2, + Helium, + sim.si.conv().eV2auEnergy(24.58739), + sim.si.conv().eV2auEnergy(54.41776)); /* ionization energy for carbon in atomic units */ PMACC_CONST_VECTOR( float_X, 6, Carbon, - 11.2603 * UNITCONV_eV_to_AU, - 24.3845 * UNITCONV_eV_to_AU, - 47.88778 * UNITCONV_eV_to_AU, - 64.49351 * UNITCONV_eV_to_AU, - 392.0905 * UNITCONV_eV_to_AU, - 489.993177 * UNITCONV_eV_to_AU); + sim.si.conv().eV2auEnergy(11.2603), + sim.si.conv().eV2auEnergy(24.3845), + sim.si.conv().eV2auEnergy(47.88778), + sim.si.conv().eV2auEnergy(64.49351), + sim.si.conv().eV2auEnergy(392.0905), + sim.si.conv().eV2auEnergy(489.993177)); /* ionization energy for nitrogen in atomic units */ PMACC_CONST_VECTOR( float_X, 7, Nitrogen, - 14.53413 * UNITCONV_eV_to_AU, - 29.60125 * UNITCONV_eV_to_AU, - 47.4453 * UNITCONV_eV_to_AU, - 77.4735 * UNITCONV_eV_to_AU, - 97.89013 * UNITCONV_eV_to_AU, - 552.06731 * UNITCONV_eV_to_AU, - 667.04609 * UNITCONV_eV_to_AU); + sim.si.conv().eV2auEnergy(14.53413), + sim.si.conv().eV2auEnergy(29.60125), + sim.si.conv().eV2auEnergy(47.4453), + sim.si.conv().eV2auEnergy(77.4735), + sim.si.conv().eV2auEnergy(97.89013), + sim.si.conv().eV2auEnergy(552.06731), + sim.si.conv().eV2auEnergy(667.04609)); /* ionization energy for oxygen in atomic units */ PMACC_CONST_VECTOR( float_X, 8, Oxygen, - 13.61805 * UNITCONV_eV_to_AU, - 35.12112 * UNITCONV_eV_to_AU, - 54.93554 * UNITCONV_eV_to_AU, - 77.41350 * UNITCONV_eV_to_AU, - 113.8989 * UNITCONV_eV_to_AU, - 138.1189 * UNITCONV_eV_to_AU, - 739.3268 * UNITCONV_eV_to_AU, - 871.4098 * UNITCONV_eV_to_AU); + sim.si.conv().eV2auEnergy(13.61805), + sim.si.conv().eV2auEnergy(35.12112), + sim.si.conv().eV2auEnergy(54.93554), + sim.si.conv().eV2auEnergy(77.41350), + sim.si.conv().eV2auEnergy(113.8989), + sim.si.conv().eV2auEnergy(138.1189), + sim.si.conv().eV2auEnergy(739.3268), + sim.si.conv().eV2auEnergy(871.4098)); /* ionization energy for aluminium in atomic units */ PMACC_CONST_VECTOR( float_X, 13, Aluminium, - 5.98577 * UNITCONV_eV_to_AU, - 18.8285 * UNITCONV_eV_to_AU, - 28.4476 * UNITCONV_eV_to_AU, - 119.992 * UNITCONV_eV_to_AU, - 153.825 * UNITCONV_eV_to_AU, - 190.495 * UNITCONV_eV_to_AU, - 241.769 * UNITCONV_eV_to_AU, - 284.647 * UNITCONV_eV_to_AU, - 330.214 * UNITCONV_eV_to_AU, - 398.656 * UNITCONV_eV_to_AU, - 442.006 * UNITCONV_eV_to_AU, - 2085.97 * UNITCONV_eV_to_AU, - 2304.14 * UNITCONV_eV_to_AU); + sim.si.conv().eV2auEnergy(5.98577), + sim.si.conv().eV2auEnergy(18.8285), + sim.si.conv().eV2auEnergy(28.4476), + sim.si.conv().eV2auEnergy(119.992), + sim.si.conv().eV2auEnergy(153.825), + sim.si.conv().eV2auEnergy(190.495), + sim.si.conv().eV2auEnergy(241.769), + sim.si.conv().eV2auEnergy(284.647), + sim.si.conv().eV2auEnergy(330.214), + sim.si.conv().eV2auEnergy(398.656), + sim.si.conv().eV2auEnergy(442.006), + sim.si.conv().eV2auEnergy(2085.97), + sim.si.conv().eV2auEnergy(2304.14)); /* ionization energy for silicon in atomic units */ PMACC_CONST_VECTOR( float_X, 14, Silicon, - 8.151683 * UNITCONV_eV_to_AU, - 16.345845 * UNITCONV_eV_to_AU, - 33.493 * UNITCONV_eV_to_AU, - 45.14179 * UNITCONV_eV_to_AU, - 166.767 * UNITCONV_eV_to_AU, - 205.267 * UNITCONV_eV_to_AU, - 246.32 * UNITCONV_eV_to_AU, - 303.66 * UNITCONV_eV_to_AU, - 351.1 * UNITCONV_eV_to_AU, - 401.38 * UNITCONV_eV_to_AU, - 476.18 * UNITCONV_eV_to_AU, - 523.415 * UNITCONV_eV_to_AU, - 2437.65804 * UNITCONV_eV_to_AU, - 2673.1774 * UNITCONV_eV_to_AU); + sim.si.conv().eV2auEnergy(8.151683), + sim.si.conv().eV2auEnergy(16.345845), + sim.si.conv().eV2auEnergy(33.493), + sim.si.conv().eV2auEnergy(45.14179), + sim.si.conv().eV2auEnergy(166.767), + sim.si.conv().eV2auEnergy(205.267), + sim.si.conv().eV2auEnergy(246.32), + sim.si.conv().eV2auEnergy(303.66), + sim.si.conv().eV2auEnergy(351.1), + sim.si.conv().eV2auEnergy(401.38), + sim.si.conv().eV2auEnergy(476.18), + sim.si.conv().eV2auEnergy(523.415), + sim.si.conv().eV2auEnergy(2437.65804), + sim.si.conv().eV2auEnergy(2673.1774)); /* ionization energy for copper in atomic units */ PMACC_CONST_VECTOR( float_X, 29, Copper, - 7.72638 * UNITCONV_eV_to_AU, - 20.2924 * UNITCONV_eV_to_AU, - 36.8411 * UNITCONV_eV_to_AU, - 57.385 * UNITCONV_eV_to_AU, - 79.87 * UNITCONV_eV_to_AU, - 103.010 * UNITCONV_eV_to_AU, - 139.012 * UNITCONV_eV_to_AU, - 166.021 * UNITCONV_eV_to_AU, - 198.022 * UNITCONV_eV_to_AU, - 232.25 * UNITCONV_eV_to_AU, - 265.332 * UNITCONV_eV_to_AU, - 367.09 * UNITCONV_eV_to_AU, - 401.03 * UNITCONV_eV_to_AU, - 436.06 * UNITCONV_eV_to_AU, - 483.19 * UNITCONV_eV_to_AU, - 518.712 * UNITCONV_eV_to_AU, - 552.821 * UNITCONV_eV_to_AU, - 632.56 * UNITCONV_eV_to_AU, - 670.608 * UNITCONV_eV_to_AU, - 1690.59 * UNITCONV_eV_to_AU, - 1800.3 * UNITCONV_eV_to_AU, - 1918.4 * UNITCONV_eV_to_AU, - 2044.6 * UNITCONV_eV_to_AU, - 2179.4 * UNITCONV_eV_to_AU, - 2307.32 * UNITCONV_eV_to_AU, - 2479.12 * UNITCONV_eV_to_AU, - 2586.95 * UNITCONV_eV_to_AU, - 11062.4 * UNITCONV_eV_to_AU, - 11567.6 * UNITCONV_eV_to_AU); + sim.si.conv().eV2auEnergy(7.72638), + sim.si.conv().eV2auEnergy(20.2924), + sim.si.conv().eV2auEnergy(36.8411), + sim.si.conv().eV2auEnergy(57.385), + sim.si.conv().eV2auEnergy(79.87), + sim.si.conv().eV2auEnergy(103.010), + sim.si.conv().eV2auEnergy(139.012), + sim.si.conv().eV2auEnergy(166.021), + sim.si.conv().eV2auEnergy(198.022), + sim.si.conv().eV2auEnergy(232.25), + sim.si.conv().eV2auEnergy(265.332), + sim.si.conv().eV2auEnergy(367.09), + sim.si.conv().eV2auEnergy(401.03), + sim.si.conv().eV2auEnergy(436.06), + sim.si.conv().eV2auEnergy(483.19), + sim.si.conv().eV2auEnergy(518.712), + sim.si.conv().eV2auEnergy(552.821), + sim.si.conv().eV2auEnergy(632.56), + sim.si.conv().eV2auEnergy(670.608), + sim.si.conv().eV2auEnergy(1690.59), + sim.si.conv().eV2auEnergy(1800.3), + sim.si.conv().eV2auEnergy(1918.4), + sim.si.conv().eV2auEnergy(2044.6), + sim.si.conv().eV2auEnergy(2179.4), + sim.si.conv().eV2auEnergy(2307.32), + sim.si.conv().eV2auEnergy(2479.12), + sim.si.conv().eV2auEnergy(2586.95), + sim.si.conv().eV2auEnergy(11062.4), + sim.si.conv().eV2auEnergy(11567.6)); /* ionization energy for gold in atomic units */ PMACC_CONST_VECTOR( float_X, 79, Gold, - 9.2256 * UNITCONV_eV_to_AU, - 20.203 * UNITCONV_eV_to_AU, - 30.016 * UNITCONV_eV_to_AU, - 45.017 * UNITCONV_eV_to_AU, - 60.019 * UNITCONV_eV_to_AU, - 74.020 * UNITCONV_eV_to_AU, - 94.020 * UNITCONV_eV_to_AU, - 112.02 * UNITCONV_eV_to_AU, - 130.12 * UNITCONV_eV_to_AU, - 149.02 * UNITCONV_eV_to_AU, - 168.21 * UNITCONV_eV_to_AU, - 248.01 * UNITCONV_eV_to_AU, - 275.14 * UNITCONV_eV_to_AU, - 299.15 * UNITCONV_eV_to_AU, - 324.16 * UNITCONV_eV_to_AU, - 365.19 * UNITCONV_eV_to_AU, - 392.20 * UNITCONV_eV_to_AU, - 433.21 * UNITCONV_eV_to_AU, - 487.25 * UNITCONV_eV_to_AU, - 517.30 * UNITCONV_eV_to_AU, - 546.30 * UNITCONV_eV_to_AU, - 600.30 * UNITCONV_eV_to_AU, - 650.40 * UNITCONV_eV_to_AU, - 710.40 * UNITCONV_eV_to_AU, - 760.40 * UNITCONV_eV_to_AU, - 820.40 * UNITCONV_eV_to_AU, - 870.40 * UNITCONV_eV_to_AU, - 930.50 * UNITCONV_eV_to_AU, - 990.50 * UNITCONV_eV_to_AU, - 1040.5 * UNITCONV_eV_to_AU, - 1100.5 * UNITCONV_eV_to_AU, - 1150.6 * UNITCONV_eV_to_AU, - 1210.6 * UNITCONV_eV_to_AU, - 1475.5 * UNITCONV_eV_to_AU, - 1527.5 * UNITCONV_eV_to_AU, - 1584.5 * UNITCONV_eV_to_AU, - 1644.5 * UNITCONV_eV_to_AU, - 1702.4 * UNITCONV_eV_to_AU, - 1758.4 * UNITCONV_eV_to_AU, - 1845.4 * UNITCONV_eV_to_AU, - 1904.4 * UNITCONV_eV_to_AU, - 1967.4 * UNITCONV_eV_to_AU, - 2026.4 * UNITCONV_eV_to_AU, - 2261.4 * UNITCONV_eV_to_AU, - 2320.4 * UNITCONV_eV_to_AU, - 2383.4 * UNITCONV_eV_to_AU, - 2443.4 * UNITCONV_eV_to_AU, - 2640.4 * UNITCONV_eV_to_AU, - 2708.4 * UNITCONV_eV_to_AU, - 2870.4 * UNITCONV_eV_to_AU, - 2941.0 * UNITCONV_eV_to_AU, - 4888.4 * UNITCONV_eV_to_AU, - 5013.4 * UNITCONV_eV_to_AU, - 5156.5 * UNITCONV_eV_to_AU, - 5307.5 * UNITCONV_eV_to_AU, - 5452.5 * UNITCONV_eV_to_AU, - 5594.5 * UNITCONV_eV_to_AU, - 5846.6 * UNITCONV_eV_to_AU, - 5994.6 * UNITCONV_eV_to_AU, - 6156.7 * UNITCONV_eV_to_AU, - 6305.1 * UNITCONV_eV_to_AU, - 6724.1 * UNITCONV_eV_to_AU, - 6854.1 * UNITCONV_eV_to_AU, - 6997.2 * UNITCONV_eV_to_AU, - 7130.2 * UNITCONV_eV_to_AU, - 7756.3 * UNITCONV_eV_to_AU, - 7910.4 * UNITCONV_eV_to_AU, - 8210.4 * UNITCONV_eV_to_AU, - 8360.5 * UNITCONV_eV_to_AU, - 18040. * UNITCONV_eV_to_AU, - 18401. * UNITCONV_eV_to_AU, - 18791. * UNITCONV_eV_to_AU, - 19151. * UNITCONV_eV_to_AU, - 21471. * UNITCONV_eV_to_AU, - 21921. * UNITCONV_eV_to_AU, - 22500. * UNITCONV_eV_to_AU, - 22868. * UNITCONV_eV_to_AU, - 91516. * UNITCONV_eV_to_AU, - 93254. * UNITCONV_eV_to_AU); + sim.si.conv().eV2auEnergy(9.2256), + sim.si.conv().eV2auEnergy(20.203), + sim.si.conv().eV2auEnergy(30.016), + sim.si.conv().eV2auEnergy(45.017), + sim.si.conv().eV2auEnergy(60.019), + sim.si.conv().eV2auEnergy(74.020), + sim.si.conv().eV2auEnergy(94.020), + sim.si.conv().eV2auEnergy(112.02), + sim.si.conv().eV2auEnergy(130.12), + sim.si.conv().eV2auEnergy(149.02), + sim.si.conv().eV2auEnergy(168.21), + sim.si.conv().eV2auEnergy(248.01), + sim.si.conv().eV2auEnergy(275.14), + sim.si.conv().eV2auEnergy(299.15), + sim.si.conv().eV2auEnergy(324.16), + sim.si.conv().eV2auEnergy(365.19), + sim.si.conv().eV2auEnergy(392.20), + sim.si.conv().eV2auEnergy(433.21), + sim.si.conv().eV2auEnergy(487.25), + sim.si.conv().eV2auEnergy(517.30), + sim.si.conv().eV2auEnergy(546.30), + sim.si.conv().eV2auEnergy(600.30), + sim.si.conv().eV2auEnergy(650.40), + sim.si.conv().eV2auEnergy(710.40), + sim.si.conv().eV2auEnergy(760.40), + sim.si.conv().eV2auEnergy(820.40), + sim.si.conv().eV2auEnergy(870.40), + sim.si.conv().eV2auEnergy(930.50), + sim.si.conv().eV2auEnergy(990.50), + sim.si.conv().eV2auEnergy(1040.5), + sim.si.conv().eV2auEnergy(1100.5), + sim.si.conv().eV2auEnergy(1150.6), + sim.si.conv().eV2auEnergy(1210.6), + sim.si.conv().eV2auEnergy(1475.5), + sim.si.conv().eV2auEnergy(1527.5), + sim.si.conv().eV2auEnergy(1584.5), + sim.si.conv().eV2auEnergy(1644.5), + sim.si.conv().eV2auEnergy(1702.4), + sim.si.conv().eV2auEnergy(1758.4), + sim.si.conv().eV2auEnergy(1845.4), + sim.si.conv().eV2auEnergy(1904.4), + sim.si.conv().eV2auEnergy(1967.4), + sim.si.conv().eV2auEnergy(2026.4), + sim.si.conv().eV2auEnergy(2261.4), + sim.si.conv().eV2auEnergy(2320.4), + sim.si.conv().eV2auEnergy(2383.4), + sim.si.conv().eV2auEnergy(2443.4), + sim.si.conv().eV2auEnergy(2640.4), + sim.si.conv().eV2auEnergy(2708.4), + sim.si.conv().eV2auEnergy(2870.4), + sim.si.conv().eV2auEnergy(2941.0), + sim.si.conv().eV2auEnergy(4888.4), + sim.si.conv().eV2auEnergy(5013.4), + sim.si.conv().eV2auEnergy(5156.5), + sim.si.conv().eV2auEnergy(5307.5), + sim.si.conv().eV2auEnergy(5452.5), + sim.si.conv().eV2auEnergy(5594.5), + sim.si.conv().eV2auEnergy(5846.6), + sim.si.conv().eV2auEnergy(5994.6), + sim.si.conv().eV2auEnergy(6156.7), + sim.si.conv().eV2auEnergy(6305.1), + sim.si.conv().eV2auEnergy(6724.1), + sim.si.conv().eV2auEnergy(6854.1), + sim.si.conv().eV2auEnergy(6997.2), + sim.si.conv().eV2auEnergy(7130.2), + sim.si.conv().eV2auEnergy(7756.3), + sim.si.conv().eV2auEnergy(7910.4), + sim.si.conv().eV2auEnergy(8210.4), + sim.si.conv().eV2auEnergy(8360.5), + sim.si.conv().eV2auEnergy(18040.), + sim.si.conv().eV2auEnergy(18401.), + sim.si.conv().eV2auEnergy(18791.), + sim.si.conv().eV2auEnergy(19151.), + sim.si.conv().eV2auEnergy(21471.), + sim.si.conv().eV2auEnergy(21921.), + sim.si.conv().eV2auEnergy(22500.), + sim.si.conv().eV2auEnergy(22868.), + sim.si.conv().eV2auEnergy(91516.), + sim.si.conv().eV2auEnergy(93254.)); } // namespace AU } // namespace energies diff --git a/include/picongpu/param/ionizer.param b/include/picongpu/param/ionizer.param index cc0c46fa0d..71c21b150a 100644 --- a/include/picongpu/param/ionizer.param +++ b/include/picongpu/param/ionizer.param @@ -493,7 +493,7 @@ namespace picongpu */ constexpr float_X CUTOFF_MAX_ENERGY_KEV = 50.0; /** cutoff energy for electron "temperature" calculation in SI units*/ - constexpr float_X CUTOFF_MAX_ENERGY = CUTOFF_MAX_ENERGY_KEV * sim.si.conv.ev2Joule(1.0e3); + constexpr float_X CUTOFF_MAX_ENERGY = sim.si.conv().eV2Joule(CUTOFF_MAX_ENERGY_KEV * 1.0e3); /** lower ion density cutoff * diff --git a/include/picongpu/param/physicalConstants.param b/include/picongpu/param/physicalConstants.param index 2224caa369..60508097b7 100644 --- a/include/picongpu/param/physicalConstants.param +++ b/include/picongpu/param/physicalConstants.param @@ -46,26 +46,5 @@ namespace picongpu constexpr float_64 ELECTRON_MASS_SI = 9.1093837139e-31; //! unit: C, 2022 CODATA value, https://physics.nist.gov/cgi-bin/cuu/Value?e constexpr float_64 ELECTRON_CHARGE_SI = -1.602176634e-19; - - /* atomic unit for energy: - * 2 Rydberg = 27.21 eV --> converted to Joule - */ - constexpr float_64 ATOMIC_UNIT_ENERGY = 4.36e-18; - - /* atomic unit for electric field in V/m: - * field strength between electron and core in ground state hydrogen - */ - constexpr float_64 ATOMIC_UNIT_EFIELD = 5.14e11; - - /* atomic unit for time in s: - * 150 attoseconds (classical electron orbit time in hydrogen) / 2 PI - */ - constexpr float_64 ATOMIC_UNIT_TIME = 2.4189e-17; - } // namespace SI - - /* 1 atomic unit of energy is equal to 1 Hartree or 2 Rydberg - * which is twice the ground state binding energy of atomic hydrogen */ - constexpr float_64 UNITCONV_AU_to_eV = 27.21139; - constexpr float_64 UNITCONV_eV_to_AU = (1.0 / UNITCONV_AU_to_eV); } // namespace picongpu diff --git a/include/picongpu/particles/atomicPhysics/GetPhysicalEnergy.hpp b/include/picongpu/particles/atomicPhysics/GetPhysicalEnergy.hpp index c5c11635ac..f48ce8a020 100644 --- a/include/picongpu/particles/atomicPhysics/GetPhysicalEnergy.hpp +++ b/include/picongpu/particles/atomicPhysics/GetPhysicalEnergy.hpp @@ -67,9 +67,8 @@ namespace picongpu::particles::atomicPhysics //} // unit conversion factor for eV - constexpr float_X eV = static_cast( - picongpu::sim.unit.mass() * picongpu::sim.si.getSpeedOfLight() * picongpu::sim.si.getSpeedOfLight() - * sim.si.conv.joule2ev(1.0)); + constexpr float_X eV = static_cast(sim.si.conv().joule2eV( + picongpu::sim.unit.mass() * picongpu::sim.si.getSpeedOfLight() * picongpu::sim.si.getSpeedOfLight())); // eV return energy * eV; diff --git a/include/picongpu/particles/atomicPhysics/initElectrons/Inelastic2BodyCollisionFromCoMoving.hpp b/include/picongpu/particles/atomicPhysics/initElectrons/Inelastic2BodyCollisionFromCoMoving.hpp index c7203e3ea3..2890f8e684 100644 --- a/include/picongpu/particles/atomicPhysics/initElectrons/Inelastic2BodyCollisionFromCoMoving.hpp +++ b/include/picongpu/particles/atomicPhysics/initElectrons/Inelastic2BodyCollisionFromCoMoving.hpp @@ -198,8 +198,8 @@ namespace picongpu::particles::atomicPhysics::initElectrons // sim.unit.mass()/sim.unit.mass() = unitless float_64 const mE_mI = static_cast(massElectron / massIon); // kg * m^2/s^2 * keV/J * 1e3 = J/J * eV = eV - float_64 const mc2_Ion = static_cast(massIon) * sim.unit.mass() - * pmacc::math::cPow(picongpu::sim.si.getSpeedOfLight(), 2u) * sim.si.conv.joule2ev(1.0); + float_64 const mc2_Ion = static_cast(massIon) + * sim.si.conv().joule2eV(sim.unit.mass() * pmacc::math::cPow(picongpu::sim.si.getSpeedOfLight(), 2u)); // eV / eV + sim.unit.mass() / sim.unit.mass() = unitless float_64 const A_E = deltaEnergy / mc2_Ion + mE_mI; @@ -247,8 +247,8 @@ namespace picongpu::particles::atomicPhysics::initElectrons // sim.unit.mass()/sim.unit.mass() = unitless float_64 const mI_mE = static_cast(massIon / massElectron); // kg * m^2/s^2 * keV/J * 1e3 = J/J * eV = eV - float_64 const mc2_Electron = static_cast(massElectron) * sim.unit.mass() - * pmacc::math::cPow(picongpu::sim.si.getSpeedOfLight(), 2u) * sim.si.conv.joule2ev(1.0); + float_64 const mc2_Electron = static_cast(massElectron) + * sim.si.conv().joule2eV(sim.unit.mass() * pmacc::math::cPow(picongpu::sim.si.getSpeedOfLight(), 2u)); float_64 const A_I = deltaEnergy / mc2_Electron + mI_mE; float_64 const gammaStarIon_IonSystem = (A_I * (A_I + 2.) + (mI_mE * mI_mE)) / ((A_I + 1.) * 2. * mI_mE); diff --git a/include/picongpu/particles/atomicPhysics/ionizationPotentialDepression/StewartPyattIPD.hpp b/include/picongpu/particles/atomicPhysics/ionizationPotentialDepression/StewartPyattIPD.hpp index 4bd8b68ec8..4ae385d7a5 100644 --- a/include/picongpu/particles/atomicPhysics/ionizationPotentialDepression/StewartPyattIPD.hpp +++ b/include/picongpu/particles/atomicPhysics/ionizationPotentialDepression/StewartPyattIPD.hpp @@ -209,9 +209,7 @@ namespace picongpu::particles::atomicPhysics::ionizationPotentialDepression T_LocalZStarBox const localZStarBox) { // eV/(sim.unit.mass() * sim.unit.length()^2 / sim.unit.time()^2) - constexpr float_X eV = static_cast( - picongpu::sim.unit.mass() * pmacc::math::cPow(picongpu::sim.unit.length(), 2u) - / pmacc::math::cPow(picongpu::sim.unit.time(), 2u) * sim.si.conv.joule2ev(1.0)); + constexpr float_X eV = sim.pic.get_eV(); // eV/(sim.unit.mass() * sim.unit.length()^2 / sim.unit.time()^2) * unitless * sim.unit.charge()^2 // / ( unitless * sim.unit.charge()^2 * sim.unit.time()^2 / (sim.unit.length()^3 * sim.unit.mass())) diff --git a/include/picongpu/particles/atomicPhysics/ionizationPotentialDepression/kernel/CalculateIPDInput.kernel b/include/picongpu/particles/atomicPhysics/ionizationPotentialDepression/kernel/CalculateIPDInput.kernel index 010fde6e26..48820cba38 100644 --- a/include/picongpu/particles/atomicPhysics/ionizationPotentialDepression/kernel/CalculateIPDInput.kernel +++ b/include/picongpu/particles/atomicPhysics/ionizationPotentialDepression/kernel/CalculateIPDInput.kernel @@ -150,9 +150,8 @@ namespace picongpu::particles::atomicPhysics::ionizationPotentialDepression::ker localZStar = localSumChargeNumberSquared / localSumChargeNumber; // eV/(sim.unit.mass() * sim.unit.length()^2 / sim.unit.time()^2) - constexpr float_X eV = static_cast( - picongpu::sim.unit.mass() * pmacc::math::cPow(picongpu::sim.unit.length(), 2u) - / pmacc::math::cPow(picongpu::sim.unit.time(), 2u) * sim.si.conv.joule2ev(1.0)); + constexpr float_X eV + = static_cast(picongpu::sim.si.conv().joule2eV(picongpu::sim.unit.energy())); // eV/(sim.unit.mass() * sim.unit.length()^2 / sim.unit.time()^2) * sim.unit.mass() * // sim.unit.length()^2 / sim.unit.time()^2 diff --git a/include/picongpu/particles/atomicPhysics/kernel/DecelerateElectrons.kernel b/include/picongpu/particles/atomicPhysics/kernel/DecelerateElectrons.kernel index dea2dd1a3c..1b5658079c 100644 --- a/include/picongpu/particles/atomicPhysics/kernel/DecelerateElectrons.kernel +++ b/include/picongpu/particles/atomicPhysics/kernel/DecelerateElectrons.kernel @@ -114,8 +114,8 @@ namespace picongpu::particles::atomicPhysics::kernel // = Nm/J * eV = J/J * eV = eV, ~ 511e3 eV float_X const mcSquaredElectron = static_cast( static_cast(picongpu::traits::frame::getMass()) - * sim.unit.mass() * pmacc::math::cPow(picongpu::sim.si.getSpeedOfLight(), 2u) - * sim.si.conv.joule2ev(1.0)); + * sim.si.conv().joule2eV( + sim.unit.mass() * pmacc::math::cPow(picongpu::sim.si.getSpeedOfLight(), 2u))); // eV, not weighted // distribute energy change as mean by weight on all electrons in bin @@ -133,8 +133,7 @@ namespace picongpu::particles::atomicPhysics::kernel picongpu::sim.si.getSpeedOfLight() * sim.unit.time() / sim.unit.length()); // usually ~1, internal units - constexpr float_X conversionEnergy - = static_cast(sim.si.conv.ev2Joule(1.0) / sim.unit.energy()); + constexpr float_X conversionEnergy = static_cast(picongpu::sim.pic.get_eV()); // J/(eV) * sim.unit.energy()/J = J/J * sim.unit.energy()/(eV) constexpr float_X scalingFactor = 1._X / c_internal * conversionEnergy; @@ -142,7 +141,7 @@ namespace picongpu::particles::atomicPhysics::kernel // sqrt(E' * (E' + 2* m*c^2)) / c float_X const newElectronMomentum = math::sqrt(newEnergyElectron * (newEnergyElectron + 2 * mcSquaredElectron)) * scalingFactor; - // AU = ATOMIC_UNIT_ENERGY + // AU = sim.atomicUnit.energy() // sqrt(eV * (eV + eV))/(sim.unit.length()/sim.unit.time()) * (sim.unit.energy()/eV) // = sqrt((eV)^2)/(eV) * sim.unit.time()/sim.unit.length() * sim.unit.energy() // = sim.unit.mass() * sim.unit.length()^2/sim.unit.time()^2 * sim.unit.time()/sim.unit.length() diff --git a/include/picongpu/particles/atomicPhysics/rateCalculation/BoundBoundTransitionRates.hpp b/include/picongpu/particles/atomicPhysics/rateCalculation/BoundBoundTransitionRates.hpp index 857887c420..9a6a841f31 100644 --- a/include/picongpu/particles/atomicPhysics/rateCalculation/BoundBoundTransitionRates.hpp +++ b/include/picongpu/particles/atomicPhysics/rateCalculation/BoundBoundTransitionRates.hpp @@ -249,8 +249,8 @@ namespace picongpu::particles::atomicPhysics::rateCalculation 8. * pmacc::math::cPow(picongpu::PI * sim.si.getBohrRadius(), u8(2u)) / (1.e-22)); // [1e6b], ~ 2211,01 * 1e6b // 1e6b - constexpr float_X constantPart - = scalingConstant * static_cast(pmacc::math::cPow(sim.si.getRydbergEnergy(), u8(2u))); + constexpr float_X constantPart = scalingConstant + * static_cast(pmacc::math::cPow(sim.si.conv().joule2eV(sim.si.getRydbergEnergy()), u8(2u))); // [1e6b * (eV)^2] // 1e6b*(eV)^2 / (eV)^2 * unitless * (eV)/(eV) * unitless = 1e6b @@ -390,7 +390,7 @@ namespace picongpu::particles::atomicPhysics::rateCalculation // J/(eV) / (Js) * s/sim.unit.time() = J/J * s/s * 1/(eV * sim.unit.time()) constexpr float_X scalingConstantPhotonFrequency - = static_cast(sim.si.conv.ev2Joule(1.0) / (2 * pi * hbar_SI) * picongpu::sim.unit.time()); + = static_cast(picongpu::sim.si.get_eV() / (2 * pi * hbar_SI) * picongpu::sim.unit.time()); /// @attention actual SI frequency, NOT angular frequency // 1/sim.unit.time() diff --git a/include/picongpu/particles/atomicPhysics/rateCalculation/BoundFreeCollisionalTransitionRates.hpp b/include/picongpu/particles/atomicPhysics/rateCalculation/BoundFreeCollisionalTransitionRates.hpp index 5a18dd7826..b3d173b2aa 100644 --- a/include/picongpu/particles/atomicPhysics/rateCalculation/BoundFreeCollisionalTransitionRates.hpp +++ b/include/picongpu/particles/atomicPhysics/rateCalculation/BoundFreeCollisionalTransitionRates.hpp @@ -157,7 +157,7 @@ namespace picongpu::particles::atomicPhysics::rateCalculation { constexpr float_64 C = 2.3; // a fitting factor well suited for Z >= 2, unitless constexpr float_64 a0 = sim.si.getBohrRadius(); // m - constexpr float_64 E_R = sim.si.getRydbergEnergy(); // eV + constexpr float_64 E_R = sim.si.conv().joule2eV(sim.si.getRydbergEnergy()); // eV constexpr float_64 scalingConstant = C * picongpu::PI * pmacc::math::cPow(a0, 2u) / 1e-22 * pmacc::math::cPow(E_R, 2u); // 10^6*b * eV^2 diff --git a/include/picongpu/particles/atomicPhysics/rateCalculation/BoundFreeFieldTransitionRates.hpp b/include/picongpu/particles/atomicPhysics/rateCalculation/BoundFreeFieldTransitionRates.hpp index d291e8fa3f..de9d577f24 100644 --- a/include/picongpu/particles/atomicPhysics/rateCalculation/BoundFreeFieldTransitionRates.hpp +++ b/include/picongpu/particles/atomicPhysics/rateCalculation/BoundFreeFieldTransitionRates.hpp @@ -92,8 +92,8 @@ namespace picongpu::particles::atomicPhysics::rateCalculation chargeStateDataBox); // unitless float_X const effectivePrincipalQuantumNumber - = screenedCharge / math::sqrt(2._X * ionizationEnergy * picongpu::UNITCONV_eV_to_AU); - float_X const eFieldNorm_AU = eFieldNorm / ATOMIC_UNIT_EFIELD; + = screenedCharge / math::sqrt(2._X * sim.si.conv().eV2auEnergy(ionizationEnergy)); + float_X const eFieldNorm_AU = sim.pic.conv().eField2auEField(eFieldNorm); float_X const screenedChargeCubed = pmacc::math::cPow(screenedCharge, 3u); float_X const dBase = 4.0_X * math::exp(1._X) * screenedChargeCubed / (eFieldNorm_AU * pmacc::math::cPow(effectivePrincipalQuantumNumber, 4u)); @@ -103,7 +103,7 @@ namespace picongpu::particles::atomicPhysics::rateCalculation constexpr float_X pi = pmacc::math::Pi::value; float_X const nEffCubed = pmacc::math::cPow(effectivePrincipalQuantumNumber, 3u); - // 1/ATOMIC_UNIT_TIME + // 1/sim.atomicUnit.time() float_X rateADK_AU = eFieldNorm_AU * pmacc::math::cPow(dFromADK, 2u) / (8._X * pi * screenedCharge) * math::exp(-2._X * screenedChargeCubed / (3._X * nEffCubed * eFieldNorm_AU)); @@ -112,7 +112,7 @@ namespace picongpu::particles::atomicPhysics::rateCalculation u32(T_ADKLaserPolarization) == u32(atomicPhysics::enums::ADKLaserPolarization::linearPolarization)) rateADK_AU *= math::sqrt(3._X * nEffCubed * eFieldNorm_AU / (pi * screenedChargeCubed)); - return rateADK_AU / ATOMIC_UNIT_TIME; + return rateADK_AU / sim.atomicUnit.time(); } }; } // namespace picongpu::particles::atomicPhysics::rateCalculation diff --git a/include/picongpu/particles/atomicPhysics/rateCalculation/CollisionalRate.hpp b/include/picongpu/particles/atomicPhysics/rateCalculation/CollisionalRate.hpp index f2fe5edcd5..8cbc03026d 100644 --- a/include/picongpu/particles/atomicPhysics/rateCalculation/CollisionalRate.hpp +++ b/include/picongpu/particles/atomicPhysics/rateCalculation/CollisionalRate.hpp @@ -46,7 +46,7 @@ namespace picongpu::particles2::atomicPhysics::rateCalculation constexpr float_64 c_SI = picongpu::sim.si.getSpeedOfLight(); // [m/s] constexpr float_64 m_e_SI = picongpu::sim.si.getElectronMass(); // [kg] - constexpr float_64 electronRestMassEnergy = m_e_SI * c_SI * c_SI / sim.si.conv.ev2Joule(1.0); + constexpr float_64 electronRestMassEnergy = m_e_SI * c_SI * c_SI / picongpu::sim.si.get_eV(); // kg * (m^2)/(s^2) * 1/(J/eV) = Nm * eV/J = J/J * eV // [eV] ~ 5.11e5 diff --git a/include/picongpu/particles/boundary/Thermal.hpp b/include/picongpu/particles/boundary/Thermal.hpp index 63142abb95..07de19d3f9 100644 --- a/include/picongpu/particles/boundary/Thermal.hpp +++ b/include/picongpu/particles/boundary/Thermal.hpp @@ -71,7 +71,7 @@ namespace picongpu static constexpr char const* name = "reflectThermalIfOutside"; HINLINE ReflectThermalIfOutside() - : energy((m_parameters.temperature * sim.si.conv.ev2Joule(1.0e3)) / sim.unit.energy()) + : energy((m_parameters.temperature * sim.si.conv().eV2Joule(1.0e3)) / sim.unit.energy()) { } diff --git a/include/picongpu/particles/debyeLength/Estimate.kernel b/include/picongpu/particles/debyeLength/Estimate.kernel index 7a7f100b1f..de0fc9eb46 100644 --- a/include/picongpu/particles/debyeLength/Estimate.kernel +++ b/include/picongpu/particles/debyeLength/Estimate.kernel @@ -213,7 +213,7 @@ namespace picongpu using Frame = typename T_ElectronBox::FrameType; auto const mass = static_cast(picongpu::traits::frame::getMass()); auto const kT = (momentumVariance[0] + momentumVariance[1] + momentumVariance[2]) / (3.0 * mass); - auto const temperatureKeV = kT * sim.unit.energy() / sim.si.conv.ev2Joule(1.0e3); + auto const temperatureKeV = kT * sim.unit.energy() / sim.si.conv().eV2Joule(1.0e3); auto const electronCharge = picongpu::traits::frame::getCharge(); auto const debyeLength = sqrt(sim.pic.getEps0() * kT / (electronDensity * electronCharge * electronCharge)); diff --git a/include/picongpu/particles/ionization/byCollision/ThomasFermi/AlgorithmThomasFermi.hpp b/include/picongpu/particles/ionization/byCollision/ThomasFermi/AlgorithmThomasFermi.hpp index cbb1f95100..53be9ea308 100644 --- a/include/picongpu/particles/ionization/byCollision/ThomasFermi/AlgorithmThomasFermi.hpp +++ b/include/picongpu/particles/ionization/byCollision/ThomasFermi/AlgorithmThomasFermi.hpp @@ -161,7 +161,7 @@ namespace picongpu /** convert kinetic energy in J to "temperature" in eV by assuming an ideal electron gas * E_kin = 3/2 k*T */ - constexpr float_64 convKinEnergyToTemperature = sim.si.conv.joule2ev(1.0) * float_64(2. / 3.); + constexpr float_64 convKinEnergyToTemperature = sim.si.conv().joule2eV(1.0) * float_64(2. / 3.); /** electron "temperature" in electron volts */ float_64 const temperature = avgKinEnergy * convKinEnergyToTemperature; diff --git a/include/picongpu/particles/ionization/byField/ADK/AlgorithmADK.hpp b/include/picongpu/particles/ionization/byField/ADK/AlgorithmADK.hpp index a0f1ca36c7..55120c57a0 100644 --- a/include/picongpu/particles/ionization/byField/ADK/AlgorithmADK.hpp +++ b/include/picongpu/particles/ionization/byField/ADK/AlgorithmADK.hpp @@ -84,7 +84,7 @@ namespace picongpu constexpr float_X pi = pmacc::math::Pi::value; /* electric field in atomic units - only absolute value */ - float_X const eInAU = pmacc::math::l2norm(eField) / ATOMIC_UNIT_EFIELD; + float_X const eInAU = sim.pic.conv().eField2auEField(pmacc::math::l2norm(eField)); /* the charge that attracts the electron that is to be ionized: * equals `protonNumber - #allInnerElectrons` @@ -113,7 +113,7 @@ namespace picongpu } /* simulation time step in atomic units */ - auto const timeStepAU = float_X(sim.pic.getDt() / ATOMIC_UNIT_TIME); + auto const timeStepAU = sim.pic.conv().time2auTime(sim.pic.getDt()); /* ionization probability * * probability = rate * time step diff --git a/include/picongpu/particles/ionization/byField/BSI/AlgorithmBSI.hpp b/include/picongpu/particles/ionization/byField/BSI/AlgorithmBSI.hpp index 750121da03..e7bd2fcf6b 100644 --- a/include/picongpu/particles/ionization/byField/BSI/AlgorithmBSI.hpp +++ b/include/picongpu/particles/ionization/byField/BSI/AlgorithmBSI.hpp @@ -77,7 +77,7 @@ namespace picongpu /* critical field strength in atomic units */ float_X const critField = iEnergy * iEnergy / (float_X(4.0) * effectiveCharge); /* ionization condition */ - if(pmacc::math::l2norm(eField) / ATOMIC_UNIT_EFIELD >= critField) + if(sim.pic.conv().eField2auEField(pmacc::math::l2norm(eField)) >= critField) { /* return ionization energy and number of macro electrons to produce */ return IonizerReturn{iEnergy, 1u}; diff --git a/include/picongpu/particles/ionization/byField/BSI/AlgorithmBSIEffectiveZ.hpp b/include/picongpu/particles/ionization/byField/BSI/AlgorithmBSIEffectiveZ.hpp index eb5c330fa2..e51cb2c1be 100644 --- a/include/picongpu/particles/ionization/byField/BSI/AlgorithmBSIEffectiveZ.hpp +++ b/include/picongpu/particles/ionization/byField/BSI/AlgorithmBSIEffectiveZ.hpp @@ -76,7 +76,7 @@ namespace picongpu float_X critField = iEnergy * iEnergy / (float_X(4.0) * ZEff); /* ionization condition */ - if(pmacc::math::l2norm(eField) / ATOMIC_UNIT_EFIELD >= critField) + if(sim.pic.conv().eField2auEField(pmacc::math::l2norm(eField)) >= critField) { /* return ionization energy and number of macro electrons to produce */ return IonizerReturn{iEnergy, 1u}; diff --git a/include/picongpu/particles/ionization/byField/BSI/AlgorithmBSIStarkShifted.hpp b/include/picongpu/particles/ionization/byField/BSI/AlgorithmBSIStarkShifted.hpp index 46602ed5ca..afab5dcea9 100644 --- a/include/picongpu/particles/ionization/byField/BSI/AlgorithmBSIStarkShifted.hpp +++ b/include/picongpu/particles/ionization/byField/BSI/AlgorithmBSIStarkShifted.hpp @@ -75,7 +75,7 @@ namespace picongpu = (math::sqrt(float_X(2.)) - float_X(1.)) * math::pow(iEnergy, float_X(3. / 2.)); /* ionization condition */ - if(pmacc::math::l2norm(eField) / ATOMIC_UNIT_EFIELD >= critField) + if(sim.pic.conv().eField2auEField(pmacc::math::l2norm(eField)) >= critField) { /* return ionization energy number of electrons to produce */ return IonizerReturn{iEnergy, 1u}; diff --git a/include/picongpu/particles/ionization/byField/IonizationCurrent/IonizationCurrent.hpp b/include/picongpu/particles/ionization/byField/IonizationCurrent/IonizationCurrent.hpp index c90b7e3790..215a2d3f64 100644 --- a/include/picongpu/particles/ionization/byField/IonizationCurrent/IonizationCurrent.hpp +++ b/include/picongpu/particles/ionization/byField/IonizationCurrent/IonizationCurrent.hpp @@ -61,8 +61,7 @@ namespace picongpu * ionization current. */ if(retValue.ionizationEnergy != 0.0_X) { - auto ionizationEnergy = weighting * retValue.ionizationEnergy * SI::ATOMIC_UNIT_ENERGY - / sim.unit.energy(); // convert to PIConGPU units + auto ionizationEnergy = sim.pic.conv().auEnergy2Joule(weighting * retValue.ionizationEnergy); /* calculate ionization current at particle position */ float3_X jIonizationPar = JIonizationCalc{}(ionizationEnergy, eField); /* assign ionization current to grid points */ diff --git a/include/picongpu/particles/ionization/byField/Keldysh/AlgorithmKeldysh.hpp b/include/picongpu/particles/ionization/byField/Keldysh/AlgorithmKeldysh.hpp index ef626001e3..fbb8515e4d 100644 --- a/include/picongpu/particles/ionization/byField/Keldysh/AlgorithmKeldysh.hpp +++ b/include/picongpu/particles/ionization/byField/Keldysh/AlgorithmKeldysh.hpp @@ -76,7 +76,7 @@ namespace picongpu constexpr float_X pi = pmacc::math::Pi::value; /* electric field in atomic units - only absolute value */ - float_X eInAU = pmacc::math::l2norm(eField) / ATOMIC_UNIT_EFIELD; + float_X eInAU = sim.pic.conv().eField2auEField(pmacc::math::l2norm(eField)); /* factor two avoid calculation math::pow(2,5./4.); */ const float_X twoToFiveQuarters = 2.3784142300054; @@ -89,7 +89,7 @@ namespace picongpu * math::sqrt(float_X(1.) / charExpArg) * math::exp(-float_X(2. / 3.) * charExpArg); /* simulation time step in atomic units */ - const auto timeStepAU = float_X(sim.pic.getDt() / ATOMIC_UNIT_TIME); + const auto timeStepAU = sim.pic.conv().time2auTime(sim.pic.getDt()); /* ionization probability * * probability = rate * time step diff --git a/include/picongpu/particles/manipulators/unary/Temperature.hpp b/include/picongpu/particles/manipulators/unary/Temperature.hpp index e4b5c05c9d..dbb52f14fa 100644 --- a/include/picongpu/particles/manipulators/unary/Temperature.hpp +++ b/include/picongpu/particles/manipulators/unary/Temperature.hpp @@ -70,8 +70,7 @@ namespace picongpu * For the macroweighted momentums we store as particle[ momentum_ ], * the same relation holds, just m and E are also macroweighted */ - float_X const energy - = (temperatureKeV * sim.si.conv.ev2Joule(1.0e3)) / sim.unit.energy(); + float_X const energy = sim.pic.conv().eV2Joule(temperatureKeV * 1.0e3); float_X const macroWeighting = particle[weighting_]; float_X const macroEnergy = macroWeighting * energy; float_X const macroMass = attribute::getMass(macroWeighting, particle); diff --git a/include/picongpu/plugins/BinEnergyParticles.x.cpp b/include/picongpu/plugins/BinEnergyParticles.x.cpp index e28b6315e0..5a82cc0041 100644 --- a/include/picongpu/plugins/BinEnergyParticles.x.cpp +++ b/include/picongpu/plugins/BinEnergyParticles.x.cpp @@ -427,8 +427,8 @@ namespace picongpu auto idProvider = dc.get("globalId"); /* convert energy values from keV to PIConGPU units */ - float_X const minEnergy = minEnergy_keV * sim.si.conv.ev2Joule(1.0e3) / sim.unit.energy(); - float_X const maxEnergy = maxEnergy_keV * sim.si.conv.ev2Joule(1.0e3) / sim.unit.energy(); + float_X const minEnergy = sim.pic.conv().eV2Joule(minEnergy_keV * 1.0e3); + float_X const maxEnergy = sim.pic.conv().eV2Joule(maxEnergy_keV * 1.0e3); auto const mapper = makeAreaMapper(*m_cellDescription); diff --git a/include/picongpu/plugins/particleCalorimeter/ParticleCalorimeter.x.cpp b/include/picongpu/plugins/particleCalorimeter/ParticleCalorimeter.x.cpp index 4ae8d0bee9..b407c30bd4 100644 --- a/include/picongpu/plugins/particleCalorimeter/ParticleCalorimeter.x.cpp +++ b/include/picongpu/plugins/particleCalorimeter/ParticleCalorimeter.x.cpp @@ -119,8 +119,9 @@ namespace picongpu { const float_64 minEnergy_SI = this->minEnergy * sim.unit.energy(); const float_64 maxEnergy_SI = this->maxEnergy * sim.unit.energy(); - const float_64 minEnergy_keV = minEnergy_SI * sim.si.conv.joule2ev(1.0e-3); - const float_64 maxEnergy_keV = maxEnergy_SI * sim.si.conv.joule2ev(1.0e-3); + // convert to keV + const float_64 minEnergy_keV = 1.0e-3 * sim.si.conv().joule2eV(minEnergy_SI); + const float_64 maxEnergy_keV = 1.0e-3 * sim.si.conv().joule2eV(maxEnergy_SI); dataset.setAttribute("minEnergy[keV]", minEnergy_keV); dataset.setAttribute("maxEnergy[keV]", maxEnergy_keV); @@ -300,9 +301,10 @@ namespace picongpu this->maxYaw_deg = float_X(0.5) * this->openingYaw_deg; this->maxPitch_deg = float_X(0.5) * this->openingPitch_deg; - /* convert units */ - const float_64 minEnergy_SI = this->minEnergy * sim.si.conv.ev2Joule(1.0e3); - const float_64 maxEnergy_SI = this->maxEnergy * sim.si.conv.ev2Joule(1.0e3); + /* convert keV to joule */ + const float_64 minEnergy_SI = sim.si.conv().eV2Joule(this->minEnergy * 1.0e3); + const float_64 maxEnergy_SI = sim.si.conv().eV2Joule(this->maxEnergy * 1.0e3); + /* convert into PIConGPU units */ this->minEnergy = minEnergy_SI / sim.unit.energy(); this->maxEnergy = maxEnergy_SI / sim.unit.energy(); @@ -671,6 +673,8 @@ namespace picongpu uint32_t numBinsYaw; uint32_t numBinsPitch; uint32_t numBinsEnergy; + /** @attention: This variable is used very dirty. IN the beginning the value is stored in SI units and later + * it is overwritten with the coresponding value in PIConGPU units. */ float_X minEnergy; float_X maxEnergy; bool logScale; diff --git a/include/picongpu/unitless/simulation.unitless b/include/picongpu/unitless/simulation.unitless index 6314f31e6f..e939250327 100644 --- a/include/picongpu/unitless/simulation.unitless +++ b/include/picongpu/unitless/simulation.unitless @@ -21,6 +21,8 @@ #pragma once +#include "picongpu/param/precision.param" + #include #include @@ -116,6 +118,12 @@ namespace picongpu return static_cast(si.getRydbergEnergy() / unit.energy()); } + template + constexpr T_Type get_eV() const + { + return static_cast(si.get_eV() / unit.energy()); + } + template constexpr T_Type getBohrRadius() const { @@ -127,6 +135,50 @@ namespace picongpu { return static_cast(si.getClassicalElectronRadius() / unit.length()); } + + struct Convert + { + /** convert int the pic unit system + * + * @{ + */ + template + constexpr T_Type eV2Joule(T_Type eV = 1.0) const + { + return eV * static_cast(pic.get_eV()); + } + + template + constexpr T_Type auEnergy2Joule(T_Type auEnergy = 1.0) const + { + return static_cast(si.conv().auEnergy2Joule(auEnergy) / unit.energy()); + } + + template + constexpr T_Type auTime2Time(T_Type auTime = 1.0) const + { + return static_cast(si.conv().auTime2Time(auTime) / unit.time()); + } + /** @} */ + + template + constexpr T_Type eField2auEField(T_Type eField = 1.0) const + { + return static_cast(si.conv().eField2auEField(eField * unit.eField())); + } + + template + constexpr T_Type time2auTime(T_Type time = 1.0) const + { + return static_cast(si.conv().time2auTime(time * unit.time())); + } + }; + + /** get conversion functions */ + static constexpr Convert conv() + { + return Convert{}; + } }; struct SiUnits { @@ -245,7 +297,13 @@ namespace picongpu constexpr float_64 getRydbergEnergy() const { // convert from unit eV to Joule - return conv.ev2Joule(13.605693122990); + return conv().eV2Joule(13.605693122990); + } + + //! get 1eV in J + constexpr float_64 get_eV() const + { + return 1.602176634e-19; } /** bohr radius, unit: m @@ -279,22 +337,94 @@ namespace picongpu struct Convert { /** convert from eV into joule */ - constexpr float_64 ev2Joule(float_64 eV = 1.0) const + constexpr float_64 eV2Joule(float_64 eV = 1.0) const { - return eV * 1.602176634e-19; + return eV * si.get_eV(); } /** convert from joule into eV */ - constexpr float_64 joule2ev(float_64 joule = 1.0) const + constexpr float_64 joule2eV(float_64 joule = 1.0) const + { + return joule / si.get_eV(); + } + + constexpr float_64 auEnergy2Joule(float_64 auEnergy = 1.0) const + { + return auEnergy * atomicUnit.energy(); + } + + constexpr float_64 joule2auEnergy(float_64 joule = 1.0) const + { + return joule / atomicUnit.energy(); + } + + constexpr float_64 auEnergy2eV(float_64 auEnergy = 1.0) const + { + return joule2eV(auEnergy2Joule(auEnergy)); + } + + constexpr float_64 eV2auEnergy(float_64 ev = 1.0) const + { + return ev / auEnergy2eV(1.0); + } + + constexpr float_64 auEField2EField(float_64 auEField = 1.0) const + { + return auEField * atomicUnit.eField(); + } + + constexpr float_64 eField2auEField(float_64 eField = 1.0) const + { + return eField / atomicUnit.eField(); + } + + constexpr float_64 auTime2Time(float_64 auTime = 1.0) const { - return joule / ev2Joule(1.0); + return auTime * atomicUnit.time(); + } + + constexpr float_64 time2auTime(float_64 time = 1.0) const + { + return time / atomicUnit.time(); } }; - static constexpr Convert conv{}; + /** get conversion functions */ + static constexpr Convert conv() + { + return Convert{}; + } + }; + + /** units of the atomic in SI unit system */ + struct AtomicUnits + { + /* atomic unit for energy: + * 2 Rydberg = 27.21 eV --> converted to Joule + */ + constexpr float_64 energy() const + { + return 2.0 * si.getRydbergEnergy(); + } + + /* atomic unit for electric field in V/m: + * field strength between electron and core in ground state hydrogen + */ + constexpr float_64 eField() const + { + return 5.14e11; + } + + /* atomic unit for time in s: + * 150 attoseconds (classical electron orbit time in hydrogen) / 2 PI + */ + constexpr float_64 time() const + { + return 2.4189e-17; + } }; - /** units to convert from SI into PIConGPU's SI unit system */ + /** units of the PIConGPU's in SI unit system */ struct Units { constexpr float_64 length() const @@ -364,6 +494,7 @@ namespace picongpu static constexpr PicUnits pic{}; static constexpr SiUnits si{}; static constexpr Units unit{}; + static constexpr AtomicUnits atomicUnit{}; }; constexpr auto sim = Sim{}; diff --git a/share/picongpu/tests/CollisionsBeamRelaxation/include/picongpu/param/particle.param b/share/picongpu/tests/CollisionsBeamRelaxation/include/picongpu/param/particle.param index 86e9183948..8d006ff603 100644 --- a/share/picongpu/tests/CollisionsBeamRelaxation/include/picongpu/param/particle.param +++ b/share/picongpu/tests/CollisionsBeamRelaxation/include/picongpu/param/particle.param @@ -81,8 +81,10 @@ namespace picongpu /** Initial temperature * unit: keV */ - static constexpr float_64 temperature = sim.si.getElectronMass() * sim.si.getSpeedOfLight() - * sim.si.getSpeedOfLight() * sim.si.conv.joule2ev(1.0e-3) * 0.0000002; + static constexpr float_64 temperature + = sim.si.conv().joule2eV( + sim.si.getElectronMass() * sim.si.getSpeedOfLight() * sim.si.getSpeedOfLight()) + * 0.0002; }; /** Definition of manipulator assigning a temperature * using parameters from struct TemperatureParamElectrons. @@ -95,8 +97,10 @@ namespace picongpu /** Initial temperature * unit: keV */ - static constexpr float_64 temperature = sim.si.getElectronMass() * sim.si.getSpeedOfLight() - * sim.si.getSpeedOfLight() * sim.si.conv.joule2ev(1.0e-3) * 0.00002; + static constexpr float_64 temperature + = sim.si.conv().joule2eV( + sim.si.getElectronMass() * sim.si.getSpeedOfLight() * sim.si.getSpeedOfLight()) + * 0.02; }; /** Definition of manipulator assigning a temperature * using parameters from struct TemperatureParamIons. diff --git a/share/picongpu/tests/CollisionsThermalisation/include/picongpu/param/particle.param b/share/picongpu/tests/CollisionsThermalisation/include/picongpu/param/particle.param index 8cef5b58a0..420fe9920e 100644 --- a/share/picongpu/tests/CollisionsThermalisation/include/picongpu/param/particle.param +++ b/share/picongpu/tests/CollisionsThermalisation/include/picongpu/param/particle.param @@ -68,8 +68,10 @@ namespace picongpu /** Initial temperature * unit: keV */ - static constexpr float_64 temperature = sim.si.getElectronMass() * sim.si.getSpeedOfLight() - * sim.si.getSpeedOfLight() * sim.si.conv.joule2ev(1.0e-3) * 0.0002; + static constexpr float_64 temperature + = sim.si.conv().joule2eV( + sim.si.getElectronMass() * sim.si.getSpeedOfLight() * sim.si.getSpeedOfLight()) + * 0.2; }; /** Definition of manipulator assigning a temperature * using parameters from struct TemperatureParamElectrons. @@ -82,8 +84,10 @@ namespace picongpu /** Initial temperature * unit: keV */ - static constexpr float_64 temperature = sim.si.getElectronMass() * sim.si.getSpeedOfLight() - * sim.si.getSpeedOfLight() * sim.si.conv.joule2ev(1.0e-3) * 0.00018; + static constexpr float_64 temperature + = sim.si.conv().joule2eV( + sim.si.getElectronMass() * sim.si.getSpeedOfLight() * sim.si.getSpeedOfLight()) + * 0.18; }; /** Definition of manipulator assigning a temperature * using parameters from struct TemperatureParamIons. diff --git a/share/picongpu/tests/compileAtomicPhysics/include/picongpu/param/ionizationEnergies.param b/share/picongpu/tests/compileAtomicPhysics/include/picongpu/param/ionizationEnergies.param index f1bd9becca..84eccc0bd2 100644 --- a/share/picongpu/tests/compileAtomicPhysics/include/picongpu/param/ionizationEnergies.param +++ b/share/picongpu/tests/compileAtomicPhysics/include/picongpu/param/ionizationEnergies.param @@ -39,7 +39,7 @@ namespace picongpu * Please follow these rules for defining ionization energies of atomic species, * unless your chosen ionization model requires a different unit system than `AU::` * - input of values in either atomic units or converting eV or Joule to them - * -> use either UNITCONV_eV_to_AU or SI::ATOMIC_UNIT_ENERGY for that purpose + * -> use either sim.si.conv().eV2auEnergy() or sim.si.conv().joule2auEnergy() for that purpose * - use `float_X` as the preferred data type * * example: @@ -76,24 +76,24 @@ namespace picongpu float_X, 18, Argon, - 15.7596119 * UNITCONV_eV_to_AU, - 27.62967 * UNITCONV_eV_to_AU, - 40.735 * UNITCONV_eV_to_AU, - 59.58 * UNITCONV_eV_to_AU, - 74.84 * UNITCONV_eV_to_AU, - 91.290 * UNITCONV_eV_to_AU, - 124.41 * UNITCONV_eV_to_AU, - 143.4567 * UNITCONV_eV_to_AU, - 422.60 * UNITCONV_eV_to_AU, - 479.76 * UNITCONV_eV_to_AU, - 540.4 * UNITCONV_eV_to_AU, - 619.0 * UNITCONV_eV_to_AU, - 685.5 * UNITCONV_eV_to_AU, - 755.13 * UNITCONV_eV_to_AU, - 855.5 * UNITCONV_eV_to_AU, - 918.375 * UNITCONV_eV_to_AU, - 4120.6657 * UNITCONV_eV_to_AU, - 4426.2229 * UNITCONV_eV_to_AU); + sim.si.conv().eV2auEnergy(15.7596119), + sim.si.conv().eV2auEnergy(27.62967), + sim.si.conv().eV2auEnergy(40.735), + sim.si.conv().eV2auEnergy(59.58), + sim.si.conv().eV2auEnergy(74.84), + sim.si.conv().eV2auEnergy(91.290), + sim.si.conv().eV2auEnergy(124.41), + sim.si.conv().eV2auEnergy(143.4567), + sim.si.conv().eV2auEnergy(422.60), + sim.si.conv().eV2auEnergy(479.76), + sim.si.conv().eV2auEnergy(540.4), + sim.si.conv().eV2auEnergy(619.0), + sim.si.conv().eV2auEnergy(685.5), + sim.si.conv().eV2auEnergy(755.13), + sim.si.conv().eV2auEnergy(855.5), + sim.si.conv().eV2auEnergy(918.375), + sim.si.conv().eV2auEnergy(4120.6657), + sim.si.conv().eV2auEnergy(4426.2229)); } // namespace AU } // namespace energies diff --git a/share/picongpu/tests/compileAtomicPhysics/include/picongpu/param/ionizer.param b/share/picongpu/tests/compileAtomicPhysics/include/picongpu/param/ionizer.param index 80551a53f5..570ef3a411 100644 --- a/share/picongpu/tests/compileAtomicPhysics/include/picongpu/param/ionizer.param +++ b/share/picongpu/tests/compileAtomicPhysics/include/picongpu/param/ionizer.param @@ -193,7 +193,7 @@ namespace picongpu */ constexpr float_X CUTOFF_MAX_ENERGY_KEV = 50.0; /** cutoff energy for electron "temperature" calculation in SI units*/ - constexpr float_X CUTOFF_MAX_ENERGY = CUTOFF_MAX_ENERGY_KEV * sim.si.conv.ev2Joule(1.0e3); + constexpr float_X CUTOFF_MAX_ENERGY = sim.si.conv().eV2Joule(CUTOFF_MAX_ENERGY_KEV * 1.0e3); /** lower ion density cutoff *