Merge branch 'atomic_tritium' into poisson_solver_devel

This commit is contained in:
2024-03-11 16:37:11 +01:00
58 changed files with 28079 additions and 9 deletions
+61 -2
View File
@@ -31,6 +31,7 @@ void addInteractions(
json_t* array = parameter.jsonObjectFromBase(path_to_interactions);
json_object_foreach(array, key, value) {
std::string type = json_string(json_object_by_path(value, {"Type"}));
if (type == "ElasticScattering") {
DEBUG_LEVEL_2("Adding interactions: ElasticScattering");
std::function<double(double)> cross_section =
@@ -154,6 +155,30 @@ void addInteractions(
cross_section, target, electron, ion,
ionization_energy_distribution, scattering_angle_distribution,
ionization_energy_eV));
} else if (ionization_model == "JanevAtomic") {
std::function<double(double)> cross_section =
interaction::totalCrossSection::eT_ionization_from_ground_janev();
const double ionization_energy_eV =
ionization::ionization_energy_janev_atomic;
auto ionization_energy_distribution =
std::make_shared<interaction::IonizationEnergyDistribution>(
interaction::d2CrossSection::eT_ionization_bed(),
ionization_energy_eV);
auto scattering_angle_distribution = std::make_shared<
interaction::IonizationScatteringAngleDistribution>();
if (electron->type() != species::ImplementedSpecies::electron) {
ERROR("The JanevAtomic needs electron species as outgoing electrons.");
}
if (ion->type() != species::ImplementedSpecies::Tplus) {
ERROR("The JanevAtomic nees T+ species as outgoing ions.");
}
specie->addInteraction(
std::make_shared<interaction::ElectronIonization>(
cross_section, target, electron, ion,
ionization_energy_distribution, scattering_angle_distribution,
ionization_energy_eV));
} else {
ERROR("This ionization model is not implemented.");
}
@@ -254,6 +279,17 @@ std::function<double(double)> buildTotalCrossSection(json_t* object) {
return interaction::totalCrossSection::eT2p_recombination_janev();
} else if (function_name == "eT3p_recombination_janev") {
return interaction::totalCrossSection::eT3p_recombination_janev();
} else if (function_name == "eT_elastic_scattering") {
return interaction::totalCrossSection::eT_elastic_scattering();
} else if (function_name == "TpT_elastic_scattering_schultz") {
return interaction::totalCrossSection::TpT_elastic_scattering_schultz();
} else if (function_name == "eT_ionization_from_ground_janev") {
return interaction::totalCrossSection::eT_ionization_from_ground_janev();
} else if (function_name == "TpT_clustering_tertiary_janev") {
// needs to be changed to account for the temperature, probs smth like excitation
return interaction::totalCrossSection::TpT_clustering_tertiary_janev(80.);
} else if (function_name == "eTp_recombination_kotelnikov") {
return interaction::totalCrossSection::eTp_recombination_kotelnikov();
}
else {
@@ -311,10 +347,18 @@ double buildExcitationEnergy(std::string excitation_state) {
return 0.0439;
} else if (excitation_state == "england_rotational_j1_to_j3") {
return 0.0727;
} else if (excitation_state == "janev_atomic_n2") {
return 10.2;
} else if (excitation_state == "janev_atomic_n3") {
return 12.09;
} else if (excitation_state == "janev_atomic_n4") {
return 12.75;
} else if (excitation_state == "janev_atomic_n5") {
return 13.06;
} else {
ERROR(
"This type of cross section ExcitationState is not implemented in "
"buildExcitationEnergy.");
"This type of cross section ExcitationState: " + excitation_state +
" is not implemented in buildExcitationEnergy.");
return 0.;
}
}
@@ -382,6 +426,18 @@ std::function<double(double)> buildExcitationCrossSection(
} else if (excitation_state == "england_rotational_j1_to_j3") {
return interaction::totalCrossSection::
eT2_excitation_rotational_j1_to_j3_england();
} else if (excitation_state == "janev_atomic_n2") {
return interaction::totalCrossSection::
eT_excitation_electric_from_ground_janev("n2");
} else if (excitation_state == "janev_atomic_n3") {
return interaction::totalCrossSection::
eT_excitation_electric_from_ground_janev("n3");
} else if (excitation_state == "janev_atomic_n4") {
return interaction::totalCrossSection::
eT_excitation_electric_from_ground_janev("n4");
} else if (excitation_state == "janev_atomic_n5") {
return interaction::totalCrossSection::
eT_excitation_electric_from_ground_janev("n5");
} else {
ERROR(
"This type of cross section ExcitationState is not implemented in "
@@ -390,12 +446,15 @@ std::function<double(double)> buildExcitationCrossSection(
}
}
//exists why?
std::function<double(double, double)> build2DCrossSection(json_t* object) {
if (json_object_by_path(object, {"PredefinedFunction"})) {
std::string function_name =
json_string(json_object_by_path(object, {"PredefinedFunction"}));
if (function_name == "eT2_ionization_bed") {
return interaction::d2CrossSection::eT2_ionization_bed();
} else if (function_name == "eT_ionization_bed") {
return interaction::d2CrossSection::eT_ionization_bed();
} else {
ERROR("This predefined function does not exist");
return nullptr;
+1
View File
@@ -10,6 +10,7 @@ namespace generator {
std::map<species::ImplementedSpecies, double> SpeciesMasses::mass_ = {
{species::ImplementedSpecies::electron, SI::me},
{species::ImplementedSpecies::T, 3 * SI::mp + SI::me},
{species::ImplementedSpecies::T2, 6 * SI::mp + 2 * SI::me},
{species::ImplementedSpecies::Tplus, 3 * SI::mp},
{species::ImplementedSpecies::T2plus, 6 * SI::mp + SI::me},
+2
View File
@@ -22,6 +22,7 @@ std::map<std::string, species::ImplementedSpecies>
{"T2+", species::ImplementedSpecies::T2plus},
{"T3+", species::ImplementedSpecies::T3plus},
{"T+", species::ImplementedSpecies::Tplus},
{"T", species::ImplementedSpecies::T},
{"T2", species::ImplementedSpecies::T2}};
species::ImplementedSpecies SpeciesAlias::alias(const std::string& name) {
@@ -48,6 +49,7 @@ bool SpeciesAlias::isAlias(const std::string& name) {
std::map<species::ImplementedSpecies, double> SpeciesCharges::charge_ = {
{species::ImplementedSpecies::electron, -SI::e},
{species::ImplementedSpecies::T, 0.},
{species::ImplementedSpecies::T2, 0.},
{species::ImplementedSpecies::Tplus, SI::e},
{species::ImplementedSpecies::T2plus, SI::e},
+4 -2
View File
@@ -4,6 +4,7 @@
#include "simulation/kinematic.h"
#include "simulation/logger.h"
#include "simulation/velocity_distribution.h"
#include "constants/physical_constants.h"
namespace interaction {
@@ -24,10 +25,11 @@ InteractionOutput ClusterFormation::performInteraction(
->rollVelocity(x_impact, generator->engine())
.cartesianEntries();
const double energy_eV =
kinematic::kineticEnergy(v_target, target_->mass_kg());
kinematic::kineticEnergy(v_target, target_->mass_kg()) *
UnitConversion::JouleToeV;
const blitz::TinyVector<double, 3> v_cluster =
kinematic::velocity(energy_eV, product_->mass_kg()) *
kinematic::norm(v_target);
v_target / kinematic::norm(v_target);
particle::Particle cluster(product_, x_impact, CartesianVector(v_cluster));
InteractionOutput output;
+179
View File
@@ -41,6 +41,35 @@ std::function<double(double, double)> eT2_ionization_bed() {
}
};
}
std::function<double(double, double)> eT_ionization_bed() {
return [=](double impact_energy, double energy_after_collision) {
const double S_m2 = 3.5166e-20;
const double ionization_energy = 13.6057;
const double u = 1.;
const double N = 1;
const double Ni = 0.4343;
const double c[4] = {-2.2473e-2, 1.1775, -4.6264e-1, 8.9064e-2};
if (impact_energy <= ionization_energy ||
(energy_after_collision >= (impact_energy - ionization_energy))) {
return 0.;
} else {
const double t = impact_energy / ionization_energy;
const double w = energy_after_collision / ionization_energy;
const double factor = S_m2 / ionization_energy / (t + u + 1);
const double summand_1 =
(Ni / N - 2) / (t + 1) * (1 / (w + 1) + 1 / (t - w));
const double summand_2 =
(2 - Ni / N) * (std::pow(w + 1, -2) + std::pow(t - w, -2));
double y = 1 / (w + 1);
const double dfdw = c[0] * std::pow(y, 2) + c[1] * std::pow(y, 3) +
c[2] * std::pow(y, 4) + c[3] * std::pow(y, 5);
const double summand_3 = std::log(t) / (N * (w + 1)) * dfdw;
return factor * (summand_1 + summand_2 + summand_3);
}
};
}
} // namespace d2CrossSection
namespace totalCrossSection {
@@ -99,6 +128,36 @@ std::function<double(double)> TpT2_elastic_scattering_tabata() {
};
}
std::function<double(double)> TpT_elastic_scattering_schultz() {
std::string homebase = BUILD_HOMEBASE_STRING;
std::string absolute_filename = homebase +
"/data/crossSections/pH_elastic_scattering/"
"pH_elastic_cross_section_total.h5";
Hdf5Reader reader(absolute_filename);
blitz::Array<double, 1> energies = reader.readD1Double("/energies(eV)");
blitz::Array<double, 1> cross_sections =
reader.readD1Double("/cross_sections(m-2)");
return D1ToD1::PiecewiseLinear(
std::vector<double>(energies.begin(), energies.end()),
std::vector<double>(cross_sections.begin(), cross_sections.end()));
}
std::function<double(double)> eT_elastic_scattering() {
std::string homebase = BUILD_HOMEBASE_STRING;
std::string absolute_filename = homebase +
"/data/crossSections/eH_elastic_scattering/"
"eH_elastic_cross_section_total.h5";
Hdf5Reader reader(absolute_filename);
blitz::Array<double, 1> energies = reader.readD1Double("/energies(eV)");
blitz::Array<double, 1> cross_sections =
reader.readD1Double("/cross_sections(m-2)");
return D1ToD1::PiecewiseLinear(
std::vector<double>(energies.begin(), energies.end()),
std::vector<double>(cross_sections.begin(), cross_sections.end()));
}
std::function<double(double)> T2pT2_charge_exchange_janev() {
return [=](double energy) {
const double sig_ll =
@@ -113,6 +172,16 @@ std::function<double(double)> T2pT2_charge_exchange_janev() {
};
}
std::function<double(double)> TpT_charge_exchange_janev() {
return [=](double energy) {
const double x_keV = energy * 1e-3;
const double factor = 3.2345*std::log(2.3588e2/x_keV + 2.3713);
const double divisor = 1 + 3.8371e-2*x_keV + 3.8068e-6*std::pow(x_keV, 3.5) +
1.1832e-10*std::pow(x_keV, 5.4);
return factor / divisor * 1e-20;
};
}
std::function<double(double)> eT2_ionization_bed() {
return [=](double energy) {
const double S_m2 = 5.4721e-20;
@@ -177,6 +246,22 @@ std::function<double(double)> eT2_ionization_janev_diss_first() {
};
}
std::function<double(double)> eT_ionization_from_ground_janev() {
return [=](double energy) {
const double deltaE_eV = 13.6;
if (energy <= deltaE_eV) {
return 0.;
} else {
const double x = energy/deltaE_eV;
const double var = 1 - 1/x;
const double var2 = var*var;
const double factor = 1e-19/(deltaE_eV*energy);
return factor * (0.18450*std::log(x) - 0.032226*var - 0.034539*var2
+ 1.4003*var2*var - 2.8115*var2*var2 + 2.2986*var2*var2*var);
}
};
}
std::function<double(double)> TpT2_clustering_radiative_ascendion_pasil() {
return [=](double energy) {
const double velocity = kinematic::velocity(energy, 3 * SI::mp);
@@ -197,6 +282,14 @@ std::function<double(double)> T2pT2_clustering_janev() {
};
}
std::function<double(double)> TpT_clustering_tertiary_janev(double temperature) {
return [=](double energy) {
const double rateCoeff = 1.238e-41 / std::pow(temperature, 1.046);
const double velocity = kinematic::velocity(energy, 3 * SI::mp);
return rateCoeff / velocity;
};
}
std::function<double(double)>
eT2_excitation_electric_janev_from_singlet_ground_state(
std::string final_state) {
@@ -279,6 +372,76 @@ eT2_excitation_electric_janev_from_singlet_ground_state(
}
}
std::function<double(double)> eT_excitation_electric_from_ground_janev(
std::string final_state) {
std::function<double(double, double, double, double, double, double, double)>
general_cross_section = [=](double energy, double deltaE_eV, double alpha,
double A0, double A1, double A2, double A3) {
if (energy < deltaE_eV) {
return 0.;
}
const double rel = energy / deltaE_eV;
return 5.984E-20 / (deltaE_eV * rel) * std::pow(1 - 1 / rel, alpha) *
(A1 + A2 / rel + A3 / (rel * rel) + A0 * std::log(rel));
};
if (final_state == "n2") {
return [=](double energy) {
const double deltaE_eV = 10.2;
if (energy <= deltaE_eV) {
return 0.;
} else if (energy <= 11.56) {
const double a = 0.228;
const double b = 0.1865;
return (a + b*(energy - deltaE_eV))*1e-20;
} else if (energy <= 12.33) {
return 0.5025e-20;
} else {
const double x = energy/deltaE_eV;
const double x2 = x*x;
return 5.984e-20/(deltaE_eV * x) * (4.4979*std::log(x) + 1.4182 -
20.877/x + 49.735/x2 - 46.249/(x2*x) + 17.442/(x2*x2));
}
};
} else if (final_state == "n3") {
return [=](double energy) {
const double deltaE_eV = 12.09;
const double alpha = 0.38277;
const double A0 = 0.75448;
const double A1 = 0.42956;
const double A2 = -0.58288;
const double A3 = 1.0693;
return general_cross_section(energy, deltaE_eV, alpha, A0, A1, A2, A3);
};
} else if (final_state == "n4") {
return [=](double energy) {
const double deltaE_eV = 12.75;
const double alpha = 0.41844;
const double A0 = 0.24300;
const double A1 = 0.24846;
const double A2 = 0.19701;
const double A3 = 0.;
return general_cross_section(energy, deltaE_eV, alpha, A0, A1, A2, A3);
};
} else if (final_state == "n5") {
return [=](double energy) {
const double deltaE_eV = 13.06;
const double alpha = 0.45929;
const double A0 = 0.11508;
const double A1 = 0.13092;
const double A2 = 0.23581;
const double A3 = 0.;
return general_cross_section(energy, deltaE_eV, alpha, A0, A1, A2, A3);
};
} else {
ERROR(
"This final state is not implemented for janev from ground state " +
final_state);
return nullptr;
}
}
std::function<double(double)>
eT2_excitation_electric_janev_from_singlet_ground_state_symmetry_forbidden(
std::string final_state) {
@@ -479,6 +642,22 @@ std::function<double(double)> eT3p_recombination_janev() {
};
}
std::function<double(double)> eTp_recombination_kotelnikov() {
return [=](double energy) {
const double prefactor_m2 = 256*M_PI*M_PI/3 * std::pow(1/137.035999084, 3) *
std::pow(5.291772, 2) * 1e-22;
const double eta = std::sqrt(13.6/energy);
const double eta2 = eta*eta;
const double sigma_rr_1 = prefactor_m2 * (std::pow(eta, 6) *
std::exp(-4*eta*std::atan(1/eta))) / ((1 - std::exp(-2*M_PI*eta)) *
std::pow((eta2 + 1), 2));
const double log_eta2p1 = std::log(eta2 + 1);
const double parametrization = (1.202 + 0.5782 * log_eta2p1 + 0.2148 *
log_eta2p1 * log_eta2p1) / (1. + 0.3425 * log_eta2p1);
return sigma_rr_1 * parametrization;
};
}
}; // namespace totalCrossSection
}; // namespace interaction
@@ -7,8 +7,8 @@ EventPositionDistribution::EventPositionDistribution(
Limit phi_position,
Limit z_position)
: mother_density_(mother_density),
r_values(std::uniform_real_distribution<double>(r_position.min,
r_position.max)),
r_values(std::uniform_real_distribution<double>(r_position.min*r_position.min,
r_position.max*r_position.max)),
phi_values(std::uniform_real_distribution<double>(phi_position.min,
phi_position.max)),
z_values(std::uniform_real_distribution<double>(z_position.min,
@@ -27,7 +27,7 @@ CylinderCoordinate EventPositionDistribution::rollPosition(
do {
random_number_z = z_values(*engine);
random_numer_r = r_values(*engine);
random_numer_r = std::sqrt(r_values(*engine));
random_number_phi = phi_values(*engine);
random_number_n = density_values(*engine);