From 364191d92ff4ae28d3cd6c62ca0f85d5fd30b194 Mon Sep 17 00:00:00 2001 From: csendlinger Date: Mon, 16 Feb 2026 08:56:40 +0100 Subject: [PATCH] Changes to cluster formation; T2p + T2 -> T3p + T is now considered a tertiary process and no longer a radiative one (might change again in the future); tertiary association now conserves (kinetic) energy and momentum in the center of mass frame (any energy released by the reaction or transferred into excitations are not accounted for); radiative association also conserves momentum in the center of mass frame, where the momentum of the photon is negelected however. --- include/interactions/cluster_formation.h | 18 ++-- src/generators/interaction_generator.cpp | 11 ++- src/interactions/cluster_formation.cpp | 106 ++++++++++++++++++++++- 3 files changed, 126 insertions(+), 9 deletions(-) diff --git a/include/interactions/cluster_formation.h b/include/interactions/cluster_formation.h index 4f34cbc..b1720a7 100755 --- a/include/interactions/cluster_formation.h +++ b/include/interactions/cluster_formation.h @@ -10,21 +10,20 @@ class Specie; namespace interaction { -// class for (radiative) cluster formation interactions (A + B --> AB) 7 -// or (A + BC --> AB + C) +// class for (radiative) cluster formation interactions (A + B --> AB) class ClusterFormation : public Interaction { public: ClusterFormation(std::function cross_section, std::shared_ptr target, std::shared_ptr product); - InteractionOutput performInteraction(particle::Particle& particle, + virtual InteractionOutput performInteraction(particle::Particle& particle, RandomNumbers* generator); protected: std::shared_ptr product_; }; -// class for tertiary association (A + B + B --> AB + B) +// class for tertiary association (A + B + B --> AB + B or A + B2 -> AB + B) class ClusterFormationTertiary : public ClusterFormation { public: // Constructor: takes the function describing the cross section (dependent on the energy of the incident particle) @@ -32,12 +31,21 @@ class ClusterFormationTertiary : public ClusterFormation { // and a shared_ptr to the TrackedSpecie that is the product of the interaction ClusterFormationTertiary(std::function cross_section, std::shared_ptr target, - std::shared_ptr product); + std::shared_ptr product, + bool rate_coefficient = true); // due to only the rate coefficients being available the cross section is // approximated as sigma = rate_coefficient * density / velocity // (units of the tertiary rate coefficient m^6/s) double microscopicCrossSection(double energy_eV, const Coordinate& position); + + InteractionOutput performInteraction(particle::Particle& particle, + RandomNumbers* generator); + + private: + // flag whether the "cross_section_" function is in truth calculated using a + // three body association rate + bool rate_coefficient_; }; diff --git a/src/generators/interaction_generator.cpp b/src/generators/interaction_generator.cpp index b94318e..12ec178 100755 --- a/src/generators/interaction_generator.cpp +++ b/src/generators/interaction_generator.cpp @@ -238,8 +238,15 @@ void addInteractions( "that the cross section function is scaled by the density " "of the target specie at the position of the interaction " "(cross section function assumed to have the units m^5)"); - specie->addInteraction(std::shared_ptr( - new interaction::ClusterFormationTertiary(cross_section, target, product))); + + if(json_string(json_object_by_path(value, {"CrossSection", "PredefinedFunction"})) + == "T2pT2_clustering_janev") { + specie->addInteraction(std::shared_ptr( + new interaction::ClusterFormationTertiary(cross_section, target, product, false))); + } else { + specie->addInteraction(std::shared_ptr( + new interaction::ClusterFormationTertiary(cross_section, target, product))); + } } else { ERROR("ClusteringType " + clustering_type + ": not known, choose either 'radiative' or 'tertiary'."); diff --git a/src/interactions/cluster_formation.cpp b/src/interactions/cluster_formation.cpp index bdd1fa9..e3d1e80 100755 --- a/src/interactions/cluster_formation.cpp +++ b/src/interactions/cluster_formation.cpp @@ -27,6 +27,7 @@ InteractionOutput ClusterFormation::performInteraction( // target_->velocityDistribution() // ->rollVelocity(x_impact, generator->engine()) // .cartesianEntries(); +/***************************************************************************** const double energy_eV = kinematic::kineticEnergy(target_velocity_.cartesianEntries(), target_->mass_kg()) * UnitConversion::JouleToeV; @@ -35,6 +36,15 @@ InteractionOutput ClusterFormation::performInteraction( target_velocity_.cartesianEntries() / kinematic::norm(target_velocity_.cartesianEntries()); // product inherits weight of the main particle (not the target, which is // assumed to be just a density, i.e. has no weight of its own) +********************************************************************************/ + +// neglect the momentum of the photon -> the cluster moves with the CoM velocity +// after the collision + blitz::TinyVector v_cluster = + (particle.mass_kg()*particle.velocity().cartesianEntries() + + target_->mass_kg()*target_velocity_.cartesianEntries()) / + (particle.mass_kg() + target_->mass_kg()); + particle::Particle cluster(product_, x_impact, CartesianVector(v_cluster), particle.timeAlive(), particle.weight()); @@ -53,15 +63,107 @@ InteractionOutput ClusterFormation::performInteraction( ClusterFormationTertiary::ClusterFormationTertiary( std::function cross_section, std::shared_ptr target, - std::shared_ptr product) : - ClusterFormation(cross_section, target, product) {} + std::shared_ptr product, + bool rate_coefficient) : + ClusterFormation(cross_section, target, product), rate_coefficient_(rate_coefficient) {} double ClusterFormationTertiary::microscopicCrossSection(double energy_eV, const Coordinate& position) { // SIM_INFO("Tertiary cross section."); + if(!rate_coefficient_) { + return cross_section_(energy_eV); + } const double rate_over_velocity = cross_section_(energy_eV); auto density = target_->densityField()->density(position); return rate_over_velocity * density; } +InteractionOutput ClusterFormationTertiary::performInteraction( + particle::Particle& particle, + RandomNumbers* generator) { +#ifdef debug_level3 + DEBUG_LEVEL_3("Perform cluster formation."); +#endif + const auto x_impact = particle.cartesianPosition(); +/****************************************************************** +// const blitz::TinyVector v_target = +// target_->driftVelocity()->driftVelocity(x_impact).cartesianEntries() + +// target_->velocityDistribution() +// ->rollVelocity(x_impact, generator->engine()) +// .cartesianEntries(); + const double energy_eV = + kinematic::kineticEnergy(target_velocity_.cartesianEntries(), target_->mass_kg()) * + UnitConversion::JouleToeV; + const blitz::TinyVector v_cluster = + kinematic::velocity(energy_eV, product_->mass_kg()) * + target_velocity_.cartesianEntries() / kinematic::norm(target_velocity_.cartesianEntries()); + // product inherits weight of the main particle (not the target, which is + // assumed to be just a density, i.e. has no weight of its own) + particle::Particle cluster(product_, x_impact, CartesianVector(v_cluster), + particle.timeAlive(), particle.weight()); +*****************************************************************/ + +// strictly speaking only correct for the reaction T2+ + T2 -> T3+ + T +// (otherwise missing momentum component of actual third body) + blitz::TinyVector v_com = particle.mass_kg()*particle.velocity().cartesianEntries() + + target_->mass_kg()*target_velocity_.cartesianEntries(); + + double E0_com = 0; + double total_mass = target_->mass_kg() + particle.mass_kg(); + +// differentiate between T+ + 2T2 and T2+ + T2 (probably not ideal if new types +// were to be implemented) + if(particle.specie()->type() == species::ImplementedSpecies::Tplus && + target_->type() == species::ImplementedSpecies::T2) { + // ignore any bulk movement of third interaction partner + blitz::TinyVector v3 = target_->velocityDistribution() + ->rollVelocity(x_impact, generator->engine()).cartesianEntries(); + total_mass += target_->mass_kg(); + v_com += target_->mass_kg()*v3; + v_com /= particle.mass_kg() + 2*target_->mass_kg(); + E0_com += 0.5*target_->mass_kg()*blitz::dot(v3 - v_com, v3 - v_com); + } else { + v_com /= total_mass; + } + blitz::TinyVector vi_com = particle.velocity().cartesianEntries() - v_com; + blitz::TinyVector vt_com = target_velocity_.cartesianEntries() - v_com; + + E0_com += 0.5*particle.mass_kg()*blitz::dot(vi_com, vi_com) + + 0.5*target_->mass_kg()*blitz::dot(vt_com, vt_com); + + double cluster_mass = product_->mass_kg(); + double rest_mass = total_mass - cluster_mass; + double reduced_mass = 1/(1/cluster_mass + 1/rest_mass); + + // momentum of the scattered particles in the CoM frame + double norm_pnew_com = std::sqrt(2*reduced_mass*E0_com); + + double phi = generator->rollUniform(0,1)*M_PI*2; + double theta = std::acos(1 - 2*generator->rollUniform(0,1)); + + // assume isotropic distribution of the scattered momenta in the CoM frame + // (removes the need to rotate wrt the incoming velocity) + // if a more general approach is needed, use the same calculation as in elastic scattering + + blitz::TinyVector p_cluster_com(std::sin(theta)*std::cos(phi), + std::sin(theta)*std::sin(phi), + std::cos(theta)); + p_cluster_com *= norm_pnew_com; + blitz::TinyVector v_cluster = (p_cluster_com/cluster_mass) + v_com; + + particle::Particle cluster(product_, x_impact, CartesianVector(v_cluster), + particle.timeAlive(), particle.weight()); + + InteractionOutput output; + output.add(cluster); + output.deleteCurrentParticle(true); + + if (particle.specie()->deletionLogger()) { + particle.specie()->deletionLogger()->logDeletion( + x_impact, DeletionType::cluster_formation); + } + + return output; +} + } // namespace interaction