aboutsummaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/Particles/MultiParticleContainer.cpp78
-rw-r--r--Source/QED/BreitWheelerEngineInnards.H2
-rw-r--r--Source/QED/BreitWheelerEngineWrapper.H55
-rw-r--r--Source/QED/BreitWheelerEngineWrapper.cpp5
-rw-r--r--Source/QED/QuantumSyncEngineWrapper.H48
5 files changed, 145 insertions, 43 deletions
diff --git a/Source/Particles/MultiParticleContainer.cpp b/Source/Particles/MultiParticleContainer.cpp
index 8d64c9d6f..fca22daa2 100644
--- a/Source/Particles/MultiParticleContainer.cpp
+++ b/Source/Particles/MultiParticleContainer.cpp
@@ -728,6 +728,9 @@ MultiParticleContainer::ParseQuantumSyncParams ()
ParmParse pp("qed_qs");
+ // Engine paramenter: chi_part_min is the minium chi parameter to be
+ // considered by the engine. If a lepton has chi < chi_part_min,
+ // the optical depth is not evolved and photon generation is ignored
pp.query("chi_min", ctrl.chi_part_min);
//Only temporary for test purposes, will be removed
@@ -740,17 +743,52 @@ MultiParticleContainer::ParseQuantumSyncParams ()
pp.query("generate_table", generate_table);
if(generate_table){
int t_int = 0;
+
+ //==Table parameters==
+
+ //--- sub-table 1 (1D)
+ //These parameters are used to pre-compute a function
+ //which appears in the evolution of the optical depth
+
+ //Minimun chi for the table. If a lepton has chi < chi_part_tdndt_min,
+ ///chi is considered as it were equal to chi_part_tdndt_min
pp.query("tab_dndt_chi_min", ctrl.chi_part_tdndt_min);
+
+ //Maximum chi for the table. If a lepton has chi > chi_part_tdndt_max,
+ ///chi is considered as it were equal to chi_part_tdndt_max
pp.query("tab_dndt_chi_max", ctrl.chi_part_tdndt_max);
+
+ //How many points should be used for chi in the table
pp.query("tab_dndt_how_many", t_int);
ctrl.chi_part_tdndt_how_many= t_int;
+ //------
+
+ //--- sub-table 2 (2D)
+ //These parameters are used to pre-compute a function
+ //which is used to extract the properties of the generated
+ //photons.
+
+ //Minimun chi for the table. If a lepton has chi < chi_part_tem_min,
+ ///chi is considered as it were equal to chi_part_tem_min
pp.query("tab_em_chi_min", ctrl.chi_part_tem_min);
+
+ //Maximum chi for the table. If a lepton has chi > chi_part_tem_max,
+ ///chi is considered as it were equal to chi_part_tem_max
pp.query("tab_em_chi_max", ctrl.chi_part_tem_max);
+
+ //How many points should be used for chi in the table
pp.query("tab_em_chi_how_many", t_int);
ctrl.chi_part_tem_how_many = t_int;
+
+ //The other axis of the table is a cumulative probability distribution
+ //(corresponding to different energies of the generated particles)
+ //This parameter is the number of different points to consider
pp.query("tab_em_prob_how_many", t_int);
ctrl.prob_tem_how_many = t_int;
+ //====================
+
pp.query("save_table_in", table_name);
+
}
std::string load_table_name;
@@ -786,6 +824,9 @@ MultiParticleContainer::ParseBreitWheelerParams ()
ParmParse pp("qed_bw");
+ // Engine paramenter: chi_phot_min is the minium chi parameter to be
+ // considered by the engine. If a photon has chi < chi_phot_min,
+ // the optical depth is not evolved and pair generation is ignored
pp.query("chi_min", ctrl.chi_phot_min);
//Only temporary for test purposes, will be removed
@@ -797,17 +838,52 @@ MultiParticleContainer::ParseBreitWheelerParams ()
pp.query("generate_table", generate_table);
if(generate_table){
+
int t_int;
+
+ //==Table parameters==
+
+ //--- sub-table 1 (1D)
+ //These parameters are used to pre-compute a function
+ //which appears in the evolution of the optical depth
+
+ //Minimun chi for the table. If a photon has chi < chi_phot_tdndt_min,
+ //an analytical approximation is used.
pp.query("tab_dndt_chi_min", ctrl.chi_phot_tdndt_min);
+
+ //Maximum chi for the table. If a photon has chi > chi_phot_tdndt_min,
+ //an analytical approximation is used.
pp.query("tab_dndt_chi_max", ctrl.chi_phot_tdndt_max);
+
+ //How many points should be used for chi in the table
pp.query("tab_dndt_how_many", t_int);
ctrl.chi_phot_tdndt_how_many = t_int;
+ //------
+
+ //--- sub-table 2 (2D)
+ //These parameters are used to pre-compute a function
+ //which is used to extract the properties of the generated
+ //particles.
+
+ //Minimun chi for the table. If a photon has chi < chi_phot_tpair_min
+ //chi is considered as it were equal to chi_phot_tpair_min
pp.query("tab_pair_chi_min", ctrl.chi_phot_tpair_min);
+
+ //Maximum chi for the table. If a photon has chi > chi_phot_tpair_max
+ //chi is considered as it were equal to chi_phot_tpair_max
pp.query("tab_pair_chi_max", ctrl.chi_phot_tpair_max);
+
+ //How many points should be used for chi in the table
pp.query("tab_pair_chi_how_many", t_int);
ctrl.chi_phot_tpair_how_many = t_int;
- pp.query("tab_pair_prob_how_many", t_int);
+
+ //The other axis of the table is the fraction of the initial energy
+ //'taken away' by the most energetic particle of the pair.
+ //This parameter is the number of different fractions to consider
+ pp.query("tab_pair_frac_how_many", t_int);
ctrl.chi_frac_tpair_how_many = t_int;
+ //====================
+
pp.query("save_table_in", table_name);
}
diff --git a/Source/QED/BreitWheelerEngineInnards.H b/Source/QED/BreitWheelerEngineInnards.H
index 6c5edcff6..2a7026989 100644
--- a/Source/QED/BreitWheelerEngineInnards.H
+++ b/Source/QED/BreitWheelerEngineInnards.H
@@ -19,7 +19,7 @@ struct BreitWheelerEngineInnards
// Control parameters (a POD struct)
picsar::multi_physics::breit_wheeler_engine_ctrl<amrex::Real> ctrl;
- //Lookup table data (should stay on GPU)
+ //Lookup table data
amrex::Gpu::ManagedVector<amrex::Real> TTfunc_coords;
amrex::Gpu::ManagedVector<amrex::Real> TTfunc_data;
diff --git a/Source/QED/BreitWheelerEngineWrapper.H b/Source/QED/BreitWheelerEngineWrapper.H
index d2cb12ff1..1033ff7c9 100644
--- a/Source/QED/BreitWheelerEngineWrapper.H
+++ b/Source/QED/BreitWheelerEngineWrapper.H
@@ -84,17 +84,12 @@ public:
* lookup_table uses non-owning vectors under the hood. So no new data
* allocations should be triggered on GPU
*/
- BreitWheelerEvolveOpticalDepth(
- const PicsarBreitWheelerCtrl t_ctrl,
- size_t TTfunc_size,
- amrex::Real* TTfunc_coords,
- amrex::Real* TTfunc_data):
- m_ctrl{t_ctrl},
- m_lookup_table{
- TTfunc_size,
- TTfunc_coords,
- TTfunc_data
- }{};
+ BreitWheelerEvolveOpticalDepth(BreitWheelerEngineInnards& r_innards):
+ m_ctrl{r_innards.ctrl},
+ m_TTfunc_size{r_innards.TTfunc_coords.size()},
+ m_p_TTfunc_coords{r_innards.TTfunc_coords.dataPtr()},
+ m_p_TTfunc_data{r_innards.TTfunc_data.dataPtr()}
+ {};
/**
* Evolves the optical depth. It can be used on GPU.
@@ -127,7 +122,10 @@ public:
dt, opt_depth,
has_event_happened, unused_event_time,
m_dummy_lambda,
- m_lookup_table,
+ picsar::multi_physics::lookup_1d<amrex::Real>{
+ m_TTfunc_size,
+ m_p_TTfunc_coords,
+ m_p_TTfunc_data},
m_ctrl);
return has_event_happened;
@@ -138,7 +136,11 @@ private:
const amrex::Real m_dummy_lambda{1.0};
const PicsarBreitWheelerCtrl m_ctrl;
- const picsar::multi_physics::lookup_1d<amrex::Real> m_lookup_table;
+
+ //lookup table data
+ size_t m_TTfunc_size;
+ amrex::Real* m_p_TTfunc_coords;
+ amrex::Real* m_p_TTfunc_data;
};
/**
@@ -157,12 +159,11 @@ public:
BreitWheelerGeneratePairs(
BreitWheelerEngineInnards& r_innards):
m_ctrl{r_innards.ctrl},
- m_lookup_table{
- r_innards.cum_distrib_coords_1.size(),
- r_innards.cum_distrib_coords_1.data(),
- r_innards.cum_distrib_coords_2.size(),
- r_innards.cum_distrib_coords_2.data(),
- r_innards.cum_distrib_data.data()
+ m_cum_distrib_coords_1_size{r_innards.cum_distrib_coords_1.size()},
+ m_cum_distrib_coords_2_size{r_innards.cum_distrib_coords_2.size()},
+ m_p_distrib_coords_1{r_innards.cum_distrib_coords_1.data()},
+ m_p_distrib_coords_2{r_innards.cum_distrib_coords_2.data()},
+ m_p_cum_distrib_data{r_innards.cum_distrib_data.data()
}{};
/**
@@ -203,7 +204,13 @@ public:
p_px, p_py, p_pz,
e_weight, p_weight,
m_dummy_lambda,
- m_lookup_table,
+ picsar::multi_physics::lookup_2d<amrex::Real>{
+ m_cum_distrib_coords_1_size,
+ m_p_distrib_coords_1,
+ m_cum_distrib_coords_2_size,
+ m_p_distrib_coords_2,
+ m_p_cum_distrib_data
+ },
m_ctrl,
rand_zero_one_minus_epsi.data());
}
@@ -213,7 +220,13 @@ private:
const amrex::Real m_dummy_lambda{1.0};
const PicsarBreitWheelerCtrl m_ctrl;
- const picsar::multi_physics::lookup_2d<amrex::Real> m_lookup_table;
+
+ //lookup table data
+ size_t m_cum_distrib_coords_1_size;
+ size_t m_cum_distrib_coords_2_size;
+ amrex::Real* m_p_distrib_coords_1;
+ amrex::Real* m_p_distrib_coords_2;
+ amrex::Real* m_p_cum_distrib_data;
};
// Factory class =============================
diff --git a/Source/QED/BreitWheelerEngineWrapper.cpp b/Source/QED/BreitWheelerEngineWrapper.cpp
index a6d3d0108..42953c97f 100644
--- a/Source/QED/BreitWheelerEngineWrapper.cpp
+++ b/Source/QED/BreitWheelerEngineWrapper.cpp
@@ -26,10 +26,7 @@ BreitWheelerEngine::build_evolve_functor ()
{
AMREX_ALWAYS_ASSERT(m_lookup_tables_initialized);
- return BreitWheelerEvolveOpticalDepth(m_innards.ctrl,
- m_innards.TTfunc_coords.size(),
- m_innards.TTfunc_coords.dataPtr(),
- m_innards.TTfunc_data.dataPtr() );
+ return BreitWheelerEvolveOpticalDepth(m_innards);
}
BreitWheelerGeneratePairs
diff --git a/Source/QED/QuantumSyncEngineWrapper.H b/Source/QED/QuantumSyncEngineWrapper.H
index 1201dec32..1a6ffe4f3 100644
--- a/Source/QED/QuantumSyncEngineWrapper.H
+++ b/Source/QED/QuantumSyncEngineWrapper.H
@@ -87,11 +87,10 @@ public:
QuantumSynchrotronEvolveOpticalDepth(
QuantumSynchrotronEngineInnards& r_innards):
m_ctrl{r_innards.ctrl},
- m_lookup_table{
- r_innards.KKfunc_data.size(),
- r_innards.KKfunc_coords.data(),
- r_innards.KKfunc_data.data()
- }{};
+ m_KKfunc_size{r_innards.KKfunc_coords.size()},
+ m_p_KKfunc_coords{r_innards.KKfunc_coords.dataPtr()},
+ m_p_KKfunc_data{r_innards.KKfunc_data.dataPtr()}
+ {};
/**
* Evolves the optical depth. It can be used on GPU.
@@ -124,7 +123,10 @@ public:
dt, opt_depth,
has_event_happened, unused_event_time,
m_dummy_lambda,
- m_lookup_table,
+ picsar::multi_physics::lookup_1d<amrex::Real>{
+ m_KKfunc_size,
+ m_p_KKfunc_coords,
+ m_p_KKfunc_data},
m_ctrl);
return has_event_happened;
@@ -135,7 +137,11 @@ private:
const amrex::Real m_dummy_lambda{1.0};
const PicsarQuantumSynchrotronCtrl m_ctrl;
- const picsar::multi_physics::lookup_1d<amrex::Real> m_lookup_table;
+
+ //lookup table data
+ size_t m_KKfunc_size;
+ amrex::Real* m_p_KKfunc_coords;
+ amrex::Real* m_p_KKfunc_data;
};
/**
@@ -154,13 +160,12 @@ public:
QuantumSynchrotronGeneratePhotonAndUpdateMomentum(
QuantumSynchrotronEngineInnards& r_innards):
m_ctrl{r_innards.ctrl},
- m_lookup_table{
- r_innards.cum_distrib_coords_1.size(),
- r_innards.cum_distrib_coords_1.data(),
- r_innards.cum_distrib_coords_2.size(),
- r_innards.cum_distrib_coords_2.data(),
- r_innards.cum_distrib_data.data()
- }{};
+ m_cum_distrib_coords_1_size{r_innards.cum_distrib_coords_1.size()},
+ m_cum_distrib_coords_2_size{r_innards.cum_distrib_coords_2.size()},
+ m_p_distrib_coords_1{r_innards.cum_distrib_coords_1.data()},
+ m_p_distrib_coords_2{r_innards.cum_distrib_coords_2.data()},
+ m_p_cum_distrib_data{r_innards.cum_distrib_data.data()}
+ {};
/**
* Generates sampling (template parameter) photons according to Quantum Synchrotron process.
@@ -197,7 +202,12 @@ public:
g_px, g_py, g_pz,
g_weight,
m_dummy_lambda,
- m_lookup_table,
+ picsar::multi_physics::lookup_2d<amrex::Real>{
+ m_cum_distrib_coords_1_size,
+ m_p_distrib_coords_1,
+ m_cum_distrib_coords_2_size,
+ m_p_distrib_coords_2,
+ m_p_cum_distrib_data},
m_ctrl,
rand_zero_one_minus_epsi.data());
}
@@ -207,7 +217,13 @@ private:
const amrex::Real m_dummy_lambda{1.0};
const PicsarQuantumSynchrotronCtrl m_ctrl;
- const picsar::multi_physics::lookup_2d<amrex::Real> m_lookup_table;
+
+ //lookup table data
+ size_t m_cum_distrib_coords_1_size;
+ size_t m_cum_distrib_coords_2_size;
+ amrex::Real* m_p_distrib_coords_1;
+ amrex::Real* m_p_distrib_coords_2;
+ amrex::Real* m_p_cum_distrib_data;
};
// Factory class =============================