Commit 52e0d58f authored by Valeriy M Tenishev's avatar Valeriy M Tenishev
Browse files

more managing function to control the particle splitting procedure

parent 79f1970a
......@@ -1340,6 +1340,15 @@ void DeleteAttachedParticles();
extern double x_shift_max;
extern bool apply_non_uniform_x_shift;
extern int Mode;
const int _disactivated=0;
const int _VelocityShift=1;
const int _Scatter=2;
void inline SetMode(int t) {Mode=t;}
void inline SetParam(double x_shift_in,double v_shift_in,int particle_num_limit_min_in,int particle_num_limit_max_in,bool non_uniform_x_shift) {
x_shift_max=x_shift_in,v_shift_max=v_shift_in;
particle_num_limit_min=particle_num_limit_min_in,particle_num_limit_max=particle_num_limit_max_in;
......
......@@ -12,6 +12,7 @@ int PIC::ParticleSplitting::particle_num_limit_max=150;
double PIC::ParticleSplitting::v_shift_max=0.01;
double PIC::ParticleSplitting::x_shift_max=0.2;
bool PIC::ParticleSplitting::apply_non_uniform_x_shift=false;
int PIC::ParticleSplitting::Mode=PIC::ParticleSplitting::_disactivated;
//functions for splitting/merging particles
void PIC::ParticleSplitting::Split::SplitWithVelocityShift(int particle_num_limit_min,int particle_num_limit_max) {
......
......@@ -339,6 +339,22 @@ void PIC::TimeStepInternal::ExecutionTrackDefault(double& ParticleMovingTime,dou
ParticleMovingTime=MPI_Wtime()-ParticleMovingTime;
//increase the number of particles if needed
switch (PIC::ParticleSplitting::Mode) {
case PIC::ParticleSplitting::_disactivated:
//do nothing
break;
case PIC::ParticleSplitting::_VelocityShift:
PIC::ParticleSplitting::Split::SplitWithVelocityShift(PIC::ParticleSplitting::particle_num_limit_min,PIC::ParticleSplitting::particle_num_limit_max);
break;
case PIC::ParticleSplitting::_Scatter:
PIC::ParticleSplitting::Split::Scatter(PIC::ParticleSplitting::particle_num_limit_min,PIC::ParticleSplitting::particle_num_limit_max);
break;
default:
exit(__LINE__,__FILE__,"Error: the option is unlnown");
}
//check the consistence of the particles lists
if ((_PIC_DEBUGGER_MODE_ == _PIC_DEBUGGER_MODE_ON_)&&(_CUDA_MODE_ == _OFF_)) {
CheckParticleLists();
......
......@@ -435,7 +435,9 @@ void amps_time_step(){
//run the particle splitting procedure
PIC::ParticleSplitting::SetParam(0.2,0.01,160,200,false);
PIC::ParticleSplitting::Split::SplitWithVelocityShift(160,200);
PIC::ParticleSplitting::SetMode(PIC::ParticleSplitting::_VelocityShift);
// PIC::ParticleSplitting::Split::SplitWithVelocityShift(160,200);
// PIC::ParticleSplitting::Split::Scatter(160,200);
for (int inode=0;inode<PIC::DomainBlockDecomposition::nLocalBlocks;inode++) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment