|
| 1 | +/* Copyright 2025 Filip Optolowicz |
| 2 | + * |
| 3 | + * This file is part of PIConGPU. |
| 4 | + * |
| 5 | + * PIConGPU is free software: you can redistribute it and/or modify |
| 6 | + * it under the terms of the GNU General Public License as published by |
| 7 | + * the Free Software Foundation, either version 3 of the License, or |
| 8 | + * (at your option) any later version. |
| 9 | + * |
| 10 | + * PIConGPU is distributed in the hope that it will be useful, |
| 11 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | + * GNU General Public License for more details. |
| 14 | + * |
| 15 | + * You should have received a copy of the GNU General Public License |
| 16 | + * along with PIConGPU. |
| 17 | + * If not, see <http://www.gnu.org/licenses/>. |
| 18 | + */ |
| 19 | + |
| 20 | +#pragma once |
| 21 | + |
| 22 | +#include "picongpu/param/particleFilters.param" |
| 23 | +#include "picongpu/particles/fusion/fusion.def" |
| 24 | +#include "picongpu/plugins/misc/SpeciesFilter.hpp" |
| 25 | + |
| 26 | +#include <pmacc/meta/conversion/MakeSeq.hpp> |
| 27 | + |
| 28 | +namespace picongpu |
| 29 | +{ |
| 30 | + namespace particles |
| 31 | + { |
| 32 | + namespace fusion |
| 33 | + { |
| 34 | + //! =================================================================== |
| 35 | + //! PRECISION SETTINGS |
| 36 | + //! =================================================================== |
| 37 | + namespace precision |
| 38 | + { |
| 39 | + //! Use double precision for fusion collision calculations |
| 40 | + using float_COLL = float_64; |
| 41 | + } // namespace precision |
| 42 | + |
| 43 | + using namespace picongpu::plugins; |
| 44 | + |
| 45 | + //! =================================================================== |
| 46 | + //! FUSION REACTION DEFINITIONS |
| 47 | + //! =================================================================== |
| 48 | + |
| 49 | + /** Deuterium-Tritium Fusion Reaction |
| 50 | + * |
| 51 | + * This defines the D + T -> n + He4 fusion reaction |
| 52 | + * |
| 53 | + * USAGE: Uncomment this struct to enable D-T fusion in your simulation |
| 54 | + * |
| 55 | + * The cross-section parameters are based on the Bosch-Hale |
| 56 | + * parameterization from experimental data. |
| 57 | + * Source: https://hdl.handle.net/11858/00-001M-0000-0027-6535-1 (page 29) |
| 58 | + */ |
| 59 | + // struct DT |
| 60 | + // { |
| 61 | + // //! Reactant species: Deuterium and Tritium |
| 62 | + // using reactants = pmacc::mp_list<Pair<PIC_Tritons, PIC_Deuterons>>; |
| 63 | + // |
| 64 | + // //! Product species: Neutron and Helium-4 |
| 65 | + // using products = pmacc::mp_list<Pair<PIC_Neutrons, PIC_He4>>; |
| 66 | + // |
| 67 | + // /** Cross-section parameters for D-T fusion */ |
| 68 | + // struct Params |
| 69 | + // { |
| 70 | + // //! Gamov constant: BG = pi*alpha*Z1*Z2*sqrt(2*mu*c^2) in keV^(1/2) |
| 71 | + // //! where alpha is fine structure constant, Z1,Z2 are charges, mu is reduced mass |
| 72 | + // static constexpr float_X BG = 34.3827_X; |
| 73 | + // |
| 74 | + // //! Bosch-Hale parameterization coefficients for D-T cross-section |
| 75 | + // //! These coefficients fit experimental cross-section data |
| 76 | + // static constexpr float_X A1 = 6.927e4_X; |
| 77 | + // static constexpr float_X A2 = 7.454e8_X; |
| 78 | + // static constexpr float_X A3 = 2.050e6_X; |
| 79 | + // static constexpr float_X A4 = 5.2002e4_X; |
| 80 | + // static constexpr float_X A5 = 0.0_X; |
| 81 | + // |
| 82 | + // //! Additional Bosch-Hale coefficients |
| 83 | + // static constexpr float_X B1 = 6.38e1_X; |
| 84 | + // static constexpr float_X B2 = -9.95e-1_X; |
| 85 | + // static constexpr float_X B3 = 6.981e-5_X; |
| 86 | + // static constexpr float_X B4 = 1.728e-4_X; |
| 87 | + // }; |
| 88 | + // //! For now it's the only cross-section interpolator available |
| 89 | + // //! Cross-section calculation using Bosch-Hale parameterization. |
| 90 | + // //! Returns cross-section in milli-barns. |
| 91 | + // using CrossSectionInterpolator = relativistic::FusionFunctor<Params>; |
| 92 | + // }; |
| 93 | + |
| 94 | + // empty pipeline - no fusion |
| 95 | + using FusionPipeline = pmacc::mp_list<>; |
| 96 | + |
| 97 | + //! =================================================================== |
| 98 | + //! FUSION PIPELINE CONFIGURATION |
| 99 | + //! =================================================================== |
| 100 | + |
| 101 | + /** FusionPipeline: Defines the sequence of fusion reactions |
| 102 | + * |
| 103 | + * This controls which fusion reactions occur and in what order. |
| 104 | + * Each reaction is processed sequentially from first to last. |
| 105 | + * |
| 106 | + * USAGE EXAMPLES: |
| 107 | + * |
| 108 | + * 1. Single D-T reaction: |
| 109 | + * using FusionPipeline = pmacc::mp_list<ColliderFromStruct<DT>>; |
| 110 | + * |
| 111 | + * 2. Multiple reactions (processed in order): |
| 112 | + * using FusionPipeline = pmacc::mp_list< |
| 113 | + * ColliderFromStruct<DT>, |
| 114 | + * ColliderFromStruct<DD>, |
| 115 | + * ColliderFromStruct<DHe3> |
| 116 | + * >; |
| 117 | + * |
| 118 | + * 3. Manual collider specification: |
| 119 | + * using FusionPipeline = pmacc::mp_list< |
| 120 | + * Collider<DT::CrossSectionInterpolator, |
| 121 | + * DT::reactants, |
| 122 | + * DT::products, |
| 123 | + * OneFilter<filter::All>> |
| 124 | + * >; |
| 125 | + */ |
| 126 | + |
| 127 | + |
| 128 | + //! Method 1: Using ColliderFromStruct (recommended - cleaner syntax) |
| 129 | + // using FusionPipeline = pmacc::mp_list<ColliderFromStruct<DT>>; |
| 130 | + |
| 131 | + //! Method 2: Manual collider specification |
| 132 | + // using FusionPipeline = pmacc::mp_list< |
| 133 | + // Collider<DT::CrossSectionInterpolator, DT::reactants, DT::products, OneFilter<filter::All>> |
| 134 | + // >; |
| 135 | + |
| 136 | + // empty pipeline - no fusion |
| 137 | + using FusionPipeline = pmacc::mp_list<>; |
| 138 | + |
| 139 | + //! =================================================================== |
| 140 | + //! SIMULATION PARAMETERS |
| 141 | + //! =================================================================== |
| 142 | + |
| 143 | + /** Memory Management Parameters */ |
| 144 | + |
| 145 | + /** Cell list chunk size for memory allocation |
| 146 | + * |
| 147 | + * Controls memory allocation strategy for collision algorithm. |
| 148 | + * The algorithm allocates multiples of this value to store |
| 149 | + * particle ID lists, reducing memory fragmentation on GPUs. |
| 150 | + * |
| 151 | + * Larger values = less fragmentation but more memory overhead |
| 152 | + */ |
| 153 | + constexpr uint32_t cellListChunkSize = TYPICAL_PARTICLES_PER_CELL; |
| 154 | + |
| 155 | + /** Product Weighting Parameters */ |
| 156 | + |
| 157 | + /** Minimum weighting threshold for fusion products |
| 158 | + * |
| 159 | + * When fusion product weighting <= productMinWeighting, the |
| 160 | + * multiplication factor is set to: |
| 161 | + * Fmult = max(1, productWeighting/productMinWeighting) |
| 162 | + * |
| 163 | + * Fmult is then used to scale the fusion probability: |
| 164 | + * larger Fmult means we produce more products with smaller weighting. |
| 165 | + * |
| 166 | + * note: This does not ensure that the product weighting is always above this threshold - see docs "Fusion |
| 167 | + * Particle Creation Algorithm" |
| 168 | + */ |
| 169 | + constexpr float_X productMinWeighting = 16.1; |
| 170 | + |
| 171 | + /** Maximum multiplication factor for products |
| 172 | + * the algorithm tries to use this multiplier and if the product weighting is smaller than |
| 173 | + * productMinWeighting, Fusion multiplier will be reduced. |
| 174 | + * |
| 175 | + * Usually set to a value ~10~100x less than the typical particle weighting in a cell. |
| 176 | + */ |
| 177 | + constexpr uint32_t maxFmult = 1e6; |
| 178 | + |
| 179 | + /** Debug and Control Flags */ |
| 180 | + |
| 181 | + /** Enable detailed fusion debugging output |
| 182 | + * When true: Prints detailed information about fusion events - warning: large output! |
| 183 | + */ |
| 184 | + constexpr bool debugFusion = false; |
| 185 | + |
| 186 | + /** Force fusion probability to 100% |
| 187 | + * All collision attempts result in fusion |
| 188 | + */ |
| 189 | + constexpr bool alwaysFuseQ = false; |
| 190 | + } // namespace fusion |
| 191 | + } // namespace particles |
| 192 | +} // namespace picongpu |
0 commit comments