diff --git a/include/interactions/ionization.h b/include/interactions/ionization.h index b07c102..7bc59a7 100755 --- a/include/interactions/ionization.h +++ b/include/interactions/ionization.h @@ -39,7 +39,8 @@ class ElectronIonization : public Interaction { std::shared_ptr ion, std::shared_ptr distribution, std::shared_ptr angle_distribution, - double ionization_energy_eV); + double ionization_energy_eV, + double ion_energy); InteractionOutput performInteraction(particle::Particle& particle, RandomNumbers* generator); @@ -48,6 +49,7 @@ class ElectronIonization : public Interaction { std::shared_ptr energy_distribution_; std::shared_ptr angle_distribution_; const double ionization_energy_eV_; + const double ion_energy_; std::shared_ptr electron_; std::shared_ptr ion_; diff --git a/src/generators/interaction_generator.cpp b/src/generators/interaction_generator.cpp index 12ec178..d3971f1 100755 --- a/src/generators/interaction_generator.cpp +++ b/src/generators/interaction_generator.cpp @@ -83,6 +83,7 @@ void addInteractions( std::string ionization_model = json_string(json_object_by_path(value, {"IonizationModel"})); + if (ionization_model == "JanevNonDiss") { std::function cross_section = interaction::totalCrossSection::eT2_ionization_janev_non_diss(); @@ -108,7 +109,7 @@ void addInteractions( std::make_shared( cross_section, target, electron, ion, ionization_energy_distribution, scattering_angle_distribution, - ionization_energy_eV)); + ionization_energy_eV, 0.)); } else if (ionization_model == "JanevDissToGround") { std::function cross_section = interaction::totalCrossSection::eT2_ionization_janev_diss_ground(); @@ -134,7 +135,7 @@ void addInteractions( std::make_shared( cross_section, target, electron, ion, ionization_energy_distribution, scattering_angle_distribution, - ionization_energy_eV)); + ionization_energy_eV, 9.)); } else if (ionization_model == "JanevDissToFirstExcited") { std::function cross_section = interaction::totalCrossSection::eT2_ionization_janev_diss_first(); @@ -162,7 +163,7 @@ void addInteractions( std::make_shared( cross_section, target, electron, ion, ionization_energy_distribution, scattering_angle_distribution, - ionization_energy_eV)); + ionization_energy_eV, 9.)); } else if (ionization_model == "JanevAtomic") { std::function cross_section = interaction::totalCrossSection::eT_ionization_from_ground_janev(); @@ -186,7 +187,7 @@ void addInteractions( std::make_shared( cross_section, target, electron, ion, ionization_energy_distribution, scattering_angle_distribution, - ionization_energy_eV)); + ionization_energy_eV, 0.)); } else { ERROR("This ionization model is not implemented: " + ionization_model); } diff --git a/src/interactions/ionization.cpp b/src/interactions/ionization.cpp index 2a818bb..3d857a4 100755 --- a/src/interactions/ionization.cpp +++ b/src/interactions/ionization.cpp @@ -18,13 +18,14 @@ ElectronIonization::ElectronIonization( std::shared_ptr ion, std::shared_ptr distribution, std::shared_ptr angle_distribution, - double ionization_energy_eV) + double ionization_energy_eV, double ion_energy) : Interaction(cross_section, target), electron_(electron), ion_(ion), energy_distribution_(distribution), angle_distribution_(angle_distribution), - ionization_energy_eV_(ionization_energy_eV) {} + ionization_energy_eV_(ionization_energy_eV), + ion_energy_(ion_energy) {} InteractionOutput ElectronIonization::performInteraction( particle::Particle& particle, @@ -114,6 +115,12 @@ InteractionOutput ElectronIonization::performInteraction( particle.velocity(v_impact_new); + blitz::TinyVector v_ion = v_target; + + if(ion_energy_ > 0) { + v_ion *= std::sqrt(ion_energy_*UnitConversion::eVToJoule/(kinematic::kineticEnergy(v_target, ion_->mass_kg()))); + } + const double time_birth = particle.timeAlive(); const double weight_parent = particle.weight(); @@ -121,8 +128,10 @@ InteractionOutput ElectronIonization::performInteraction( output.add( particle::Particle(electron_, x_impact, CartesianVector(v_ejected), time_birth, weight_parent)); - output.add(particle::Particle(ion_, x_impact, CartesianVector(v_target), - time_birth, weight_parent)); + if(ion_energy_ > 0) { + output.add(particle::Particle(ion_, x_impact, CartesianVector(v_ion), + time_birth, weight_parent)); + } return output; } diff --git a/src/simulation/current_collector.cpp b/src/simulation/current_collector.cpp index 286063e..1e232d3 100755 --- a/src/simulation/current_collector.cpp +++ b/src/simulation/current_collector.cpp @@ -187,7 +187,7 @@ void CurrentCollector::collectLongitudinalMovement( if (bin_new(1) < bin_old(1)) { z_negative_crossings(bin_old(0), bin_new(1) + 1) += weight; #ifdef GENRICHCURRENT - if(bin_new(1) == -1) { + if(bin_new(1) == -1 && bin_new(0)*position_binning_.stepsize()(0) < 0.01) { int ebin = energy_binning_.bin(energy_eV); // #ifdef debug_genrich // // fprintf(stdout, "Energybin: %d, energy: %f\n", ebin, energy_eV); diff --git a/src/simulation/simulation.cpp b/src/simulation/simulation.cpp index 82efb2b..a99d383 100755 --- a/src/simulation/simulation.cpp +++ b/src/simulation/simulation.cpp @@ -169,7 +169,7 @@ void Simulation::start() { timer_->setDeltaT(delta_t); injector_->initInjectionTimeDistribution(delta_t); - timer_->increaseTimestep(delta_t); + // timer_->increaseTimestep(delta_t); while (timestep < number_timesteps) { #if defined(debug_level3) @@ -483,6 +483,14 @@ void Simulation::processUntilTermination(particle::Particle& particle) { } #endif break; + } else if ((particle.specie()->type() == species::ImplementedSpecies::electron) && (particle.kineticEnergy_eV() < 10.) || + (particle.kineticEnergy_eV() < 0.05)) { + // delete electrons once they can definitely no longer ionize the background particles and delete ions once they fell into the thermal region + if(particle.specie()->deletionLogger()) { + // abuse the "max deletion" deletion type to count the number of particles that are deleted due to falling out of the energy region of interest + particle.specie()->deletionLogger()->logDeletion(particle.cylinderPosition(), DeletionType::max_interactions); + } + break; } if ((!(particle.specie()->dynamicDensityField()->changedPositionBin(