Skip to content

Commit efa8259

Browse files
committed
Merge branch 'DDfusion' into develop
2 parents e84f6b7 + 45bb3d7 commit efa8259

27 files changed

+1066
-252
lines changed

.DS_Store

-10 KB
Binary file not shown.

.gitlab-ci.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ compile:
66
stage: compile
77
only:
88
- develop
9-
- smilei_Poisson_AM
9+
- DDfusion
1010

1111
script:
1212
# Force workdir cleaning in case of retried
@@ -28,7 +28,7 @@ makerun1D:
2828
stage: makerun
2929
only:
3030
- develop
31-
- smilei_Poisson_AM
31+
- DDfusion
3232

3333
script:
3434
# Move in test dir
@@ -40,7 +40,7 @@ makerun2D:
4040
stage: makerun
4141
only:
4242
- develop
43-
- smilei_Poisson_AM
43+
- DDfusion
4444

4545
script:
4646
# Move in test dir
@@ -52,7 +52,7 @@ makerun3D:
5252
stage: makerun
5353
only:
5454
- develop
55-
- smilei_Poisson_AM
55+
- DDfusion
5656

5757
script:
5858
# Move in test dir
@@ -64,7 +64,7 @@ makerunAM:
6464
stage: makerun
6565
only:
6666
- develop
67-
- smilei_Poisson_AM
67+
- DDfusion
6868

6969
script:
7070
# Move in test dir
@@ -76,7 +76,7 @@ makerunV:
7676
stage: makerun
7777
only:
7878
- develop
79-
- smilei_Poisson_AM
79+
- DDfusion
8080

8181
script:
8282
# Move in test dir
@@ -88,7 +88,7 @@ makerunCollisions:
8888
stage: makerun
8989
only:
9090
- develop
91-
- smilei_Poisson_AM
91+
- DDfusion
9292

9393
script:
9494
# Move in test dir
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
# ---------------------------------------------
2+
# SIMULATION PARAMETERS FOR THE PIC-CODE SMILEI
3+
# ---------------------------------------------
4+
5+
import math
6+
L0 = 2.*math.pi # conversion from normalization length to wavelength
7+
8+
9+
Main(
10+
geometry = "1Dcartesian",
11+
12+
number_of_patches = [ 8 ],
13+
14+
interpolation_order = 2,
15+
16+
timestep = 0.05 * L0,
17+
simulation_time = 10 * L0,
18+
19+
20+
time_fields_frozen = 100000000000.,
21+
22+
cell_length = [5.*L0],
23+
grid_length = [1600.*L0],
24+
25+
EM_boundary_conditions = [ ["periodic"] ],
26+
27+
reference_angular_frequency_SI = L0 * 3e8 /1.e-6,
28+
29+
random_seed = smilei_mpi_rank
30+
)
31+
32+
33+
i = 0
34+
for Da_nppc, Db_nppc, v in [
35+
[100, 100, 0.1],
36+
[100, 10, 0.1],
37+
[10 , 100, 0.1],
38+
[100, 100, 0.00082],
39+
[100, 100, 0.00201],
40+
[100, 100, 0.00493],
41+
[100, 100, 0.01209],
42+
[100, 100, 0.02960],
43+
[100, 100, 0.07236],
44+
[100, 100, 0.17545],
45+
[100, 100, 0.40641],
46+
[100, 100, 0.76966],
47+
[100, 100, 0.97376],
48+
]:
49+
50+
Da = "Da_"+str(i)
51+
Db = "Db_"+str(i)
52+
He = "He_"+str(i)
53+
54+
Species(
55+
name = Da,
56+
position_initialization = "regular",
57+
momentum_initialization = "maxwell-juettner",
58+
particles_per_cell= Da_nppc,
59+
atomic_number = 1,
60+
mass = 3870.5,
61+
charge = 0.,
62+
number_density = 100.,
63+
mean_velocity = [v, 0., 0.],
64+
temperature = [0.0000001]*3,
65+
time_frozen = 100000000.0,
66+
boundary_conditions = [
67+
["periodic", "periodic"],
68+
],
69+
)
70+
71+
Species(
72+
name = Db,
73+
position_initialization = "regular",
74+
momentum_initialization = "maxwell-juettner",
75+
particles_per_cell= Db_nppc,
76+
atomic_number = 1,
77+
mass = 3870.5,
78+
charge = 0.,
79+
number_density = 100.,
80+
mean_velocity = [-v, 0., 0.],
81+
temperature = [0.00000001]*3,
82+
time_frozen = 100000000.0,
83+
boundary_conditions = [
84+
["periodic", "periodic"],
85+
],
86+
)
87+
88+
Species(
89+
name = He,
90+
position_initialization = "regular",
91+
momentum_initialization = "maxwell-juettner",
92+
particles_per_cell= 0,
93+
atomic_number = 2,
94+
mass = 5497.9,
95+
charge = 0.,
96+
number_density = 0.,
97+
time_frozen = 100000000.0,
98+
boundary_conditions = [
99+
["periodic", "periodic"],
100+
],
101+
)
102+
103+
Collisions(
104+
species1 = [Da],
105+
species2 = [Db],
106+
coulomb_log = 0.001,
107+
nuclear_reaction = [He],
108+
debug_every = 10
109+
)
110+
111+
DiagParticleBinning(
112+
deposited_quantity = "weight",
113+
every = 20,
114+
species = [He],
115+
axes = [
116+
["x", 0, Main.grid_length[0], 1]
117+
]
118+
)
119+
120+
DiagParticleBinning(
121+
deposited_quantity = "weight",
122+
every = 20,
123+
species = [Da, Db],
124+
axes = [
125+
["x", 0, Main.grid_length[0], 1]
126+
]
127+
)
128+
129+
i+=1
130+
131+
DiagScalar(
132+
every = 50,
133+
)

doc/Sphinx/namelist.rst

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1961,6 +1961,7 @@ Collisions
19611961
coulomb_log = 5.,
19621962
debug_every = 1000,
19631963
ionizing = False,
1964+
# nuclear_reaction = [],
19641965
)
19651966

19661967

@@ -2013,7 +2014,7 @@ Collisions
20132014

20142015
.. py:data:: ionizing
20152016
2016-
:default: False
2017+
:default: ``False``
20172018

20182019
:ref:`Collisional ionization <CollIonization>` is set when this parameter is not ``False``.
20192020
It can either be set to the name of a pre-existing electron species (where the ionized
@@ -2023,7 +2024,36 @@ Collisions
20232024
One of the species groups must be all electrons (:py:data:`mass` = 1), and the other
20242025
one all ions of the same :py:data:`atomic_number`.
20252026

2027+
.. rst-class:: experimental
2028+
2029+
.. py:data:: nuclear_reaction
2030+
2031+
:type: a list of strings
2032+
:default: ``None`` (no nuclear reaction)
2033+
2034+
A list of the species names for the products of nuclear reactions
2035+
that may occur during collisions. You may omit product species if they are not necessary
2036+
for the simulation.
2037+
2038+
All members of :py:data:`species1` must be the same type of atoms, which is automatically
2039+
recognized by their :py:data:`mass` and :py:data:`atomic_number`. The same applies for
2040+
all members of :py:data:`species2`.
2041+
2042+
In the current version, only the reaction D(d,n)He³ is available.
2043+
2044+
.. rst-class:: experimental
2045+
2046+
.. py:data:: nuclear_reaction_multiplier
2047+
2048+
:type: a float
2049+
:default: 0. (automatically adjusted)
20262050

2051+
The rate multiplier for nuclear reactions. It is a positive number that artificially
2052+
increases the occurence of reactions so that a good statistics is obtained. The number
2053+
of actual reaction products is adjusted by changing their weights in order to provide
2054+
a physically correct number of reactions. Leave this number to ``0.`` for an automatic
2055+
rate multiplier: the final number of produced macro-particles will be of the same order
2056+
as that of reactants.
20272057

20282058

20292059

src/Checkpoint/Checkpoint.cpp

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "DiagnosticScreen.h"
2727
#include "DiagnosticTrack.h"
2828
#include "LaserEnvelope.h"
29+
#include "Collisions.h"
2930

3031
using namespace std;
3132

@@ -255,7 +256,7 @@ void Checkpoint::dumpAll( VectorPatch &vecPatches, unsigned int itime, SmileiMP
255256
string patchName=Tools::merge( "patch-", patch_name.str() );
256257
hid_t patch_gid = H5::group( fid, patchName.c_str() );
257258

258-
dumpPatch( vecPatches( ipatch )->EMfields, vecPatches( ipatch )->vecSpecies, params, patch_gid );
259+
dumpPatch( vecPatches( ipatch )->EMfields, vecPatches( ipatch )->vecSpecies, vecPatches( ipatch )->vecCollisions, params, patch_gid );
259260

260261
// Random number generator state
261262
H5::attr( patch_gid, "xorshift32_state", vecPatches( ipatch )->xorshift32_state );
@@ -283,7 +284,7 @@ void Checkpoint::dumpAll( VectorPatch &vecPatches, unsigned int itime, SmileiMP
283284

284285
}
285286

286-
void Checkpoint::dumpPatch( ElectroMagn *EMfields, std::vector<Species *> vecSpecies, Params &params, hid_t patch_gid )
287+
void Checkpoint::dumpPatch( ElectroMagn *EMfields, std::vector<Species *> vecSpecies, std::vector<Collisions *> &vecCollisions, Params &params, hid_t patch_gid )
287288
{
288289
if ( params.geometry != "AMcylindrical" ) {
289290
dumpFieldsPerProc( patch_gid, EMfields->Ex_ );
@@ -442,6 +443,13 @@ void Checkpoint::dumpPatch( ElectroMagn *EMfields, std::vector<Species *> vecSpe
442443
H5Gclose( gid );
443444

444445
} // End for ispec
446+
447+
// Manage some collisions parameters
448+
std::vector<double> rate_multiplier( vecCollisions.size() );
449+
for( unsigned int icoll = 0; icoll<vecCollisions.size(); icoll++ ) {
450+
rate_multiplier[icoll] = vecCollisions[icoll]->NuclearReaction->rate_multiplier_;
451+
}
452+
H5::vect( patch_gid, "collisions_rate_multiplier", rate_multiplier );
445453
};
446454

447455

@@ -539,7 +547,7 @@ void Checkpoint::restartAll( VectorPatch &vecPatches, SmileiMPI *smpi, SimWindo
539547
string patchName=Tools::merge( "patch-", patch_name.str() );
540548
hid_t patch_gid = H5Gopen( fid, patchName.c_str(), H5P_DEFAULT );
541549

542-
restartPatch( vecPatches( ipatch )->EMfields, vecPatches( ipatch )->vecSpecies, params, patch_gid );
550+
restartPatch( vecPatches( ipatch )->EMfields, vecPatches( ipatch )->vecSpecies, vecPatches( ipatch )->vecCollisions, params, patch_gid );
543551

544552
// Random number generator state
545553
H5::getAttr( patch_gid, "xorshift32_state", vecPatches( ipatch )->xorshift32_state );
@@ -566,7 +574,7 @@ void Checkpoint::restartAll( VectorPatch &vecPatches, SmileiMPI *smpi, SimWindo
566574
}
567575

568576

569-
void Checkpoint::restartPatch( ElectroMagn *EMfields, std::vector<Species *> &vecSpecies, Params &params, hid_t patch_gid )
577+
void Checkpoint::restartPatch( ElectroMagn *EMfields, std::vector<Species *> &vecSpecies, std::vector<Collisions *> &vecCollisions, Params &params, hid_t patch_gid )
570578
{
571579
if ( params.geometry != "AMcylindrical" ) {
572580
restartFieldsPerProc( patch_gid, EMfields->Ex_ );
@@ -754,6 +762,14 @@ void Checkpoint::restartPatch( ElectroMagn *EMfields, std::vector<Species *> &ve
754762
H5Gclose( gid );
755763
}
756764

765+
// Manage some collisions parameters
766+
if( H5::getVectSize( patch_gid, "collisions_rate_multiplier" ) > 0 ) {
767+
std::vector<double> rate_multiplier;
768+
H5::getVect( patch_gid, "collisions_rate_multiplier", rate_multiplier, true );
769+
for( unsigned int icoll = 0; icoll<rate_multiplier.size(); icoll++ ) {
770+
vecCollisions[icoll]->NuclearReaction->rate_multiplier_ = rate_multiplier[icoll];
771+
}
772+
}
757773
}
758774

759775
void Checkpoint::dumpFieldsPerProc( hid_t fid, Field *field )

src/Checkpoint/Checkpoint.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class Field;
2323
class cField;
2424
class Species;
2525
class VectorPatch;
26+
class Collisions;
2627

2728
#include <csignal>
2829

@@ -42,7 +43,7 @@ class Checkpoint
4243
//! restart everything to file per processor
4344
void readPatchDistribution( SmileiMPI *smpi, SimWindow *simWin );
4445
void restartAll( VectorPatch &vecPatches, SmileiMPI *smpi, SimWindow *simWin, Params &params, OpenPMDparams &openPMD );
45-
void restartPatch( ElectroMagn *EMfields, std::vector<Species *> &vecSpecies, Params &params, hid_t patch_gid );
46+
void restartPatch( ElectroMagn *EMfields, std::vector<Species *> &vecSpecies, std::vector<Collisions *> &vecCollisions, Params &params, hid_t patch_gid );
4647

4748
//! restart field per proc
4849
void restartFieldsPerProc( hid_t fid, Field *field );
@@ -58,7 +59,7 @@ class Checkpoint
5859

5960
//! dump everything to file per processor
6061
void dumpAll( VectorPatch &vecPatches, unsigned int itime, SmileiMPI *smpi, SimWindow *simWin, Params &params );
61-
void dumpPatch( ElectroMagn *EMfields, std::vector<Species *> vecSpecies, Params &params, hid_t patch_gid );
62+
void dumpPatch( ElectroMagn *EMfields, std::vector<Species *> vecSpecies, std::vector<Collisions *> &vecCollisions, Params &params, hid_t patch_gid );
6263

6364
//! incremental number of times we've done a dump
6465
unsigned int dump_number;

0 commit comments

Comments
 (0)