From cd840649fdc70dfd98107c5cdc85311f05080bb8 Mon Sep 17 00:00:00 2001 From: BrianMarre Date: Tue, 30 May 2023 17:11:06 +0200 Subject: [PATCH] processClass annotation for startIndex and numberTransitionsBuffers --- .../atomicPhysics2/atomicData/AtomicData.hpp | 155 +++++++++++------- ...tomicStateNumberOfTransitionsData_Down.hpp | 26 ++- ...micStateNumberOfTransitionsData_UpDown.hpp | 27 ++- .../AtomicStateStartIndexBlockData_Down.hpp | 26 ++- .../AtomicStateStartIndexBlockData_UpDown.hpp | 25 ++- .../atomicData/AutonomousTransitionData.hpp | 30 +++- .../atomicData/BoundBoundTransitionData.hpp | 31 +++- .../atomicData/BoundFreeTransitionData.hpp | 31 +++- .../SpawnIonizationMacroElectrons.kernel | 3 +- .../BoundBoundTransitionRates.hpp | 39 +++-- 10 files changed, 261 insertions(+), 132 deletions(-) diff --git a/include/picongpu/particles/atomicPhysics2/atomicData/AtomicData.hpp b/include/picongpu/particles/atomicPhysics2/atomicData/AtomicData.hpp index 39432792dc..deeb8928d2 100644 --- a/include/picongpu/particles/atomicPhysics2/atomicData/AtomicData.hpp +++ b/include/picongpu/particles/atomicPhysics2/atomicData/AtomicData.hpp @@ -47,9 +47,13 @@ // helper stuff for transition tuples #include "picongpu/particles/atomicPhysics2/atomicData/CompareTransitionTuple.hpp" #include "picongpu/particles/atomicPhysics2/atomicData/GetStateFromTransitionTuple.hpp" + // number of physical transitions for each transition data entry #include "picongpu/particles/atomicPhysics2/processClass/NumberPhysicalTransitions.hpp" +// enum of groups of processClass's +#include "picongpu/particles/atomicPhysics2/processClass/ProcessClassGroup.hpp" + #include #include #include @@ -104,6 +108,9 @@ namespace picongpu::particles::atomicPhysics2::atomicData { + namespace procClass = picongpu::particles::atomicPhysics2::processClass; + using ProcClassGroup = picongpu::particles::atomicPhysics2::processClass::ProcessClassGroup; + /** gathering of all atomicPhyiscs input data * * @tparam T_DataBoxType dataBox type used for storage @@ -159,14 +166,19 @@ namespace picongpu::particles::atomicPhysics2::atomicData = ChargeStateOrgaDataBuffer; using S_AtomicStateDataBuffer = AtomicStateDataBuffer; + + template using S_AtomicStateStartIndexBlockDataBuffer_UpDown - = AtomicStateStartIndexBlockDataBuffer_UpDown; + = AtomicStateStartIndexBlockDataBuffer_UpDown; + template using S_AtomicStateStartIndexBlockDataBuffer_Down - = AtomicStateStartIndexBlockDataBuffer_Down; + = AtomicStateStartIndexBlockDataBuffer_Down; + template using S_AtomicStateNumberOfTransitionsDataBuffer_UpDown - = AtomicStateNumberOfTransitionsDataBuffer_UpDown; + = AtomicStateNumberOfTransitionsDataBuffer_UpDown; + template using S_AtomicStateNumberOfTransitionsDataBuffer_Down - = AtomicStateNumberOfTransitionsDataBuffer_Down; + = AtomicStateNumberOfTransitionsDataBuffer_Down; using S_BoundBoundTransitionDataBuffer = BoundBoundTransitionDataBuffer< TypeNumber, @@ -191,13 +203,22 @@ namespace picongpu::particles::atomicPhysics2::atomicData using S_ChargeStateOrgaDataBox = ChargeStateOrgaDataBox; using S_AtomicStateDataBox = AtomicStateDataBox; + + template using S_AtomicStateStartIndexBlockDataBox_UpDown - = AtomicStateStartIndexBlockDataBox_UpDown; - using S_AtomicStateStartIndexBlockDataBox_Down = AtomicStateStartIndexBlockDataBox_Down; + = AtomicStateStartIndexBlockDataBox_UpDown; + + template + using S_AtomicStateStartIndexBlockDataBox_Down = AtomicStateStartIndexBlockDataBox_Down; + + template using S_AtomicStateNumberOfTransitionsDataBox_UpDown - = AtomicStateNumberOfTransitionsDataBox_UpDown; + = AtomicStateNumberOfTransitionsDataBox_UpDown; + + template using S_AtomicStateNumberOfTransitionsDataBox_Down - = AtomicStateNumberOfTransitionsDataBox_Down; + = AtomicStateNumberOfTransitionsDataBox_Down; using S_BoundBoundTransitionDataBox = BoundBoundTransitionDataBox; @@ -217,14 +238,17 @@ namespace picongpu::particles::atomicPhysics2::atomicData // atomic property data std::unique_ptr atomicStateDataBuffer; // atomic orga data - std::unique_ptr atomicStateStartIndexBlockDataBuffer_BoundBound; - std::unique_ptr atomicStateStartIndexBlockDataBuffer_BoundFree; - std::unique_ptr atomicStateStartIndexBlockDataBuffer_Autonomous; - std::unique_ptr + std::unique_ptr> + atomicStateStartIndexBlockDataBuffer_BoundBound; + std::unique_ptr> + atomicStateStartIndexBlockDataBuffer_BoundFree; + std::unique_ptr> + atomicStateStartIndexBlockDataBuffer_Autonomous; + std::unique_ptr> atomicStateNumberOfTransitionsDataBuffer_BoundBound; - std::unique_ptr + std::unique_ptr> atomicStateNumberOfTransitionsDataBuffer_BoundFree; - std::unique_ptr + std::unique_ptr> atomicStateNumberOfTransitionsDataBuffer_Autonomous; // transition data, normal, sorted by lower state @@ -727,17 +751,17 @@ namespace picongpu::particles::atomicPhysics2::atomicData atomicStateDataBuffer.reset(new S_AtomicStateDataBuffer(m_numberAtomicStates)); // atomic orga data atomicStateStartIndexBlockDataBuffer_BoundBound.reset( - new S_AtomicStateStartIndexBlockDataBuffer_UpDown(m_numberAtomicStates)); + new S_AtomicStateStartIndexBlockDataBuffer_UpDown(m_numberAtomicStates)); atomicStateStartIndexBlockDataBuffer_BoundFree.reset( - new S_AtomicStateStartIndexBlockDataBuffer_UpDown(m_numberAtomicStates)); + new S_AtomicStateStartIndexBlockDataBuffer_UpDown(m_numberAtomicStates)); atomicStateStartIndexBlockDataBuffer_Autonomous.reset( - new S_AtomicStateStartIndexBlockDataBuffer_Down(m_numberAtomicStates)); + new S_AtomicStateStartIndexBlockDataBuffer_Down(m_numberAtomicStates)); atomicStateNumberOfTransitionsDataBuffer_BoundBound.reset( - new S_AtomicStateNumberOfTransitionsDataBuffer_UpDown(m_numberAtomicStates)); + new S_AtomicStateNumberOfTransitionsDataBuffer_UpDown(m_numberAtomicStates)); atomicStateNumberOfTransitionsDataBuffer_BoundFree.reset( - new S_AtomicStateNumberOfTransitionsDataBuffer_UpDown(m_numberAtomicStates)); + new S_AtomicStateNumberOfTransitionsDataBuffer_UpDown(m_numberAtomicStates)); atomicStateNumberOfTransitionsDataBuffer_Autonomous.reset( - new S_AtomicStateNumberOfTransitionsDataBuffer_Down(m_numberAtomicStates)); + new S_AtomicStateNumberOfTransitionsDataBuffer_Down(m_numberAtomicStates)); // transition data boundBoundTransitionDataBuffer.reset(new S_BoundBoundTransitionDataBuffer(m_numberBoundBoundTransitions)); @@ -860,7 +884,11 @@ namespace picongpu::particles::atomicPhysics2::atomicData /** fill the upward atomic state orga buffers for a transition groups * * i.e. number of transitions and start index, up( and down) for each atomic state - * for a transition group(bound-bound, bound-free) + * for a transition group(either bound-bound or bound-free) + * + * @tparam T_Tuple transition tuple type + * @tparam T_NumberHostBox host data box of number of transitions buffer to fill transitions into + * @tparam T_StartIndexHostBox host data box of start index block of transitions buffer to fill transitions into * * @attention assumes that transitionList is sorted by lower state block wise * @attention changes have to synced to device separately @@ -879,11 +907,11 @@ namespace picongpu::particles::atomicPhysics2::atomicData * open a new block, by setting the first support point to the second support point * and continue as before until we reach the end of the transition list. */ - template + template ALPAKA_FN_HOST void fill_UpTransition_OrgaData( std::list transitionList, - S_AtomicStateNumberOfTransitionsDataBox_UpDown numberHostBox, - S_AtomicStateStartIndexBlockDataBox_UpDown startIndexHostBox) + S_AtomicStateNumberOfTransitionsDataBox_UpDown numberHostBox, + S_AtomicStateStartIndexBlockDataBox_UpDown startIndexHostBox) { typename std::list::iterator iter = transitionList.begin(); @@ -977,22 +1005,30 @@ namespace picongpu::particles::atomicPhysics2::atomicData /** fill the downward atomic state orga buffers for a transition groups * * i.e. number of transitions and start index, up( and down) of each atomic state - * for a transition group(bound-bound, bound-free, autonomous) + * for a transition group(either bound-bound, bound-free or autonomous) * - * @attention assumes that transitionList is sorted by upper state block wise - * @attention changes have to synced to device separately + * @tparam T_Tuple transition tuple type + * @tparam T_NumberHostBox host data box of number of transitions buffer to fill transitions into + * @tparam T_StartIndexHostBox host data box of start index block of transitions buffer to fill transitions into + * + * @attention assumes that transitionList is sorted by primarily upper state block wise and secondary by lower state + * @attention changes have to be synced to device separately * @attention startIndexBlock of a state is initialized to 0 if no transition in the * down direction exist in the transition list * * @details see fill_UpTransition_OrgaData but instead of ordering blocks by lower * state we order by upper state */ - template + template ALPAKA_FN_HOST void fill_DownTransition_OrgaData( std::list transitionList, T_NumberHostBox numberHostBox, T_StartIndexHostBox startIndexHostBox) { + // check consistency of intended processClass group and given boxes + PMACC_CASSERT(static_cast(T_NumberHostBox::processClassGroup) == static_cast(T_ProcessClassGroup)); + PMACC_CASSERT(static_cast(T_StartIndexHostBox::processClassGroup) == static_cast(T_ProcessClassGroup)); + typename std::list::iterator iter = transitionList.begin(); S_AtomicStateDataBox atomicStateDataHostBox = atomicStateDataBuffer->getHostDataBox(); @@ -1102,11 +1138,11 @@ namespace picongpu::particles::atomicPhysics2::atomicData S_TransitionSelectionDataBox transitionSelectionDataHostBox = transitionSelectionDataBuffer->getHostDataBox(); - S_AtomicStateNumberOfTransitionsDataBox_UpDown hostBoxNumberBoundBound + S_AtomicStateNumberOfTransitionsDataBox_UpDown hostBoxNumberBoundBound = atomicStateNumberOfTransitionsDataBuffer_BoundBound->getHostDataBox(); - S_AtomicStateNumberOfTransitionsDataBox_UpDown hostBoxNumberBoundFree + S_AtomicStateNumberOfTransitionsDataBox_UpDown hostBoxNumberBoundFree = atomicStateNumberOfTransitionsDataBuffer_BoundFree->getHostDataBox(); - S_AtomicStateNumberOfTransitionsDataBox_Down hostBoxNumberAutonomous + S_AtomicStateNumberOfTransitionsDataBox_Down hostBoxNumberAutonomous = atomicStateNumberOfTransitionsDataBuffer_Autonomous->getHostDataBox(); using S_NumberPhysicalTransitions @@ -1240,19 +1276,21 @@ namespace picongpu::particles::atomicPhysics2::atomicData fillChargeStateOrgaData(atomicStates); // atomic states, up direction - fill_UpTransition_OrgaData( + fill_UpTransition_OrgaData( boundBoundTransitions, atomicStateNumberOfTransitionsDataBuffer_BoundBound->getHostDataBox(), atomicStateStartIndexBlockDataBuffer_BoundBound->getHostDataBox()); - atomicStateNumberOfTransitionsDataBuffer_BoundBound->hostToDevice(), - atomicStateStartIndexBlockDataBuffer_BoundBound->hostToDevice(); + // sync to device + atomicStateNumberOfTransitionsDataBuffer_BoundBound->hostToDevice(); + atomicStateStartIndexBlockDataBuffer_BoundBound->hostToDevice(); - fill_UpTransition_OrgaData( + fill_UpTransition_OrgaData( boundFreeTransitions, atomicStateNumberOfTransitionsDataBuffer_BoundFree->getHostDataBox(), atomicStateStartIndexBlockDataBuffer_BoundFree->getHostDataBox()); - atomicStateNumberOfTransitionsDataBuffer_BoundFree->hostToDevice(), - atomicStateStartIndexBlockDataBuffer_BoundFree->hostToDevice(); + // sync to device + atomicStateNumberOfTransitionsDataBuffer_BoundFree->hostToDevice(); + atomicStateStartIndexBlockDataBuffer_BoundFree->hostToDevice(); // autonomous transitions are always only downward @@ -1282,36 +1320,42 @@ namespace picongpu::particles::atomicPhysics2::atomicData // fill orga data buffers 2.) // atomic states, down direction + // bound-bound fill_DownTransition_OrgaData< - S_BoundBoundTransitionTuple, - S_AtomicStateNumberOfTransitionsDataBox_UpDown, - S_AtomicStateStartIndexBlockDataBox_UpDown>( + S_BoundBoundTransitionTuple, + S_AtomicStateNumberOfTransitionsDataBox_UpDown, + S_AtomicStateStartIndexBlockDataBox_UpDown, + ProcClassGroup::boundBoundBased>( boundBoundTransitions, atomicStateNumberOfTransitionsDataBuffer_BoundBound->getHostDataBox(), atomicStateStartIndexBlockDataBuffer_BoundBound->getHostDataBox()); - + // sync to device atomicStateNumberOfTransitionsDataBuffer_BoundBound->hostToDevice(); atomicStateStartIndexBlockDataBuffer_BoundBound->hostToDevice(); + // bound-free fill_DownTransition_OrgaData< - S_BoundFreeTransitionTuple, - S_AtomicStateNumberOfTransitionsDataBox_UpDown, - S_AtomicStateStartIndexBlockDataBox_UpDown>( + S_BoundFreeTransitionTuple, + S_AtomicStateNumberOfTransitionsDataBox_UpDown, + S_AtomicStateStartIndexBlockDataBox_UpDown, + ProcClassGroup::boundFreeBased>( boundFreeTransitions, atomicStateNumberOfTransitionsDataBuffer_BoundFree->getHostDataBox(), atomicStateStartIndexBlockDataBuffer_BoundFree->getHostDataBox()); - + // sync to device atomicStateNumberOfTransitionsDataBuffer_BoundFree->hostToDevice(); atomicStateStartIndexBlockDataBuffer_BoundFree->hostToDevice(); + // autonomous fill_DownTransition_OrgaData< - S_AutonomousTransitionTuple, - S_AtomicStateNumberOfTransitionsDataBox_Down, - S_AtomicStateStartIndexBlockDataBox_Down>( + S_AutonomousTransitionTuple, + S_AtomicStateNumberOfTransitionsDataBox_Down, + S_AtomicStateStartIndexBlockDataBox_Down, + ProcClassGroup::autonomousBased>( autonomousTransitions, atomicStateNumberOfTransitionsDataBuffer_Autonomous->getHostDataBox(), atomicStateStartIndexBlockDataBuffer_Autonomous->getHostDataBox()); - + // sync to device atomicStateNumberOfTransitionsDataBuffer_Autonomous->hostToDevice(); atomicStateStartIndexBlockDataBuffer_Autonomous->hostToDevice(); @@ -1324,7 +1368,6 @@ namespace picongpu::particles::atomicPhysics2::atomicData T_autonomousIonization, T_fieldIonization>(); - // just to be sure if constexpr(picongpu::atomicPhysics2::ATOMIC_PHYSICS_ATOMIC_DATA_DEBUG_SYNC_TO_HOST) this->hostToDevice(); } @@ -1423,7 +1466,7 @@ namespace picongpu::particles::atomicPhysics2::atomicData // start index orga data //! @tparam hostData true: get hostDataBox, false: get DeviceDataBox template - S_AtomicStateStartIndexBlockDataBox_UpDown getBoundBoundStartIndexBlockDataBox() + S_AtomicStateStartIndexBlockDataBox_UpDown getBoundBoundStartIndexBlockDataBox() { if constexpr(hostData) return atomicStateStartIndexBlockDataBuffer_BoundBound->getHostDataBox(); @@ -1433,7 +1476,7 @@ namespace picongpu::particles::atomicPhysics2::atomicData //! @tparam hostData true: get hostDataBox, false: get DeviceDataBox template - S_AtomicStateStartIndexBlockDataBox_UpDown getBoundFreeStartIndexBlockDataBox() + S_AtomicStateStartIndexBlockDataBox_UpDown getBoundFreeStartIndexBlockDataBox() { if constexpr(hostData) return atomicStateStartIndexBlockDataBuffer_BoundFree->getHostDataBox(); @@ -1443,7 +1486,7 @@ namespace picongpu::particles::atomicPhysics2::atomicData //! @tparam hostData true: get hostDataBox, false: get DeviceDataBox template - S_AtomicStateStartIndexBlockDataBox_Down getAutonomousStartIndexBlockDataBox() + S_AtomicStateStartIndexBlockDataBox_Down getAutonomousStartIndexBlockDataBox() { if constexpr(hostData) return atomicStateStartIndexBlockDataBuffer_Autonomous->getHostDataBox(); @@ -1454,7 +1497,7 @@ namespace picongpu::particles::atomicPhysics2::atomicData // number transitions orga data //! @tparam hostData true: get hostDataBox, false: get DeviceDataBox template - S_AtomicStateNumberOfTransitionsDataBox_UpDown getBoundBoundNumberTransitionsDataBox() + S_AtomicStateNumberOfTransitionsDataBox_UpDown getBoundBoundNumberTransitionsDataBox() { if constexpr(hostData) return atomicStateNumberOfTransitionsDataBuffer_BoundBound->getHostDataBox(); @@ -1464,7 +1507,7 @@ namespace picongpu::particles::atomicPhysics2::atomicData //! @tparam hostData true: get hostDataBox, false: get DeviceDataBox template - S_AtomicStateNumberOfTransitionsDataBox_UpDown getBoundFreeNumberTransitionsDataBox() + S_AtomicStateNumberOfTransitionsDataBox_UpDown getBoundFreeNumberTransitionsDataBox() { if constexpr(hostData) return atomicStateNumberOfTransitionsDataBuffer_BoundFree->getHostDataBox(); @@ -1474,7 +1517,7 @@ namespace picongpu::particles::atomicPhysics2::atomicData //! @tparam hostData true: get hostDataBox, false: get DeviceDataBox template - S_AtomicStateNumberOfTransitionsDataBox_Down getAutonomousNumberTransitionsDataBox() + S_AtomicStateNumberOfTransitionsDataBox_Down getAutonomousNumberTransitionsDataBox() { if constexpr(hostData) return atomicStateNumberOfTransitionsDataBuffer_Autonomous->getHostDataBox(); diff --git a/include/picongpu/particles/atomicPhysics2/atomicData/AtomicStateNumberOfTransitionsData_Down.hpp b/include/picongpu/particles/atomicPhysics2/atomicData/AtomicStateNumberOfTransitionsData_Down.hpp index 854d2bb897..6ee9d97ad1 100644 --- a/include/picongpu/particles/atomicPhysics2/atomicData/AtomicStateNumberOfTransitionsData_Down.hpp +++ b/include/picongpu/particles/atomicPhysics2/atomicData/AtomicStateNumberOfTransitionsData_Down.hpp @@ -22,6 +22,8 @@ #include "picongpu/particles/atomicPhysics2/atomicData/DataBox.hpp" #include "picongpu/particles/atomicPhysics2/atomicData/DataBuffer.hpp" +#include "picongpu/particles/atomicPhysics2/processClass/ProcessClassGroup.hpp" + #include #include @@ -36,16 +38,19 @@ namespace picongpu::particles::atomicPhysics2::atomicData * * for use on device. * - * @tparam T_DataBoxType dataBox type used for storage * @tparam T_Number dataType used for number storage, typically uint32_t * @tparam T_Value dataType used for value storage, typically float_X + * @tparam T_ProcessClassGroup processClassGroup current data corresponds to */ - template + template< + typename T_Number, + typename T_Value, + particles::atomicPhysics2::processClass::ProcessClassGroup T_ProcessClassGroup> class AtomicStateNumberOfTransitionsDataBox_Down : public DataBox { public: - using dataBoxType = AtomicStateNumberOfTransitionsDataBox_Down; using S_DataBox = DataBox; + static constexpr auto processClassGroup = T_ProcessClassGroup; private: /** start collection index of the block of autonomous transitions @@ -115,12 +120,17 @@ namespace picongpu::particles::atomicPhysics2::atomicData * * @tparam T_Number dataType used for number storage, typically uint32_t * @tparam T_Value dataType used for value storage, typically float_X + * @tparam T_ProcessClassGroup processClassGroup current data corresponds to */ - template + template< + typename T_Number, + typename T_Value, + particles::atomicPhysics2::processClass::ProcessClassGroup T_ProcessClassGroup> class AtomicStateNumberOfTransitionsDataBuffer_Down : public DataBuffer { public: using S_DataBuffer = DataBuffer; + using DataBoxType = AtomicStateNumberOfTransitionsDataBox_Down; private: std::unique_ptr bufferNumberOfTransitionsBlockTransitionsDown; @@ -138,16 +148,16 @@ namespace picongpu::particles::atomicPhysics2::atomicData bufferOffset.reset(new typename S_DataBuffer::BufferNumber(layoutAtomicStates, false)); } - HINLINE AtomicStateNumberOfTransitionsDataBox_Down getHostDataBox() + HINLINE DataBoxType getHostDataBox() { - return AtomicStateNumberOfTransitionsDataBox_Down( + return DataBoxType( bufferNumberOfTransitionsBlockTransitionsDown->getHostBuffer().getDataBox(), bufferOffset->getHostBuffer().getDataBox()); } - HINLINE AtomicStateNumberOfTransitionsDataBox_Down getDeviceDataBox() + HINLINE DataBoxType getDeviceDataBox() { - return AtomicStateNumberOfTransitionsDataBox_Down( + return DataBoxType( bufferNumberOfTransitionsBlockTransitionsDown->getDeviceBuffer().getDataBox(), bufferOffset->getHostBuffer().getDataBox()); } diff --git a/include/picongpu/particles/atomicPhysics2/atomicData/AtomicStateNumberOfTransitionsData_UpDown.hpp b/include/picongpu/particles/atomicPhysics2/atomicData/AtomicStateNumberOfTransitionsData_UpDown.hpp index 5029decf54..921ff467a9 100644 --- a/include/picongpu/particles/atomicPhysics2/atomicData/AtomicStateNumberOfTransitionsData_UpDown.hpp +++ b/include/picongpu/particles/atomicPhysics2/atomicData/AtomicStateNumberOfTransitionsData_UpDown.hpp @@ -22,6 +22,8 @@ #include "picongpu/particles/atomicPhysics2/atomicData/DataBox.hpp" #include "picongpu/particles/atomicPhysics2/atomicData/DataBuffer.hpp" +#include "picongpu/particles/atomicPhysics2/processClass/ProcessClassGroup.hpp" + #include #include @@ -36,15 +38,20 @@ namespace picongpu::particles::atomicPhysics2::atomicData * * for use on device. * - * @tparam T_DataBoxType dataBox type used for storage * @tparam T_Number dataType used for number storage, typically uint32_t * @tparam T_Value dataType used for value storage, typically float_X + * @tparam T_ProcessClassGroup processClassGroup current data corresponds to */ - template + template< + typename T_Number, + typename T_Value, + particles::atomicPhysics2::processClass::ProcessClassGroup T_ProcessClassGroup + > class AtomicStateNumberOfTransitionsDataBox_UpDown : public DataBox { public: using S_DataBox = DataBox; + static constexpr auto processClassGroup = T_ProcessClassGroup; private: //! start collection index of the block of upward transitions from the atomic state in the corresponding upward @@ -138,12 +145,16 @@ namespace picongpu::particles::atomicPhysics2::atomicData * * @tparam T_Number dataType used for number storage, typically uint32_t * @tparam T_Value dataType used for value storage, typically float_X + * @tparam T_ProcessClassGroup processClassGroup current data corresponds to */ - template + template< + typename T_Number, + typename T_Value, + particles::atomicPhysics2::processClass::ProcessClassGroup T_ProcessClassGroup> class AtomicStateNumberOfTransitionsDataBuffer_UpDown : public DataBuffer { public: - using dataBoxType = AtomicStateNumberOfTransitionsDataBox_UpDown; + using DataBoxType = AtomicStateNumberOfTransitionsDataBox_UpDown; using S_DataBuffer = DataBuffer; private: @@ -163,17 +174,17 @@ namespace picongpu::particles::atomicPhysics2::atomicData bufferOffset.reset(new typename S_DataBuffer::BufferNumber(layoutAtomicStates, false)); } - HINLINE AtomicStateNumberOfTransitionsDataBox_UpDown getHostDataBox() + HINLINE DataBoxType getHostDataBox() { - return AtomicStateNumberOfTransitionsDataBox_UpDown( + return DataBoxType( bufferNumberOfTransitionsDown->getHostBuffer().getDataBox(), bufferNumberOfTransitionsUp->getHostBuffer().getDataBox(), bufferOffset->getHostBuffer().getDataBox()); } - HINLINE AtomicStateNumberOfTransitionsDataBox_UpDown getDeviceDataBox() + HINLINE DataBoxType getDeviceDataBox() { - return AtomicStateNumberOfTransitionsDataBox_UpDown( + return DataBoxType( bufferNumberOfTransitionsDown->getDeviceBuffer().getDataBox(), bufferNumberOfTransitionsUp->getDeviceBuffer().getDataBox(), bufferOffset->getDeviceBuffer().getDataBox()); diff --git a/include/picongpu/particles/atomicPhysics2/atomicData/AtomicStateStartIndexBlockData_Down.hpp b/include/picongpu/particles/atomicPhysics2/atomicData/AtomicStateStartIndexBlockData_Down.hpp index 4c2ab48177..16c9cbad82 100644 --- a/include/picongpu/particles/atomicPhysics2/atomicData/AtomicStateStartIndexBlockData_Down.hpp +++ b/include/picongpu/particles/atomicPhysics2/atomicData/AtomicStateStartIndexBlockData_Down.hpp @@ -22,6 +22,8 @@ #include "picongpu/particles/atomicPhysics2/atomicData/DataBox.hpp" #include "picongpu/particles/atomicPhysics2/atomicData/DataBuffer.hpp" +#include "picongpu/particles/atomicPhysics2/processClass/ProcessClassGroup.hpp" + #include #include #include @@ -39,13 +41,17 @@ namespace picongpu::particles::atomicPhysics2::atomicData * * @tparam T_CollectionIndex dataType of collectionIndex, typically uint32_t * @tparam T_Value dataType used for value storage, typically float_X - * @tparam T_atomicNumber atomic number of element this data corresponds to, eg. Cu -> 29 + * @tparam T_ProcessClassGroup processClassGroup current data corresponds to */ - template + template< + typename T_CollectionIndex, + typename T_Value, + particles::atomicPhysics2::processClass::ProcessClassGroup T_ProcessClassGroup> class AtomicStateStartIndexBlockDataBox_Down : public DataBox { public: using S_DataBox = DataBox; + static constexpr auto processClassGroup = T_ProcessClassGroup; private: /** start collection index of the block of autonomous transitions @@ -93,12 +99,16 @@ namespace picongpu::particles::atomicPhysics2::atomicData * * @tparam T_CollectionIndex dataType used for number storage, typically uint32_t * @tparam T_Value dataType used for value storage, typically float_X + * @tparam T_ProcessClassGroup processClassGroup current data corresponds to */ - template + template< + typename T_CollectionIndex, + typename T_Value, + particles::atomicPhysics2::processClass::ProcessClassGroup T_ProcessClassGroup> class AtomicStateStartIndexBlockDataBuffer_Down : public DataBuffer { public: - using dataBoxType = AtomicStateStartIndexBlockDataBox_Down; + using DataBoxType = AtomicStateStartIndexBlockDataBox_Down; using S_DataBuffer = DataBuffer; private: @@ -115,15 +125,15 @@ namespace picongpu::particles::atomicPhysics2::atomicData typename S_DataBuffer::BufferNumber(layoutAtomicStates, false)); } - HINLINE AtomicStateStartIndexBlockDataBox_Down getHostDataBox() + HINLINE DataBoxType getHostDataBox() { - return AtomicStateStartIndexBlockDataBox_Down( + return DataBoxType( bufferStartIndexBlockTransitionsDown->getHostBuffer().getDataBox()); } - HINLINE AtomicStateStartIndexBlockDataBox_Down getDeviceDataBox() + HINLINE DataBoxType getDeviceDataBox() { - return AtomicStateStartIndexBlockDataBox_Down( + return DataBoxType( bufferStartIndexBlockTransitionsDown->getDeviceBuffer().getDataBox()); } diff --git a/include/picongpu/particles/atomicPhysics2/atomicData/AtomicStateStartIndexBlockData_UpDown.hpp b/include/picongpu/particles/atomicPhysics2/atomicData/AtomicStateStartIndexBlockData_UpDown.hpp index d119a68493..aad27046df 100644 --- a/include/picongpu/particles/atomicPhysics2/atomicData/AtomicStateStartIndexBlockData_UpDown.hpp +++ b/include/picongpu/particles/atomicPhysics2/atomicData/AtomicStateStartIndexBlockData_UpDown.hpp @@ -22,6 +22,8 @@ #include "picongpu/particles/atomicPhysics2/atomicData/DataBox.hpp" #include "picongpu/particles/atomicPhysics2/atomicData/DataBuffer.hpp" +#include "picongpu/particles/atomicPhysics2/processClass/ProcessClassGroup.hpp" + #include #include @@ -36,16 +38,19 @@ namespace picongpu::particles::atomicPhysics2::atomicData * * for use on device. * - * @tparam T_DataBoxType dataBox type used for storage * @tparam T_CollectionIndex dataType of collectionIndex, typically uint32_t * @tparam T_Value dataType used for value storage, typically float_X + * @tparam T_ProcessClassGroup processClassGroup current data corresponds to */ - template + template< + typename T_CollectionIndex, + typename T_Value, + particles::atomicPhysics2::processClass::ProcessClassGroup T_ProcessClassGroup> class AtomicStateStartIndexBlockDataBox_UpDown : public DataBox { public: - using dataBoxType = AtomicStateStartIndexBlockDataBox_UpDown; using S_DataBox = DataBox; + static constexpr auto processClassGroup = T_ProcessClassGroup; private: //! start collection index of the block of downward transitions from the atomic state in the corresponding @@ -116,11 +121,15 @@ namespace picongpu::particles::atomicPhysics2::atomicData * @tparam T_CollectionIndex dataType used for number storage, typically uint32_t * @tparam T_Value dataType used for value storage, typically float_X */ - template + template< + typename T_CollectionIndex, + typename T_Value, + particles::atomicPhysics2::processClass::ProcessClassGroup T_ProcessClassGroup> class AtomicStateStartIndexBlockDataBuffer_UpDown : public DataBuffer { public: using S_DataBuffer = DataBuffer; + using DataBoxType = AtomicStateStartIndexBlockDataBox_UpDown; private: std::unique_ptr bufferStartIndexBlockTransitionsDown; @@ -139,16 +148,16 @@ namespace picongpu::particles::atomicPhysics2::atomicData typename S_DataBuffer::BufferNumber(layoutAtomicStates, false)); } - HINLINE AtomicStateStartIndexBlockDataBox_UpDown getHostDataBox() + HINLINE DataBoxType getHostDataBox() { - return AtomicStateStartIndexBlockDataBox_UpDown( + return DataBoxType( bufferStartIndexBlockTransitionsDown->getHostBuffer().getDataBox(), bufferStartIndexBlockTransitionsUp->getHostBuffer().getDataBox()); } - HINLINE AtomicStateStartIndexBlockDataBox_UpDown getDeviceDataBox() + HINLINE DataBoxType getDeviceDataBox() { - return AtomicStateStartIndexBlockDataBox_UpDown( + return DataBoxType( bufferStartIndexBlockTransitionsDown->getDeviceBuffer().getDataBox(), bufferStartIndexBlockTransitionsUp->getDeviceBuffer().getDataBox()); } diff --git a/include/picongpu/particles/atomicPhysics2/atomicData/AutonomousTransitionData.hpp b/include/picongpu/particles/atomicPhysics2/atomicData/AutonomousTransitionData.hpp index 84adba183f..ff4592b90a 100644 --- a/include/picongpu/particles/atomicPhysics2/atomicData/AutonomousTransitionData.hpp +++ b/include/picongpu/particles/atomicPhysics2/atomicData/AutonomousTransitionData.hpp @@ -25,6 +25,8 @@ #include "picongpu/particles/atomicPhysics2/atomicData/AtomicTuples.def" #include "picongpu/particles/atomicPhysics2/atomicData/TransitionData.hpp" +#include "picongpu/particles/atomicPhysics2/processClass/ProcessClassGroup.hpp" + #include #include #include @@ -53,12 +55,18 @@ namespace picongpu::particles::atomicPhysics2::atomicData * The configNumber of a given state is always the same, its collection index depends * on input file,it should therefore only be used internally! */ - template + template< + typename T_Number, + typename T_Value, + typename T_CollectionIndex, + typename T_ConfigNumberDataType> class AutonomousTransitionDataBox : public TransitionDataBox { public: using S_TransitionDataBox = TransitionDataBox; using S_AutonomousTransitionTuple = AutonomousTransitionTuple; + static constexpr auto processClassGroup + = particles::atomicPhysics2::processClass::ProcessClassGroup::autonomousBased; private: typename S_TransitionDataBox::S_DataBox::BoxValue m_boxTransitionRate; // unit: 1/UNIT_TIME @@ -153,12 +161,20 @@ namespace picongpu::particles::atomicPhysics2::atomicData * @tparam T_Value dataType used for value storage, typically float_X * @tparam T_CollectionIndex data type used for configNumber storage, typically uint32_t * @tparam T_ConfigNumberDataType dataType used for configNumber storage, typically uint64_t + * @tparam T_ProcessClassGroup processClassGroup current data corresponds to */ - template + template< + typename T_Number, + typename T_Value, + typename T_CollectionIndex, + typename T_ConfigNumberDataType> class AutonomousTransitionDataBuffer : public TransitionDataBuffer { public: using S_TransitionDataBuffer = TransitionDataBuffer; + using DataBoxType = AutonomousTransitionDataBox; + static constexpr auto processClassGroup + = particles::atomicPhysics2::processClass::ProcessClassGroup::autonomousBased; private: std::unique_ptr bufferTransitionRate; @@ -179,20 +195,18 @@ namespace picongpu::particles::atomicPhysics2::atomicData new typename S_TransitionDataBuffer::BufferValue(layoutAutonomousTransitions, false)); } - HINLINE AutonomousTransitionDataBox - getHostDataBox() + HINLINE DataBoxType getHostDataBox() { - return AutonomousTransitionDataBox( + return DataBoxType( bufferTransitionRate->getHostBuffer().getDataBox(), this->bufferLowerStateCollectionIndex->getHostBuffer().getDataBox(), this->bufferUpperStateCollectionIndex->getHostBuffer().getDataBox(), this->m_numberTransitions); } - HINLINE AutonomousTransitionDataBox - getDeviceDataBox() + HINLINE DataBoxType getDeviceDataBox() { - return AutonomousTransitionDataBox( + return DataBoxType( bufferTransitionRate->getDeviceBuffer().getDataBox(), this->bufferLowerStateCollectionIndex->getDeviceBuffer().getDataBox(), this->bufferUpperStateCollectionIndex->getDeviceBuffer().getDataBox(), diff --git a/include/picongpu/particles/atomicPhysics2/atomicData/BoundBoundTransitionData.hpp b/include/picongpu/particles/atomicPhysics2/atomicData/BoundBoundTransitionData.hpp index 372c370dcc..c076f05280 100644 --- a/include/picongpu/particles/atomicPhysics2/atomicData/BoundBoundTransitionData.hpp +++ b/include/picongpu/particles/atomicPhysics2/atomicData/BoundBoundTransitionData.hpp @@ -24,6 +24,8 @@ #include "picongpu/particles/atomicPhysics2/atomicData/AtomicTuples.def" #include "picongpu/particles/atomicPhysics2/atomicData/TransitionData.hpp" +#include "picongpu/particles/atomicPhysics2/processClass/ProcessClassGroup.hpp" + #include #include #include @@ -43,19 +45,25 @@ namespace picongpu::particles::atomicPhysics2::atomicData * typically uint32_t * @tparam T_ConfigNumberDataType dataType used for configNumber storage, * typically uint64_t - * + * * @attention ConfigNumber specifies the number of a state as defined by the configNumber * class, while index always refers to a collection index. * The configNumber of a given state is always the same, its collection index depends * on input file,it should therefore only be used internally! */ - template + template< + typename T_Number, + typename T_Value, + typename T_CollectionIndex, + typename T_ConfigNumberDataType> class BoundBoundTransitionDataBox : public TransitionDataBox { public: using S_TransitionDataBox = TransitionDataBox; using S_BoundBoundTransitionTuple = BoundBoundTransitionTuple; + static constexpr auto processClassGroup + = particles::atomicPhysics2::processClass::ProcessClassGroup::boundBoundBased; private: //! unitless @@ -314,11 +322,18 @@ namespace picongpu::particles::atomicPhysics2::atomicData * @tparam T_CollectionIndex used for index storage, typically uint32_t * @tparam T_ConfigNumberDataType dataType used for configNumber storage, typically uint64_t */ - template + template< + typename T_Number, + typename T_Value, + typename T_CollectionIndex, + typename T_ConfigNumberDataType> class BoundBoundTransitionDataBuffer : public TransitionDataBuffer { public: using S_TransitionDataBuffer = TransitionDataBuffer; + using DataBoxType = BoundBoundTransitionDataBox; + static constexpr auto processClassGroup + = particles::atomicPhysics2::processClass::ProcessClassGroup::boundBoundBased; private: std::unique_ptr bufferCollisionalOscillatorStrength; @@ -352,10 +367,9 @@ namespace picongpu::particles::atomicPhysics2::atomicData bufferCxin5.reset(new typename S_TransitionDataBuffer::BufferValue(layoutBoundBoundTransitions, false)); } - HINLINE BoundBoundTransitionDataBox - getHostDataBox() + HINLINE DataBoxType getHostDataBox() { - return BoundBoundTransitionDataBox( + return DataBoxType( bufferCollisionalOscillatorStrength->getHostBuffer().getDataBox(), bufferAbsorptionOscillatorStrength->getHostBuffer().getDataBox(), bufferCxin1->getHostBuffer().getDataBox(), @@ -368,10 +382,9 @@ namespace picongpu::particles::atomicPhysics2::atomicData this->m_numberTransitions); } - HINLINE BoundBoundTransitionDataBox - getDeviceDataBox() + HINLINE DataBoxType getDeviceDataBox() { - return BoundBoundTransitionDataBox( + return DataBoxType( bufferCollisionalOscillatorStrength->getDeviceBuffer().getDataBox(), bufferAbsorptionOscillatorStrength->getDeviceBuffer().getDataBox(), bufferCxin1->getDeviceBuffer().getDataBox(), diff --git a/include/picongpu/particles/atomicPhysics2/atomicData/BoundFreeTransitionData.hpp b/include/picongpu/particles/atomicPhysics2/atomicData/BoundFreeTransitionData.hpp index 7e47795c91..d1a7100941 100644 --- a/include/picongpu/particles/atomicPhysics2/atomicData/BoundFreeTransitionData.hpp +++ b/include/picongpu/particles/atomicPhysics2/atomicData/BoundFreeTransitionData.hpp @@ -24,6 +24,8 @@ #include "picongpu/particles/atomicPhysics2/atomicData/AtomicTuples.def" #include "picongpu/particles/atomicPhysics2/atomicData/TransitionData.hpp" +#include "picongpu/particles/atomicPhysics2/processClass/ProcessClassGroup.hpp" + #include #include #include @@ -48,19 +50,26 @@ namespace picongpu::particles::atomicPhysics2::atomicData * typically uint32_t * @tparam T_ConfigNumberDataType dataType used for configNumber storage, * typically uint64_t + * @tparam T_ProcessClassGroup processClassGroup current data corresponds to * * @attention ConfigNumber specifies the number of a state as defined by the configNumber * class, while index always refers to a collection index. * The configNumber of a given state is always the same, its collection index depends * on input file,it should therefore only be used internally! */ - template + template< + typename T_Number, + typename T_Value, + typename T_CollectionIndex, + typename T_ConfigNumberDataType> class BoundFreeTransitionDataBox : public TransitionDataBox { public: using S_TransitionDataBox = TransitionDataBox; using S_BoundFreeTransitionTuple = BoundFreeTransitionTuple; + static constexpr auto processClassGroup + = particles::atomicPhysics2::processClass::ProcessClassGroup::boundFreeBased; private: //! cross section fit parameter 1, unitless @@ -338,12 +347,20 @@ namespace picongpu::particles::atomicPhysics2::atomicData * @tparam T_Value dataType used for value storage, typically float_X * @tparam T_CollectionIndex used for index storage, typically uint32_t * @tparam T_ConfigNumberDataType dataType used for configNumber storage, typically uint64_t + * @tparam T_ProcessClassGroup processClassGroup current data corresponds to */ - template + template< + typename T_Number, + typename T_Value, + typename T_CollectionIndex, + typename T_ConfigNumberDataType> class BoundFreeTransitionDataBuffer : public TransitionDataBuffer { public: using S_TransitionDataBuffer = TransitionDataBuffer; + using DataBoxType = BoundFreeTransitionDataBox; + static constexpr auto processClassGroup + = particles::atomicPhysics2::processClass::ProcessClassGroup::boundFreeBased; private: std::unique_ptr bufferCxin1; @@ -377,10 +394,9 @@ namespace picongpu::particles::atomicPhysics2::atomicData bufferCxin8.reset(new typename S_TransitionDataBuffer::BufferValue(layoutBoundFreeTransitions, false)); } - HINLINE BoundFreeTransitionDataBox - getHostDataBox() + HINLINE DataBoxType getHostDataBox() { - return BoundFreeTransitionDataBox( + return DataBoxType( bufferCxin1->getHostBuffer().getDataBox(), bufferCxin2->getHostBuffer().getDataBox(), bufferCxin3->getHostBuffer().getDataBox(), @@ -394,10 +410,9 @@ namespace picongpu::particles::atomicPhysics2::atomicData this->m_numberTransitions); } - HINLINE BoundFreeTransitionDataBox - getDeviceDataBox() + HINLINE DataBoxType getDeviceDataBox() { - return BoundFreeTransitionDataBox( + return DataBoxType( bufferCxin1->getDeviceBuffer().getDataBox(), bufferCxin2->getDeviceBuffer().getDataBox(), bufferCxin3->getDeviceBuffer().getDataBox(), diff --git a/include/picongpu/particles/atomicPhysics2/kernel/SpawnIonizationMacroElectrons.kernel b/include/picongpu/particles/atomicPhysics2/kernel/SpawnIonizationMacroElectrons.kernel index abf3f9db6a..21c1c87709 100644 --- a/include/picongpu/particles/atomicPhysics2/kernel/SpawnIonizationMacroElectrons.kernel +++ b/include/picongpu/particles/atomicPhysics2/kernel/SpawnIonizationMacroElectrons.kernel @@ -254,8 +254,7 @@ namespace picongpu::particles::atomicPhysics2::kernel auto ion = ionFrame[frameSlotIdx]; // not occupied or does not want to spawn an electron - if((!static_cast(ion[multiMask_])) - || (numberIonizationElectrons == static_cast(0u))) + if(numberIonizationElectrons == static_cast(0u)) return; uint32_t const globalSlotIndex diff --git a/include/picongpu/particles/atomicPhysics2/rateCalculation/BoundBoundTransitionRates.hpp b/include/picongpu/particles/atomicPhysics2/rateCalculation/BoundBoundTransitionRates.hpp index 68d2b21cc3..64172dce57 100644 --- a/include/picongpu/particles/atomicPhysics2/rateCalculation/BoundBoundTransitionRates.hpp +++ b/include/picongpu/particles/atomicPhysics2/rateCalculation/BoundBoundTransitionRates.hpp @@ -112,15 +112,17 @@ namespace picongpu::particles::atomicPhysics2::rateCalculation float_X g; if ((A == 0._X) && (B == 0._X) && (C == 0._X) && (D == 0._X) && (a == 0._X)) + { // use mewe approximation if all gaunt coefficients are zero g = 0.15 + 0.28 * math::log(U); + } else + { // chuung approximation g = A * math::log(U) + B + C / (U + a) + D / ((U + a) * (U + a)); // unitless + } - // debug only - if - + // check for forbidden transition if(U > 1.0_X) return g; // unitless else @@ -244,34 +246,37 @@ namespace picongpu::particles::atomicPhysics2::rateCalculation return 0._X; } + // eV + float_X U; + // unitless + float_X ratio; + if constexpr(T_excitation) { // excitation - return crossSection_butGaunt - * gauntFactor( - energyElectron / energyDifference, - transitionCollectionIndex, - boundBoundTransitionDataBox); // [1e6b] + ratio = 1._X; + + U = energyElectron / energyDifference; } else { // deexcitation - // different multiplicityConfigNumber for deexcitation + // unitless float_X const ratio = static_cast( multiplicityConfigNumber(atomicStateDataBox.configNumber(lowerStateClctIdx)) / multiplicityConfigNumber(atomicStateDataBox.configNumber(upperStateClctIdx))); - // unitless if constexpr(picongpu::atomicPhysics2::ATOMIC_PHYSICS_RATE_CALCULATION_HOT_DEBUG) debugChecksMultiplicity(ratio, lowerStateClctIdx, upperStateClctIdx, atomicStateDataBox); - return ratio * crossSection_butGaunt - * gauntFactor( - (energyElectron + energyDifference) / energyDifference, - transitionCollectionIndex, - boundBoundTransitionDataBox); // [1e6b] + U = (energyElectron + energyDifference) / energyDifference; } + + return crossSection_butGaunt * ratio * gauntFactor( + U, + transitionCollectionIndex, + boundBoundTransitionDataBox); // [1e6b] } /** rate for collisional bound-bound transition of ion with free electron bin @@ -400,7 +405,7 @@ namespace picongpu::particles::atomicPhysics2::rateCalculation // unit: 1/UNIT_TIME } - /// @todo radiativeBoundBoundCrossSection - /// @todo rateRadiativeBoundBoundTransition + /// @todo radiativeBoundBoundCrossSection, Brian Marre, 2022 + /// @todo rateRadiativeBoundBoundTransition, Brian Marre, 2022 }; } // namespace picongpu::particles::atomicPhysics2::rateCalculation