Skip to content

Commit 981de19

Browse files
two ions and electron species
preview example
1 parent 987635a commit 981de19

14 files changed

+513
-92
lines changed

Diff for: examples/LaserWakefield/cmakeFlags

+1-10
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,7 @@
3030
# - increase by 1, no gaps
3131

3232
flags[0]="-DCUDA_ARCH=sm_20"
33-
flags[1]="-DCUDA_ARCH=sm_20 -DPARAM_OVERWRITES:LIST=-DPARAM_FIELDSOLVER=fieldSolverLehe;-DPARAM_PARTICLEPUSHER=Vay"
34-
flags[2]="-DCUDA_ARCH=sm_20 -DPARAM_OVERWRITES:LIST=-DPARAM_CURRENTSOLVER=Esirkepov;-DPARAM_PARTICLESHAPE=CIC"
35-
flags[3]="-DCUDA_ARCH=sm_20 -DPARAM_OVERWRITES:LIST=-DPARAM_CURRENTSOLVER=VillaBune;-DPARAM_PARTICLESHAPE=CIC"
36-
flags[4]="-DCUDA_ARCH=sm_20 -DPARAM_OVERWRITES:LIST=-DPARAM_PRECISION=precision64Bit"
37-
flags[5]="-DCUDA_ARCH=sm_35 -DPARAM_OVERWRITES:LIST=-DENABLE_CURRENT=0"
38-
flags[6]="-DCUDA_ARCH=sm_20 -DPARAM_OVERWRITES:LIST=-DPARAM_DIMENSION=DIM2"
39-
flags[7]="-DCUDA_ARCH=sm_20 -DPARAM_OVERWRITES:LIST=-DPARAM_CURRENTSOLVER=Esirkepov;-DPARAM_PARTICLESHAPE=CIC;-DPARAM_DIMENSION=DIM2"
40-
flags[8]="-DCUDA_ARCH=sm_20 -DPARAM_OVERWRITES:LIST=-DPARAM_PRECISION=precision64Bit;-DPARAM_DIMENSION=DIM2"
41-
flags[9]="-DCUDA_ARCH=sm_35 -DPARAM_OVERWRITES:LIST=-DENABLE_CURRENT=0;-DPARAM_DIMENSION=DIM2"
42-
flags[10]="-DCUDA_ARCH=sm_35 -DPARAM_OVERWRITES:LIST=-DPARAM_IONS=1;-DPARAM_IONIZATION=1"
33+
4334
################################################################################
4435
# execution
4536

Diff for: examples/LaserWakefield/include/simulation_defines/param/gasConfig.param

+26-19
Original file line numberDiff line numberDiff line change
@@ -43,39 +43,46 @@ const double GAS_DENSITY_SI = 1.e25;
4343
//##########################################################################
4444
namespace gasProfiles
4545
{
46-
struct GaussianParameter
47-
{
48-
/** Gas Formular:
49-
const float_X exponent = fabs((y - GAS_CENTER) / GAS_SIGMA);
50-
const float_X density = __expf(GAS_FACTOR*__powf(exponent, GAS_POWER));
5146

52-
takes GAS_CENTER_LEFT for y < GAS_CENTER_LEFT,
53-
GAS_CENTER_RIGHT for y > GAS_CENTER_RIGHT,
54-
and exponent = float_X(0.0) for GAS_CENTER_LEFT < y < GAS_CENTER_RIGHT */
55-
static const float_X GAS_FACTOR = -1.0;
56-
static const float_X GAS_POWER = 4.0;
47+
/** Middle of the constant sphere
48+
* unit: meter */
49+
CONST_VECTOR(float_64, simDim, SphereFlanksParam_center, 8.0e3, 8.0e3, 8.0e3);
5750

51+
struct SphereFlanksParam
52+
{
5853
/** height of vacuum area on top border
5954
* this vacuum is really important because of the laser initialization,
6055
* which is done in the first cell of the simulation
6156
* unit: cells */
62-
static const uint32_t VACUUM_CELLS_Y = 50;
57+
static const uint32_t vacuum_y_cells = 50;
6358

6459
struct SI
6560
{
66-
/** The central position of the gas distribution
61+
/** Radius of the constant sphere
6762
* unit: meter */
68-
static const float_64 GAS_CENTER_LEFT = 8.0e-5;
69-
static const float_64 GAS_CENTER_RIGHT = 10.0e-5;
70-
/** the distance from GAS_CENTER until the gas density decreases to its 1/e-th part
63+
static const float_64 r = 1.0e3;
64+
65+
/** Inner radius if you want to build a shell/ring
7166
* unit: meter */
72-
static const float_64 GAS_SIGMA_LEFT = 8.0e-5;
73-
static const float_64 GAS_SIGMA_RIGHT = 8.0e-5;
67+
static const float_64 ri = 0.0;
68+
69+
/** Middle of the constant sphere
70+
* unit: meter */
71+
const SphereFlanksParam_center_t center;
72+
73+
/** Parameters for the exponential slope
74+
* For radius > GAS_R_SI:
75+
* let radius' = radius - r
76+
* \rho = exp[ - radius' * exponent ]
77+
* unit: 1/m
78+
*/
79+
static const float_64 exponent = 1.0e-3;
80+
7481
};
7582
};
7683

77-
/* definition of GasGaussian*/
78-
typedef GaussianImpl<GaussianParameter> Gaussian;
84+
/* definition of gas sphere with flanks*/
85+
typedef SphereFlanksImpl<SphereFlanksParam> SphereFlanks;
7986

8087
}//namespace gasProfiles
8188

Diff for: examples/LaserWakefield/include/simulation_defines/param/particleConfig.param

+19-13
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,24 @@ namespace particles
4141
* unit: none */
4242
const float_X MIN_WEIGHTING = 10.0;
4343

44-
const uint32_t TYPICAL_PARTICLES_PER_CELL = 2;
44+
const uint32_t TYPICAL_PARTICLES_PER_CELL = 10;
45+
46+
namespace manipulators
47+
{
48+
struct SixTimesWeightingFunctor
49+
{
50+
template<typename T_Particle>
51+
DINLINE void operator()(T_Particle& particle)
52+
{
53+
particle[weighting_]*=float_X(6.0);
54+
}
55+
};
56+
57+
/* definition of SetDrift start*/
58+
typedef FreeImpl<SixTimesWeightingFunctor> SixTimesWeighting;
59+
60+
61+
} //namespace manipulators
4562

4663
namespace startPosition
4764
{
@@ -55,22 +72,11 @@ struct RandomParameter
5572
/* definition of random particle start*/
5673
typedef RandomImpl<RandomParameter> Random;
5774

58-
struct QuietParameter
59-
{
60-
/** Count of particles per cell per direction at initial state
61-
* unit: none */
62-
typedef typename mCT::shrinkTo<mCT::Int<1, TYPICAL_PARTICLES_PER_CELL, 1>, simDim>::type numParticlesPerDimension;
63-
};
64-
65-
/* definition of random particle start*/
66-
typedef QuietImpl<QuietParameter> Quiet;
67-
68-
6975
} //namespace startPosition
7076

7177
namespace manipulators
7278
{
73-
79+
7480
struct BoundElectronsWhenNeutral
7581
{
7682
/* space for attribute initial parameters */
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
/**
2+
* Copyright 2013 Axel Huebl, Heiko Burau, Rene Widera
3+
*
4+
* This file is part of PIConGPU.
5+
*
6+
* PIConGPU is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU General Public License as published by
8+
* the Free Software Foundation, either version 3 of the License, or
9+
* (at your option) any later version.
10+
*
11+
* PIConGPU is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU General Public License
17+
* along with PIConGPU.
18+
* If not, see <http://www.gnu.org/licenses/>.
19+
*/
20+
21+
22+
23+
#pragma once
24+
25+
namespace picongpu
26+
{
27+
const float_64 PI = 3.141592653589793238462643383279502884197169399;
28+
29+
/** Threshold used for calculations that want to separate between
30+
* high-precision formulas for relativistic and non-relativistic
31+
* use-cases, e.g. energy-binning algorithms. */
32+
const float_X GAMMA_THRESH = float_X(1.005);
33+
34+
namespace SI
35+
{
36+
/** unit: m / s */
37+
const float_64 SPEED_OF_LIGHT_SI = 2.99792458e8;
38+
39+
/** unit: N / A^2 */
40+
const float_64 MUE0_SI = PI * 4.e-7;
41+
/** unit: C / (V m) */
42+
const float_64 EPS0_SI = 1.0 / MUE0_SI / SPEED_OF_LIGHT_SI
43+
/ SPEED_OF_LIGHT_SI;
44+
45+
// Electron properties
46+
/** unit: kg */
47+
const float_64 ELECTRON_MASS_SI = 9.109382e-31;
48+
/** unit: C */
49+
const float_64 ELECTRON_CHARGE_SI = -1.602176e-19;
50+
51+
// Ion / Proton / Positron properties
52+
/** unit: kg */
53+
const float_64 ION_MASS_SI = 1.6726217e-27;
54+
55+
const float_64 ION_MASS_C_SI = 1.660538921-27;
56+
}
57+
58+
// converts
59+
//
60+
// UNIT_A to UNIT_B
61+
//
62+
// CONVENTION: WE DO NOT CONVERT FROM ANY STRANGE UNIT TO UNITLESS UNITS DIRECTLY!
63+
// convert steps: INPUT -> float_64_convert to SI -> float_64_convert to unitless
64+
// -> cast to float
65+
// WE DO NOT define "UNIT_ENERGY_keV" or something similar! Never!
66+
// Stay SI, stay free ;-)
67+
//
68+
// example:
69+
// // some particle physicist beloved input:
70+
// const float_64 An_Arbitrary_Energy_Input_keV = 30.0; // unit: keV
71+
//
72+
// // first convert to SI (because SI stays our standard Unit System!)
73+
// const float_64 An_Arbitrary_Energy_Input_SI = An_Arbitrary_Energy_Input_keV * UNITCONV_keV_to_Joule // unit: Joule
74+
//
75+
// // now the "real" convert to our internal unitless system
76+
// const float_X An_Arbitrary_Energy_Input = float_X(An_Arbitrary_Energy_Input_SI / UNIT_ENERGY) // unit: none
77+
//
78+
// As a convention, we DO NOT use the short track:
79+
// const float_64 An_Arbitrary_Energy_Input_keV = 30.0; // unit: keV
80+
// const float_X An_Arbitrary_Energy_Input = float_X(An_Arbitrary_Energy_Input_SI * UNITCONV_keV_to_Joule / UNIT_ENERGY) // unit: none
81+
//
82+
const float_64 UNITCONV_keV_to_Joule = 1.60217646e-16;
83+
const float_64 UNITCONV_Joule_to_keV = (1.0 / UNITCONV_keV_to_Joule);
84+
85+
}

Diff for: examples/LaserWakefield/include/simulation_defines/param/species.param

+2-12
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,7 @@
3434
/*enable (1) or disable (0) electrons*/
3535
#define ENABLE_ELECTRONS 1
3636
/*enable (1) or disable (0) ions*/
37-
#ifndef PARAM_IONS
38-
#define PARAM_IONS 0
39-
#endif
40-
41-
#define ENABLE_IONS PARAM_IONS
42-
43-
/*enable (1) or disable (0) ionization*/
44-
#ifndef PARAM_IONIZATION
45-
#define PARAM_IONIZATION 0
46-
#endif
47-
37+
#define ENABLE_IONS 1
4838

4939
namespace picongpu
5040
{
@@ -76,7 +66,7 @@ typedef FieldToParticleInterpolation<UsedParticleShape, AssignedTrilinearInterpo
7666
* without optimization (~4x slower and needs more shared memory)
7767
*/
7868
#ifndef PARAM_CURRENTSOLVER
79-
#define PARAM_CURRENTSOLVER Esirkepov
69+
#define PARAM_CURRENTSOLVER ZigZag
8070
#endif
8171
typedef currentSolver::PARAM_CURRENTSOLVER<UsedParticleShape> UsedParticleCurrentSolver;
8272

Diff for: examples/LaserWakefield/include/simulation_defines/param/speciesDefinition.param

+41-21
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ typedef
7575
typename MakeSeq<
7676
DefaultParticleAttributes,
7777
AttributMomentum_mt1,
78-
AttributRadiationFlag,
79-
boundElectrons
78+
AttributRadiationFlag
8079
>::type AttributeSeqIons;
8180

8281
/*########################### end particle attributes ########################*/
@@ -95,13 +94,22 @@ typedef bmpl::vector<
9594

9695
/* define species: electrons */
9796
typedef Particles<ParticleDescription<
98-
bmpl::string<'e'>,
97+
bmpl::string<'e','H'>,
9998
SuperCellSize,
10099
AttributeSeqElectrons,
101100
ParticleFlagsElectrons,
102101
typename MakeSeq<CommunicationId<PAR_ELECTRONS> >::type >
103102
> PIC_Electrons;
104103

104+
/* define species: electrons */
105+
typedef Particles<ParticleDescription<
106+
bmpl::string<'e','C'>,
107+
SuperCellSize,
108+
AttributeSeqElectrons,
109+
ParticleFlagsElectrons,
110+
typename MakeSeq<CommunicationId<PAR_ELECTRONS+1> >::type >
111+
> PIC_ElectronsC;
112+
105113
/*--------------------------- ions -------------------------------------------*/
106114

107115
/*! Specify (chemical) element
@@ -120,41 +128,51 @@ typedef Particles<ParticleDescription<
120128
struct Hydrogen
121129
{
122130
static const float_X numberOfProtons = 1.0;
123-
static const float_X numberOfNeutrons = 0.0;
131+
static const float_X numberOfNeutrons = 1.0;
124132
};
125133

126-
/*! Ionization Model Configuration ----------------------------------------
127-
*
128-
* For development purposes: ---------------------------------------------
129-
* - None : no particle is ionized
130-
* - BSI : simple barrier suppression ionization
131-
*
132-
* Usage: Add a flag to the list of particle flags that has the following structure
133-
*
134-
* ionizer<IonizationModel<Species2BCreated> >
135-
*/
136-
137-
typedef particles::shapes::CIC IonShape;
138134
typedef bmpl::vector<
139135
particlePusher<UsedParticlePusher>,
140136
shape<UsedParticleShape>,
141137
interpolation<UsedField2Particle>,
142138
current<UsedParticleCurrentSolver>,
143-
#if(PARAM_IONIZATION == 1)
144-
ionizer<particles::ionization::BSI<PIC_Electrons> >,
145-
#endif
146139
atomicNumbers<Hydrogen>
147140
> ParticleFlagsIons;
148141

149142
/* define species: ions */
150143
typedef Particles<ParticleDescription<
151-
bmpl::string<'i'>,
144+
bmpl::string<'i','H'>,
152145
SuperCellSize,
153146
AttributeSeqIons,
154147
ParticleFlagsIons,
155148
typename MakeSeq<CommunicationId<PAR_IONS> >::type >
156149
> PIC_Ions;
157150

151+
//##### carbon
152+
153+
struct Carbon
154+
{
155+
static const float_X numberOfProtons = 6.0;
156+
static const float_X numberOfNeutrons = 6.0;
157+
};
158+
typedef bmpl::vector<
159+
particlePusher<UsedParticlePusher>,
160+
shape<UsedParticleShape>,
161+
interpolation<UsedField2Particle>,
162+
current<UsedParticleCurrentSolver>,
163+
atomicNumbers<Carbon>
164+
> ParticleFlagsIonsC;
165+
166+
/* define species: ions */
167+
typedef Particles<ParticleDescription<
168+
bmpl::string<'i','C'>,
169+
SuperCellSize,
170+
AttributeSeqIons,
171+
ParticleFlagsIonsC,
172+
typename MakeSeq<CommunicationId<PAR_ELECTRONS+2> >::type >
173+
> PIC_IonsC;
174+
175+
158176
/*########################### end species ####################################*/
159177

160178

@@ -175,7 +193,9 @@ PIC_Ions
175193

176194
typedef typename MakeSeq<
177195
Species1,
178-
Species2
196+
Species2,
197+
PIC_IonsC,
198+
PIC_ElectronsC
179199
>::type VectorAllSpecies;
180200

181201

Diff for: examples/LaserWakefield/include/simulation_defines/param/speciesInitialization.param

+8-13
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,14 @@ namespace picongpu
3232
* the functors are called in order (from first to last functor)
3333
*/
3434
typedef mpl::vector<
35-
#if (PARAM_IONIZATION == 0)
36-
37-
particles::CreateGas<gasProfiles::Gaussian,particles::startPosition::Random,PIC_Electrons>
38-
#if (ENABLE_IONS == 1)
39-
,particles::CloneSpecies<PIC_Electrons,PIC_Ions>
40-
#endif
41-
42-
#else
43-
44-
particles::CreateGas<gasProfiles::Gaussian,particles::startPosition::Random,PIC_Ions>,
45-
particles::Manipulate<particles::manipulators::SetBoundElectrons,PIC_Ions>
46-
47-
#endif
35+
particles::CreateGas<gasProfiles::SphereFlanks,particles::startPosition::Random,PIC_IonsC>,
36+
particles::CloneSpecies<PIC_IonsC,PIC_Ions>,
37+
particles::CloneSpecies<PIC_IonsC,PIC_Ions>,
38+
particles::CloneSpecies<PIC_IonsC,PIC_Ions>,
39+
particles::Manipulate<particles::manipulators::RandomPosImpl<>,PIC_Ions>,
40+
particles::CloneSpecies<PIC_Ions,PIC_Electrons>,
41+
particles::CloneSpecies<PIC_IonsC,PIC_ElectronsC>,
42+
particles::Manipulate<particles::manipulators::SixTimesWeighting,PIC_ElectronsC>
4843
> InitPipeline;
4944

5045
} //namespace picongpu

0 commit comments

Comments
 (0)