Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bunch Example: Add Single e- Setup #1755

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion examples/Bunch/cmakeFlags
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
flags[0]="-DCUDA_ARCH=35"
flags[1]="-DCUDA_ARCH=35 -DPARAM_OVERWRITES:LIST=-DPARAM_INCLUDE_FIELDBACKGROUND=true"
flags[2]="-DCUDA_ARCH=35 -DPARAM_OVERWRITES:LIST=-DPARAM_INCLUDE_FIELDBACKGROUND=true;-DPARAM_DIMENSION=DIM2"
flags[3]="-DCUDA_ARCH=35 -DPARAM_OVERWRITES:LIST=-DENABLE_SYNCHROTRON_PHOTONS=1"
flags[3]="-DCUDA_ARCH=35 -DPARAM_OVERWRITES:LIST=-DPARAM_SINGLE_PARTICLE=true"
flags[4]="-DCUDA_ARCH=35 -DPARAM_OVERWRITES:LIST=-DENABLE_SYNCHROTRON_PHOTONS=1"

################################################################################
# execution
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,22 @@ namespace SI
* to this value.
*
* unit: ELEMENTS/m^3
*
*/
#ifdef PARAM_SINGLE_PARTICLE
/* one particle per cell with weighting 1.0 */
constexpr float_64 BASE_DENSITY_SI =
1.0 /
( CELL_WIDTH_SI * CELL_HEIGHT_SI * CELL_DEPTH_SI );
#else
constexpr float_64 BASE_DENSITY_SI = 1.e25;
#endif

}

namespace densityProfiles
{

PMACC_STRUCT(GaussianCloudParam,
/** Profile Formula:
* exponent = |globalCellPos - center| / sigma
Expand All @@ -69,7 +79,57 @@ namespace densityProfiles
(PMACC_C_VECTOR_DIM(float_64, simDim, sigma_SI, 6.0e-6, 6.0e-6, 6.0e-6))
); /* struct GaussianCloudParam */

/* definition of cloud density profile */
typedef GaussianCloudImpl<GaussianCloudParam> GaussianCloud;
/* definition of cloud profile */
typedef GaussianCloudImpl< GaussianCloudParam > GaussianCloud;


struct FreeFormulaFunctor
{
/** This formula uses SI quantities only
*
* The profile will be multiplied by BASE_DENSITY.
*
* @param position_SI total offset including all slides [in meter]
* @param cellSize_SI cell sizes [in meter]
*
* @return float_X density [normalized to 1.0]
*/
HDINLINE float_X operator()(
const floatD_64& position_SI,
const float3_64& cellSize_SI
)
{
/* add particle in cell at center of Gaussian Cloud profile */
const float3_64 position_start_SI( 1.024e-5, 9.072e-5, 1.024e-5 );

/* from all cells ... */
const PMacc::math::UInt64< simDim > cell_id( position_SI / cellSize_SI.shrink< simDim >() );

/* ... we calculate the corresponding "center" cell to init the particle in ... */
const PMacc::math::UInt64< simDim > cell_start(
precisionCast< uint64_t >(
math::floor(
position_start_SI.shrink< simDim >() /
cellSize_SI
)
)
);

/* ... and only in that center cell the density is 1.0, outside zero */
bool isStartCell = true;
for( uint64_t d = 0; d < simDim; ++d )
if( cell_id[d] != cell_start[d] )
isStartCell = false;

if( isStartCell )
return 1.0;

return 0.0;
}
};

/* definition of free formula profile */
using FreeFormula = FreeFormulaImpl< FreeFormulaFunctor >;

}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2013-2017 Rene Widera, Richard Pausch
* Copyright 2013-2017 Rene Widera, Richard Pausch, Axel Huebl
*
* This file is part of PIConGPU.
*
Expand All @@ -26,6 +26,8 @@
#include "nvidia/functors/Add.hpp"
#include "nvidia/functors/Assign.hpp"

#include <limits>

namespace picongpu
{

Expand All @@ -35,14 +37,21 @@ namespace particles
/** a particle with a weighting below MIN_WEIGHTING will not
* be created / will be deleted
* unit: none */
#ifdef PARAM_SINGLE_PARTICLE
/* note: this specific setting allows all kinds of weightings > 0.0 */
constexpr float_X MIN_WEIGHTING = std::numeric_limits< float_X >::min();

constexpr uint32_t TYPICAL_PARTICLES_PER_CELL = 1;
#else
constexpr float_X MIN_WEIGHTING = 10.0;

constexpr uint32_t TYPICAL_PARTICLES_PER_CELL = 6;
#endif

namespace manipulators
{

CONST_VECTOR(float_X,3,DriftParamNegative_direction,0.0,-1.0,0.0);
CONST_VECTOR( float_X, 3, DriftParamNegative_direction, 0.0, -1.0, 0.0 );
struct DriftParamNegative
{
/** Initial particle drift velocity for electrons and ions
Expand All @@ -53,9 +62,12 @@ namespace manipulators
const DriftParamNegative_direction_t direction;
};
/* definition of SetDrift start*/
typedef DriftImpl<DriftParamNegative,nvidia::functors::Assign> AssignYDriftNegative;
typedef DriftImpl<
DriftParamNegative,
nvidia::functors::Assign
> AssignYDriftNegative;

} //namespace manipulators
} // namespace manipulators


namespace startPosition
Expand All @@ -67,8 +79,33 @@ namespace startPosition
* unit: none */
static constexpr uint32_t numParticlesPerCell = TYPICAL_PARTICLES_PER_CELL;
};
/* definition of random particle start*/
typedef RandomImpl<RandomParameter> Random;

/* definition of random particle start */
typedef RandomImpl< RandomParameter > Random;


/* sit directly in lower corner of the cell */
CONST_VECTOR(
float_X,
3,
InCellOffset,
/* each x, y, z in-cell position component in range [0.0, 1.0) */
0.0,
0.0,
0.0
);

struct OnePositionParameter
{
/** Count of particles per cell at initial state
* unit: none */
static constexpr uint32_t numParticlesPerCell = TYPICAL_PARTICLES_PER_CELL;

const InCellOffset_t inCellOffset;
};

/* definition of one specific position for particle start */
using OnePosition = OnePositionImpl< OnePositionParameter >;

} //namespace startPosition

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
/**
* Copyright 2013-2017 Rene Widera, Benjamin Worpitz, Heiko Burau
*
* This file is part of PIConGPU.
*
* PIConGPU is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PIConGPU is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PIConGPU.
* If not, see <http://www.gnu.org/licenses/>.
*/



#pragma once

#include "simulation_defines.hpp"
#include "particles/Identifier.hpp"
#include "compileTime/conversion/MakeSeq.hpp"
#include "identifier/value_identifier.hpp"

#include "particles/traits/FilterByFlag.hpp"
#include "particles/Particles.hpp"
#include <boost/mpl/string.hpp>

#include "particles/ionization/byField/ionizers.def"

namespace picongpu
{

/*########################### define particle attributes #####################*/

/** describe attributes of a particle*/
using DefaultParticleAttributes = MakeSeq_t<
position< position_pic >,
momentum,
weighting,
particleId,
momentumPrev1
#if( RAD_MARK_PARTICLE > 1 ) || ( RAD_ACTIVATE_GAMMA_FILTER != 0 )
, radiationFlag
#endif
>;

/*########################### end particle attributes ########################*/

/*########################### define species #################################*/

/*--------------------------- photons -------------------------------------------*/

value_identifier( float_X, MassRatioPhotons, 0.0 );
value_identifier( float_X, ChargeRatioPhotons, 0.0 );

using ParticleFlagsPhotons = bmpl::vector<
particlePusher< particles::pusher::Photon >,
shape< UsedParticleShape >,
interpolation< UsedField2Particle >,
current< UsedParticleCurrentSolver >,
massRatio< MassRatioPhotons >,
chargeRatio< ChargeRatioPhotons >
>;

/* define species photons */
using PIC_Photons = Particles<
bmpl::string< 'p', 'h' >,
DefaultParticleAttributes,
ParticleFlagsPhotons
>;

/*--------------------------- electrons --------------------------------------*/

/* ratio relative to BASE_CHARGE and BASE_MASS */
value_identifier( float_X, MassRatioElectrons, 1.0 );
value_identifier( float_X, ChargeRatioElectrons, 1.0 );

using ParticleFlagsElectrons = bmpl::vector<
particlePusher< UsedParticlePusher >,
shape< UsedParticleShape >,
interpolation< UsedField2Particle >,
current< UsedParticleCurrentSolver >,
massRatio< MassRatioElectrons >,
chargeRatio< ChargeRatioElectrons >
#if( ENABLE_SYNCHROTRON_PHOTONS == 1 )
, synchrotronPhotons< PIC_Photons >
#endif
>;

/* define species electrons */
using PIC_Electrons = Particles<
bmpl::string< 'e' >,
DefaultParticleAttributes,
ParticleFlagsElectrons
>;

/*--------------------------- ions -------------------------------------------*/

/* ratio relative to BASE_CHARGE and BASE_MASS */
value_identifier( float_X, MassRatioIons, 1836.152672 );
value_identifier( float_X, ChargeRatioIons, -1.0 );

/*! Specify (chemical) element
*
* Proton and neutron numbers define the chemical element that the ion species
* is based on. This value can be non-integer for physical models taking
* charge shielding effects into account.
* @see http://en.wikipedia.org/wiki/Effective_nuclear_charge
*
* It is wrapped into a struct because of C++ restricting floats from being
* template arguments.
*
* Do not forget to set the correct mass of the atom in
* @see physicalConstants.param !
*/
struct Hydrogen
{
static constexpr float_X numberOfProtons = 1.0;
static constexpr float_X numberOfNeutrons = 0.0;
};

/*! Ionization Model Configuration ----------------------------------------
*
* - None : no particle is ionized
* - BSIHydrogenLike : simple barrier suppression ionization
* - ADKLinPol : Ammosov-Delone-Krainov tunneling ionization (H-like)
* -> linearly polarized lasers
* - ADKCircPol : Ammosov-Delone-Krainov tunneling ionization (H-like)
* -> circularly polarized lasers
* - Keldysh : Keldysh ionization model
*
* Research and development: ----------------------------------------------
* - BSIEffectiveZ : BSI taking electron shielding into account via an effective
* atomic number Z_eff
* - BSIStarkShifted : BSI for hydrogen-like atoms and ions considering the
* Stark upshift of ionization potentials
*
* Usage: Add a flag to the list of particle flags that has the following structure
*
* ionizer< IonizationModel< Species2BCreated > >
*/

using ParticleFlagsIons = bmpl::vector<
particlePusher< UsedParticlePusher >,
shape< UsedParticleShape >,
interpolation< UsedField2Particle >,
current< UsedParticleCurrentSolver >,
massRatio< MassRatioIons >,
chargeRatio< ChargeRatioIons >
>;

/* define species ions */
using PIC_Ions = Particles<
bmpl::string< 'i' >,
DefaultParticleAttributes,
ParticleFlagsIons
>;

/*########################### end species ####################################*/


/*! we delete this ugly definition of VectorAllSpecies after all picongpu components
* support multi species */
/** \todo: not nice, but this should be changed in the future*/
using Species1 = MakeSeq_t<
#if( ENABLE_ELECTRONS == 1 )
PIC_Electrons
#endif
>;

using Species2 = MakeSeq_t<
#if( ENABLE_IONS == 1 )
PIC_Ions
#endif
>;

using VectorAllSpecies = MakeSeq_t<
Species1,
Species2
#if( ENABLE_SYNCHROTRON_PHOTONS == 1 )
, PIC_Photons
#endif
>;

} //namespace picongpu
Loading