Skip to content

Commit

Permalink
Use Resolve<> trait , make new attribute lists
Browse files Browse the repository at this point in the history
In this commit the Resolve<> trait from ComputationalRadiationPhysics#594 is used to connect the ionization
algorithm to the used model.

Furthermore new attribute lists for the different species have been introduced.
Functionality still has to be achieved. This has to be checked with ComputationalRadiationPhysics#615.

Prettying up comments
  • Loading branch information
Marco Garten committed Jan 15, 2015
1 parent 77b7888 commit c229069
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ namespace picongpu
/*########################### define particle attributes #####################*/

/** describe attributes of a particle*/
typedef typename MakeSeq<position<position_pic>, momentum, weighting, chargeState>::type DefaultParticleAttributes;

typedef typename MakeSeq<position<position_pic>, momentum, weighting>::type DefaultParticleAttributes;

/** \todo: not nice, we change this later with nice interfaces
* Plugins should add required attributes
Expand All @@ -63,12 +62,20 @@ radiationFlag
#endif
>::type AttributRadiationFlag;

/* attribute sequence for species: electrons */
typedef
typename MakeSeq<
DefaultParticleAttributes,
AttributMomentum_mt1,
AttributRadiationFlag
>::type DefaultAttributesSeq;
>::type AttributeSeqElectrons;

/* attribute sequence for species: ions */
typedef
typename MakeSeq<
DefaultParticleAttributes,
chargeState
>::type AttributeSeqIons;

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

Expand All @@ -84,11 +91,11 @@ typedef bmpl::vector<
current<UsedParticleCurrentSolver>
> ParticleFlagsElectrons;

/*define specie electrons*/
/* define species: electrons */
typedef Particles<ParticleDescription<
bmpl::string<'e'>,
SuperCellSize,
DefaultAttributesSeq,
AttributeSeqElectrons,
ParticleFlagsElectrons,
typename MakeSeq<CommunicationId<PAR_ELECTRONS>,MemoryFactor<2> >::type >
> PIC_Electrons;
Expand All @@ -105,15 +112,14 @@ struct IonizerNone
}
};

/* a simple ionization model for testing purposes
* - allows only ionization from +1 to +2 */
template<typename T_DestSpecies>
struct IonizerBSI
{

/* <TODO> Generalize by passing the ionization algorithm to the function
* That did not work so far by the following methods:
* - giving the type of the algorithm as a template parameter of "ionize"
* - accessing "..." in ionize via a struct in IonizerBSI
* - passing an instance of "..." and only using the type in "ionize" */
/* define ionization ALGORITHM for ionization MODEL */
typedef typename particles::ionizer::BSI IonizationAlgorithm;

template<typename T_SrcSpecies,typename T_ParticleStorage>
void operator()(T_SrcSpecies& src, T_ParticleStorage& pst, const uint32_t currentStep)
Expand Down Expand Up @@ -143,11 +149,11 @@ typedef bmpl::vector<
particleIonizer<IonizerBSI<PIC_Electrons> >
> ParticleFlagsIons;

/*define specie ions*/
/* define species: ions */
typedef Particles<ParticleDescription<
bmpl::string<'i'>,
SuperCellSize,
DefaultAttributesSeq,
AttributeSeqIons,
ParticleFlagsIons,
typename MakeSeq<CommunicationId<PAR_IONS>,MemoryFactor<2> >::type >
> PIC_Ions;
Expand Down
6 changes: 3 additions & 3 deletions src/picongpu/include/particles/ionization/ionization.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,9 +349,9 @@ template<typename T_Elec>
void Particles<T_ParticleDescription>::ionize( T_Elec electrons, uint32_t )
{

/* \todo This is only hard coded - I did not succeed, yet in generalizing
* this by giving the algorithm to the function */
typedef typename particles::ionizer::BSI::type ParticleIonize;
/* get the alias for the used ionizer (ionization model) and specify the ionization algorithm */
typedef typename GetFlagType<FrameType,particleIonizer<> >::type IonizerAlias;
typedef typename PMacc::traits::Resolve<IonizerAlias>::type::IonizationAlgorithm::type ParticleIonize;

typedef typename PMacc::traits::Resolve<
typename GetFlagType<FrameType,interpolation<> >::type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ namespace picongpu
__device__ void writeElectronIntoFrame(T_parentIon& parentIon,T_childElectron& childElectron,T_parentFrame& parentFrame, T_childFrame& childFrame)
{

/* each thread sets the multiMask hard on "particle" (=1) and the charge to 1 */
/* each thread sets the multiMask hard on "particle" (=1) */
childElectron[multiMask_] = 1;
childElectron[chargeState_] = 1;
const uint32_t weighting = parentIon[weighting_];

/* each thread initializes a clone of the parent ion but leaving out
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ namespace picongpu
/*########################### define particle attributes #####################*/

/** describe attributes of a particle*/
typedef typename MakeSeq<position<position_pic>, momentum, weighting, chargeState>::type DefaultParticleAttributes;

typedef typename MakeSeq<position<position_pic>, momentum, weighting>::type DefaultParticleAttributes;

/** \todo: not nice, we change this later with nice interfaces
* Plugins should add required attributes
Expand All @@ -63,12 +62,20 @@ radiationFlag
#endif
>::type AttributRadiationFlag;

/* attribute sequence for species: electrons */
typedef
typename MakeSeq<
DefaultParticleAttributes,
AttributMomentum_mt1,
AttributRadiationFlag
>::type DefaultAttributesSeq;
>::type AttributeSeqElectrons;

/* attribute sequence for species: ions */
typedef
typename MakeSeq<
DefaultParticleAttributes,
chargeState
>::type AttributeSeqIons;

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

Expand All @@ -84,11 +91,11 @@ typedef bmpl::vector<
current<UsedParticleCurrentSolver>
> ParticleFlagsElectrons;

/*define specie electrons*/
/* define species: electrons */
typedef Particles<ParticleDescription<
bmpl::string<'e'>,
SuperCellSize,
DefaultAttributesSeq,
AttributeSeqElectrons,
ParticleFlagsElectrons,
typename MakeSeq<CommunicationId<PAR_ELECTRONS>,MemoryFactor<2> >::type >
> PIC_Electrons;
Expand All @@ -105,16 +112,15 @@ struct IonizerNone
}
};

/* a simple ionization model for testing purposes
* - allows only ionization from +1 to +2 */
template<typename T_DestSpecies>
struct IonizerBSI
{

/* <TODO> Generalize by passing the ionization algorithm to the function
* That did not work so far by the following methods:
* - giving the type of the algorithm as a template parameter of "ionize"
* - accessing "..." in ionize via a struct in IonizerBSI
* - passing an instance of "..." and only using the type in "ionize" */

/* define ionization ALGORITHM for ionization MODEL */
typedef typename particles::ionizer::BSI IonizationAlgorithm;

template<typename T_SrcSpecies,typename T_ParticleStorage>
void operator()(T_SrcSpecies& src, T_ParticleStorage& pst, const uint32_t currentStep)
{
Expand All @@ -139,15 +145,14 @@ typedef bmpl::vector<
particlePusher<UsedParticlePusher>,
shape<UsedParticleShape>,
interpolation<UsedField2Particle>,
current<UsedParticleCurrentSolver>/*,*/
/*particleIonizer<IonizerBSI<PIC_Electrons> >*/ // enable for ionization
current<UsedParticleCurrentSolver>
> ParticleFlagsIons;

/*define specie ions*/
/* define species: ions */
typedef Particles<ParticleDescription<
bmpl::string<'i'>,
SuperCellSize,
DefaultAttributesSeq,
AttributeSeqIons,
ParticleFlagsIons,
typename MakeSeq<CommunicationId<PAR_IONS>,MemoryFactor<2> >::type >
> PIC_Ions;
Expand Down

0 comments on commit c229069

Please sign in to comment.