-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Particle Manipulators: Init Multi-Ion Species
This commit adds new manipulators that can be used during the species init-pipeline. - `RatioWeightingImpl`: Useful to clone one ion species from an other ion species by still satisfying the densityRatio of the new created species. - `ProtonTimesWeightingImpl`: Useful to clone electron species from an ion species for pre-ionized plasmas. The weighting of the electrons is simply multiplied by the proton number of the initial ion species.
- Loading branch information
Showing
6 changed files
with
234 additions
and
2 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
src/picongpu/include/particles/manipulators/ProtonTimesWeightingImpl.def
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/** | ||
* Copyright 2015 Axel Huebl | ||
* | ||
* 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 | ||
|
||
namespace picongpu | ||
{ | ||
namespace particles | ||
{ | ||
namespace manipulators | ||
{ | ||
|
||
/* Re-scale the weighting of a cloned species by numberOfProtons | ||
* | ||
* When cloning species from each other, the new | ||
* species "inherits" the macro-particle weighting | ||
* of the first one. | ||
* This functor can be used to manipulate the weighting | ||
* of the new species' macro particles to be a multiplied by | ||
* the number of protons on the initial species. | ||
* | ||
* note: needs the atomicNumbers flag on the initial species, | ||
* used by the GetAtomicNumbers trait. | ||
*/ | ||
struct ProtonTimesWeightingImpl; | ||
|
||
} //namespace manipulators | ||
} //namespace particles | ||
} //namespace picongpu |
65 changes: 65 additions & 0 deletions
65
src/picongpu/include/particles/manipulators/ProtonTimesWeightingImpl.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/** | ||
* Copyright 2015 Axel Huebl | ||
* | ||
* 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 "particles/manipulators/ProtonTimesWeightingImpl.def" | ||
#include "particles/traits/GetAtomicNumbers.hpp" | ||
|
||
#include "simulation_defines.hpp" | ||
|
||
namespace picongpu | ||
{ | ||
namespace particles | ||
{ | ||
namespace manipulators | ||
{ | ||
|
||
struct ProtonTimesWeightingImpl | ||
{ | ||
|
||
template<typename T_SpeciesType> | ||
struct apply | ||
{ | ||
typedef ProtonTimesWeightingImpl type; | ||
}; | ||
|
||
HINLINE ProtonTimesWeightingImpl(uint32_t currentStep) | ||
{ | ||
|
||
} | ||
|
||
template<typename T_Particle1, typename T_Particle2> | ||
DINLINE void operator()(const DataSpace<simDim>&, | ||
T_Particle1& particleSpecies1, T_Particle2&, | ||
const bool isParticle1, const bool isParticle2) | ||
{ | ||
if (isParticle1 && isParticle2) | ||
{ | ||
const float_X protonNumber = traits::GetAtomicNumbers<T_Particle2>::type::numberOfProtons; | ||
particleSpecies1[weighting_] *= protonNumber; | ||
} | ||
} | ||
}; | ||
|
||
} //namespace manipulators | ||
} //namespace particles | ||
} //namespace picongpu |
47 changes: 47 additions & 0 deletions
47
src/picongpu/include/particles/manipulators/RatioWeightingImpl.def
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/** | ||
* Copyright 2015 Axel Huebl | ||
* | ||
* 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 | ||
|
||
namespace picongpu | ||
{ | ||
namespace particles | ||
{ | ||
namespace manipulators | ||
{ | ||
|
||
/* Re-scale the weighting of a cloned species by densityRatio | ||
* | ||
* When cloning species from each other, the new | ||
* species "inherits" the macro-particle weighting | ||
* of the first one. | ||
* This functor can be used to manipulate the weighting | ||
* of the new species' macro particles to satisfy the | ||
* input densityRatio of it. | ||
* | ||
* note: needs the densityRatio flag on both species, | ||
* used by the GetDensityRatio trait. | ||
*/ | ||
struct RatioWeighting; | ||
|
||
} //namespace manipulators | ||
} //namespace particles | ||
} //namespace picongpu |
69 changes: 69 additions & 0 deletions
69
src/picongpu/include/particles/manipulators/RatioWeightingImpl.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/** | ||
* Copyright 2015 Axel Huebl | ||
* | ||
* 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 "particles/manipulators/RatioWeightingImpl.def" | ||
#include "particles/traits/GetDensityRatio.hpp" | ||
|
||
#include "simulation_defines.hpp" | ||
|
||
namespace picongpu | ||
{ | ||
namespace particles | ||
{ | ||
namespace manipulators | ||
{ | ||
|
||
struct RatioWeightingImpl | ||
{ | ||
|
||
template<typename T_SpeciesType> | ||
struct apply | ||
{ | ||
typedef RatioWeightingImpl type; | ||
}; | ||
|
||
HINLINE RatioWeightingImpl(uint32_t currentStep) | ||
{ | ||
|
||
} | ||
|
||
template<typename T_Particle1, typename T_Particle2> | ||
DINLINE void operator()(const DataSpace<simDim>&, | ||
T_Particle1& particleSpecies1, T_Particle2&, | ||
const bool isParticle1, const bool isParticle2) | ||
{ | ||
if (isParticle1 && isParticle2) | ||
{ | ||
const float_X densityRatioDes = | ||
traits::GetDensityRatio<T_Particle1>::type::getDefaultValue(); | ||
const float_X densityRatioSrc = | ||
traits::GetDensityRatio<T_Particle2>::type::getDefaultValue(); | ||
|
||
particleSpecies1[weighting_] *= densityRatioDes / densityRatioSrc; | ||
} | ||
} | ||
}; | ||
|
||
} //namespace manipulators | ||
} //namespace particles | ||
} //namespace picongpu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters