Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4638a6563c |
@@ -13,29 +13,14 @@ class ElasticScattering : public Interaction {
|
||||
std::shared_ptr<species::Specie> target,
|
||||
std::shared_ptr<ScatteringAngleDistribution> theta_distrib);
|
||||
|
||||
virtual InteractionOutput performInteraction(particle::Particle& particle,
|
||||
InteractionOutput performInteraction(particle::Particle& particle,
|
||||
RandomNumbers* generator);
|
||||
virtual double drawCollisionTime(particle::Particle& particle,
|
||||
RandomNumbers* generator);
|
||||
protected:
|
||||
private:
|
||||
std::shared_ptr<ScatteringAngleDistribution> theta_distrib_;
|
||||
};
|
||||
|
||||
// Full elastic scattering in the sense that both particles after scattering
|
||||
// become tracked
|
||||
class ElasticScatteringFull : public ElasticScattering {
|
||||
public:
|
||||
ElasticScatteringFull(std::function<double(double)> cross_section,
|
||||
std::shared_ptr<species::Specie> target,
|
||||
std::shared_ptr<ScatteringAngleDistribution> theta_distrib,
|
||||
std::shared_ptr<species::TrackedSpecie> product);
|
||||
|
||||
InteractionOutput performInteraction(particle::Particle& particle,
|
||||
RandomNumbers* generator);
|
||||
protected:
|
||||
std::shared_ptr<species::TrackedSpecie> product_;
|
||||
};
|
||||
|
||||
}; // namespace interaction
|
||||
|
||||
#endif /* ELASTIC_SCATTERING_H */
|
||||
|
||||
@@ -39,8 +39,7 @@ class ElectronIonization : public Interaction {
|
||||
std::shared_ptr<species::TrackedSpecie> ion,
|
||||
std::shared_ptr<IonizationEnergyDistribution> distribution,
|
||||
std::shared_ptr<IonizationScatteringAngleDistribution> angle_distribution,
|
||||
double ionization_energy_eV,
|
||||
double ion_energy);
|
||||
double ionization_energy_eV);
|
||||
|
||||
InteractionOutput performInteraction(particle::Particle& particle,
|
||||
RandomNumbers* generator);
|
||||
@@ -49,7 +48,6 @@ class ElectronIonization : public Interaction {
|
||||
std::shared_ptr<IonizationEnergyDistribution> energy_distribution_;
|
||||
std::shared_ptr<IonizationScatteringAngleDistribution> angle_distribution_;
|
||||
const double ionization_energy_eV_;
|
||||
const double ion_energy_;
|
||||
|
||||
std::shared_ptr<species::TrackedSpecie> electron_;
|
||||
std::shared_ptr<species::TrackedSpecie> ion_;
|
||||
|
||||
@@ -56,30 +56,6 @@ void addInteractions(
|
||||
new interaction::ElasticScattering(cross_section, target,
|
||||
scattering_angle_distribution)));
|
||||
|
||||
} else if (type == "ElasticScatteringFull") {
|
||||
#ifdef debug_level2
|
||||
DEBUG_LEVEL_2("Adding interactions: ElasticScatteringFull");
|
||||
#endif
|
||||
std::function<double(double)> cross_section =
|
||||
buildTotalCrossSection(json_object_by_path(value, {"CrossSection"}));
|
||||
|
||||
std::string target_name =
|
||||
json_string(json_object_by_path(value, {"Target"}));
|
||||
std::string product_name =
|
||||
json_string(json_object_by_path(value, {"Product"}));
|
||||
#ifdef debug_level3
|
||||
DEBUG("with target " + target_name);
|
||||
DEBUG("and product " + product_name);
|
||||
#endif
|
||||
|
||||
std::shared_ptr<species::Specie> target =
|
||||
findTarget(target_name, tracked_species, background_species);
|
||||
std::shared_ptr<species::TrackedSpecie> product =
|
||||
findTracked(product_name, tracked_species);
|
||||
|
||||
specie->addInteraction(std::shared_ptr<interaction::Interaction>(
|
||||
new interaction::ElasticScatteringFull(cross_section, target,
|
||||
nullptr, product)));
|
||||
} else if (type == "FreeMovement") {
|
||||
#ifdef debug_level2
|
||||
DEBUG_LEVEL_2("Adding interactions: FreeMovement");
|
||||
@@ -107,7 +83,6 @@ void addInteractions(
|
||||
|
||||
std::string ionization_model =
|
||||
json_string(json_object_by_path(value, {"IonizationModel"}));
|
||||
|
||||
if (ionization_model == "JanevNonDiss") {
|
||||
std::function<double(double)> cross_section =
|
||||
interaction::totalCrossSection::eT2_ionization_janev_non_diss();
|
||||
@@ -133,7 +108,7 @@ void addInteractions(
|
||||
std::make_shared<interaction::ElectronIonization>(
|
||||
cross_section, target, electron, ion,
|
||||
ionization_energy_distribution, scattering_angle_distribution,
|
||||
ionization_energy_eV, 0.));
|
||||
ionization_energy_eV));
|
||||
} else if (ionization_model == "JanevDissToGround") {
|
||||
std::function<double(double)> cross_section =
|
||||
interaction::totalCrossSection::eT2_ionization_janev_diss_ground();
|
||||
@@ -159,7 +134,7 @@ void addInteractions(
|
||||
std::make_shared<interaction::ElectronIonization>(
|
||||
cross_section, target, electron, ion,
|
||||
ionization_energy_distribution, scattering_angle_distribution,
|
||||
ionization_energy_eV, 9.));
|
||||
ionization_energy_eV));
|
||||
} else if (ionization_model == "JanevDissToFirstExcited") {
|
||||
std::function<double(double)> cross_section =
|
||||
interaction::totalCrossSection::eT2_ionization_janev_diss_first();
|
||||
@@ -187,7 +162,7 @@ void addInteractions(
|
||||
std::make_shared<interaction::ElectronIonization>(
|
||||
cross_section, target, electron, ion,
|
||||
ionization_energy_distribution, scattering_angle_distribution,
|
||||
ionization_energy_eV, 9.));
|
||||
ionization_energy_eV));
|
||||
} else if (ionization_model == "JanevAtomic") {
|
||||
std::function<double(double)> cross_section =
|
||||
interaction::totalCrossSection::eT_ionization_from_ground_janev();
|
||||
@@ -211,7 +186,7 @@ void addInteractions(
|
||||
std::make_shared<interaction::ElectronIonization>(
|
||||
cross_section, target, electron, ion,
|
||||
ionization_energy_distribution, scattering_angle_distribution,
|
||||
ionization_energy_eV, 0.));
|
||||
ionization_energy_eV));
|
||||
} else {
|
||||
ERROR("This ionization model is not implemented: " + ionization_model);
|
||||
}
|
||||
|
||||
@@ -126,55 +126,4 @@ double ElasticScattering::drawCollisionTime(particle::Particle& particle,
|
||||
return time;
|
||||
}
|
||||
|
||||
ElasticScatteringFull::ElasticScatteringFull(
|
||||
std::function<double(double)> cross_section,
|
||||
std::shared_ptr<species::Specie> target,
|
||||
std::shared_ptr<ScatteringAngleDistribution> theta_distrib,
|
||||
std::shared_ptr<species::TrackedSpecie> product) :
|
||||
ElasticScattering(cross_section, target, theta_distrib),
|
||||
product_(product) {}
|
||||
|
||||
// always assumes an isotropic angle distribution in the CoM frame
|
||||
InteractionOutput ElasticScatteringFull::performInteraction(particle::Particle& particle,
|
||||
RandomNumbers* generator) {
|
||||
#ifdef debug
|
||||
DEBUG_LEVEL_0("Perform full elastic scattering.");
|
||||
#endif
|
||||
|
||||
const blitz::TinyVector<double, 3> v_impact =
|
||||
particle.velocity().cartesianEntries();
|
||||
|
||||
// fprintf(stdout, "<%d>: Ekin T+ %e \n", MpiCommunication::mpiRank(), particle.kineticEnergy_eV());
|
||||
|
||||
const blitz::TinyVector<double, 3> v_com =
|
||||
kinematic::velocityOfCenterOfMass(v_impact, target_velocity_.cartesianEntries(),
|
||||
particle.mass_kg(), target_->mass_kg());
|
||||
|
||||
const double theta = std::acos(1. - 2*generator->rollUniform(0.,1.));
|
||||
const double phi = generator->rollUniform(0., 2 * M_PI);
|
||||
|
||||
double vi_com_abs = kinematic::norm(v_impact - v_com);
|
||||
|
||||
// isotropic in CoM
|
||||
blitz::TinyVector<double, 3> vi_com_scat(std::sin(theta)*std::cos(phi),
|
||||
std::sin(theta)*std::sin(phi),
|
||||
std::cos(theta));
|
||||
vi_com_scat *= vi_com_abs;
|
||||
blitz::TinyVector<double, 3> vt_com_scat = -particle.mass_kg()/target_->mass_kg() * vi_com_scat;
|
||||
|
||||
particle.velocity(CartesianVector(vi_com_scat + v_com));
|
||||
|
||||
// double Ekin = kinematic::kineticEnergy(vt_com_scat, product_->mass_kg())*UnitConversion::JouleToeV;
|
||||
// fprintf(stdout, "<%d>: Ekin T2scat %f\n", MpiCommunication::mpiRank(), Ekin);
|
||||
// Ekin = kinematic::kineticEnergy(vi_com_scat, particle.mass_kg())*UnitConversion::JouleToeV;
|
||||
// fprintf(stdout, "<%d>: Ekin T+scat %f\n", MpiCommunication::mpiRank(), Ekin);
|
||||
|
||||
InteractionOutput output;
|
||||
output.add(particle::Particle(product_, particle.cartesianPosition(),
|
||||
CartesianVector(vt_com_scat+v_com),
|
||||
particle.timeAlive(), particle.weight()));
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
}; // namespace interaction
|
||||
@@ -18,14 +18,13 @@ ElectronIonization::ElectronIonization(
|
||||
std::shared_ptr<species::TrackedSpecie> ion,
|
||||
std::shared_ptr<IonizationEnergyDistribution> distribution,
|
||||
std::shared_ptr<IonizationScatteringAngleDistribution> angle_distribution,
|
||||
double ionization_energy_eV, double ion_energy)
|
||||
double ionization_energy_eV)
|
||||
: Interaction(cross_section, target),
|
||||
electron_(electron),
|
||||
ion_(ion),
|
||||
energy_distribution_(distribution),
|
||||
angle_distribution_(angle_distribution),
|
||||
ionization_energy_eV_(ionization_energy_eV),
|
||||
ion_energy_(ion_energy) {}
|
||||
ionization_energy_eV_(ionization_energy_eV) {}
|
||||
|
||||
InteractionOutput ElectronIonization::performInteraction(
|
||||
particle::Particle& particle,
|
||||
@@ -115,12 +114,6 @@ InteractionOutput ElectronIonization::performInteraction(
|
||||
particle.velocity(v_impact_new);
|
||||
|
||||
|
||||
blitz::TinyVector<double, 3> 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();
|
||||
|
||||
@@ -128,10 +121,8 @@ InteractionOutput ElectronIonization::performInteraction(
|
||||
output.add(
|
||||
particle::Particle(electron_, x_impact, CartesianVector(v_ejected),
|
||||
time_birth, weight_parent));
|
||||
if(ion_energy_ > 0) {
|
||||
output.add(particle::Particle(ion_, x_impact, CartesianVector(v_ion),
|
||||
time_birth, weight_parent));
|
||||
}
|
||||
output.add(particle::Particle(ion_, x_impact, CartesianVector(v_target),
|
||||
time_birth, weight_parent));
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ CurrentCollector::CurrentCollector(const CylinderBinning& position_binning,
|
||||
collector_areas_phi(createAreaAzimuthal(position_binning))
|
||||
#ifdef GENRICHCURRENT
|
||||
// Hard coded values, not ideal, but it didn't work using defines...
|
||||
, energy_binning_(0.1, 10, 100)
|
||||
, energy_binning_(0.1, 5, 100)
|
||||
, sample_z_negative_crossings(
|
||||
blitz::Range(position_binning.binIndexMin()(0),
|
||||
position_binning.binIndexMax()(0)),
|
||||
|
||||
@@ -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,14 +483,6 @@ 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(
|
||||
|
||||
Reference in New Issue
Block a user